Commit 5acf9ecb authored by Jack Andersen's avatar Jack Andersen

Graphics debug groups and bug fixes

parent b4fe474d
......@@ -17,6 +17,7 @@
<mapping directory="$PROJECT_DIR$/hecl/extern/boo/lib/graphicsdev/nx/libdrm_nouveau" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/boo/lib/graphicsdev/nx/mesa" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/boo/logvisor" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/boo/logvisor/fmt" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/libSquish" vcs="Git" />
<mapping directory="$PROJECT_DIR$/hecl/extern/libjpeg-turbo" vcs="Git" />
<mapping directory="$PROJECT_DIR$/jbus" vcs="Git" />
......
......@@ -1293,6 +1293,7 @@ void CAutoMapper::Update(float dt, const CStateManager& mgr) {
}
void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, float alpha) const {
SCOPED_GRAPHICS_DEBUG_GROUP("CAutoMapper::Draw", zeus::skPurple);
alpha *= g_GameState->GameOptions().GetHUDAlpha() / 255.f;
// Blend mode alpha
// Backface cull
......
......@@ -41,6 +41,7 @@ CMapUniverse::CMapWorldData::CMapWorldData(CInputStream& in, u32 version)
void CMapUniverse::Draw(const CMapUniverseDrawParms& parms, const zeus::CVector3f&, float, float) const {
if (!x4_hexagonToken.IsLoaded())
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CMapUniverse::Draw", zeus::skBlue);
u32 totalSurfaceCount = 0;
for (const CMapWorldData& data : x10_worldDatas)
......
......@@ -121,6 +121,7 @@ void CMapWorld::Draw(const CMapWorld::CMapWorldDrawParms& parms, int curArea, in
bool inMapScreen) const {
if (depth1 == 0.f && depth2 == 0.f)
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CMapWorld::Draw", zeus::skBlue);
ClearTraversedFlags();
int areaDepth = std::ceil(std::max(depth1, depth2));
......
......@@ -105,6 +105,7 @@ std::pair<zeus::CColor, zeus::CColor> CMappableObject::GetDoorColors(int curArea
void CMappableObject::PostConstruct(const void*) { x10_transform = AdjustTransformForType(); }
void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo, float alpha, bool needsVtxLoad) const {
SCOPED_GRAPHICS_DEBUG_GROUP("CMappableObject::Draw", zeus::skCyan);
if (IsDoorType(x0_type)) {
std::pair<zeus::CColor, zeus::CColor> colors = GetDoorColors(curArea, mwInfo, alpha);
for (int s = 0; s < 6; ++s) {
......
......@@ -638,6 +638,7 @@ void CStateManager::ResetViewAfterDraw(const SViewport& backupViewport,
}
void CStateManager::DrawWorld() const {
SCOPED_GRAPHICS_DEBUG_GROUP("CStateManager::DrawWorld", zeus::skBlue);
CTimeProvider timeProvider(xf14_curTimeMod900);
SViewport backupViewport = g_Viewport;
......@@ -894,6 +895,8 @@ void CStateManager::DrawActorCubeFaces(CActor& actor, int& cubeInst) const {
}
for (int f = 0; f < 6; ++f) {
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CStateManager::DrawActorCubeFaces [{}] {} {} {}"),
f, actor.GetUniqueId(), actor.GetEditorId(), actor.GetName()).c_str(), zeus::skOrange);
CGraphics::g_BooMainCommandQueue->setRenderTarget(actor.m_reflectionCube, f);
SetupViewForCubeFaceDraw(actor.GetRenderBounds().center(), f);
CGraphics::g_BooMainCommandQueue->clearTarget();
......@@ -1036,6 +1039,7 @@ bool CStateManager::SetupFogForDraw() const {
void CStateManager::PreRender() {
if (xf94_24_readyToRender) {
SCOPED_GRAPHICS_DEBUG_GROUP("CStateManager::PreRender", zeus::skBlue);
zeus::CFrustum frustum = SetupDrawFrustum(g_Viewport);
x86c_stateManagerContainer->xf370_.clear();
x86c_stateManagerContainer->xf39c_renderLast.clear();
......
......@@ -430,6 +430,7 @@ void CBooRenderer::SetupRendererStates() const {
void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus::CAABox& aabb, const CModel* model,
const CSkinnedModel* sModel) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::ReallyRenderFogVolume", zeus::skPurple);
zeus::CMatrix4f proj = CGraphics::GetPerspectiveProjectionMatrix(false);
zeus::CVector4f points[8];
......@@ -755,6 +756,7 @@ void CBooRenderer::RemoveStaticGeometry(const std::vector<CMetroidModelInstance>
}
void CBooRenderer::DrawAreaGeometry(int areaIdx, int mask, int targetMask) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DrawAreaGeometry", zeus::skPurple);
x318_30_inAreaDraw = true;
// SetupRendererStates();
CModelFlags flags;
......@@ -789,6 +791,7 @@ void CBooRenderer::DrawAreaGeometry(int areaIdx, int mask, int targetMask) {
}
void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask, bool shadowRender) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DrawUnsortedGeometry", zeus::skPurple);
// SetupRendererStates();
CModelFlags flags;
flags.m_extendedShader = shadowRender ? EExtendedShader::SolidColor : EExtendedShader::Lighting;
......@@ -858,6 +861,7 @@ void CBooRenderer::DrawUnsortedGeometry(int areaIdx, int mask, int targetMask, b
}
void CBooRenderer::DrawSortedGeometry(int areaIdx, int mask, int targetMask) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DrawSortedGeometry", zeus::skPurple);
// SetupRendererStates();
CAreaListItem* lastOctreeItem = nullptr;
......@@ -1035,6 +1039,7 @@ void CBooRenderer::DrawString(const char*, int, int) {}
u32 CBooRenderer::GetFPS() { return 0; }
void CBooRenderer::CacheReflection(TReflectionCallback cb, void* ctx, bool clearAfter) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::CacheReflection", zeus::skPurple);
if (!x318_24_refectionDirty)
return;
x318_24_refectionDirty = false;
......@@ -1052,11 +1057,13 @@ void CBooRenderer::CacheReflection(TReflectionCallback cb, void* ctx, bool clear
}
void CBooRenderer::DrawSpaceWarp(const zeus::CVector3f& pt, float strength) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DrawSpaceWarp", zeus::skPurple);
m_spaceWarpFilter.setStrength(strength);
m_spaceWarpFilter.draw(pt);
}
void CBooRenderer::DrawThermalModel(const CModel& model, const zeus::CColor& mulCol, const zeus::CColor& addCol) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DrawThermalModel", zeus::skPurple);
CModelFlags flags;
flags.m_extendedShader = EExtendedShader::Thermal;
flags.x4_color = mulCol;
......@@ -1066,6 +1073,7 @@ void CBooRenderer::DrawThermalModel(const CModel& model, const zeus::CColor& mul
}
void CBooRenderer::DrawXRayOutline(const zeus::CAABox& aabb) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DrawXRayOutline", zeus::skPurple);
CModelFlags flags;
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
......@@ -1117,6 +1125,7 @@ void CBooRenderer::SetThermal(bool thermal, float level, const zeus::CColor& col
void CBooRenderer::SetThermalColdScale(float scale) { x2f8_thermColdScale = zeus::clamp(0.f, scale, 1.f); }
void CBooRenderer::DoThermalBlendCold() {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DoThermalBlendCold", zeus::skMagenta);
zeus::CColor a = zeus::CColor::lerp(x2f4_thermColor, zeus::skWhite, x2f8_thermColdScale);
m_thermColdFilter->setColorA(a);
float bAlpha = 1.f;
......@@ -1143,6 +1152,7 @@ void CBooRenderer::DoThermalBlendCold() {
}
void CBooRenderer::DoThermalBlendHot() {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DoThermalBlendHot", zeus::skMagenta);
m_thermHotFilter->draw();
m_thermalHotPass = false;
}
......@@ -1175,22 +1185,26 @@ void CBooRenderer::SetWorldLightFadeLevel(float level) { x2fc_tevReg1Color = zeu
void CBooRenderer::ReallyDrawPhazonSuitIndirectEffect(const zeus::CColor& vertColor, /*const CTexture& maskTex,*/
const CTexture& indTex, const zeus::CColor& modColor, float scale,
float offX, float offY) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::ReallyDrawPhazonSuitIndirectEffect", zeus::skMagenta);
float qScale = scale / 8.f; // Adjustment for URDE
m_phazonSuitFilter.draw(modColor, scale, offX * qScale, offY * qScale);
}
void CBooRenderer::ReallyDrawPhazonSuitEffect(const zeus::CColor& modColor /*, const CTexture& maskTex*/) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::ReallyDrawPhazonSuitEffect", zeus::skMagenta);
m_phazonSuitFilter.draw(modColor, 0.f, 0.f, 0.f);
}
void CBooRenderer::DoPhazonSuitIndirectAlphaBlur(float blurRadius /*, float f2*/,
const TLockedToken<CTexture>& indTex) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DoPhazonSuitIndirectAlphaBlur", zeus::skMagenta);
m_phazonSuitFilter.drawBlurPasses(blurRadius, indTex.IsLoaded() ? indTex.GetObj() : nullptr);
}
void CBooRenderer::DrawPhazonSuitIndirectEffect(const zeus::CColor& nonIndirectMod,
const TLockedToken<CTexture>& indTex, const zeus::CColor& indirectMod,
float blurRadius, float scale, float offX, float offY) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DrawPhazonSuitIndirectEffect", zeus::skPurple);
/* Indirect background already in binding 0 */
/* Resolve alpha channel of just-drawn phazon suit into binding 1 */
......@@ -1253,6 +1267,7 @@ void CBooRenderer::FindOverlappingWorldModels(std::vector<u32>& modelBits, const
int CBooRenderer::DrawOverlappingWorldModelIDs(int alphaVal, const std::vector<u32>& modelBits,
const zeus::CAABox& aabb) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DrawOverlappingWorldModelIDs", zeus::skGrey);
SetupRendererStates();
UpdateAreaUniforms(-1, EWorldShadowMode::BallOnWorldIds, false);
......@@ -1294,6 +1309,7 @@ int CBooRenderer::DrawOverlappingWorldModelIDs(int alphaVal, const std::vector<u
void CBooRenderer::DrawOverlappingWorldModelShadows(int alphaVal, const std::vector<u32>& modelBits,
const zeus::CAABox& aabb, float alpha) {
SCOPED_GRAPHICS_DEBUG_GROUP("CBooRenderer::DrawOverlappingWorldModelShadows", zeus::skGrey);
CModelFlags flags;
flags.x4_color.a() = alpha;
flags.m_extendedShader = EExtendedShader::MorphBallShadow; // Do shadow draw
......
......@@ -344,4 +344,25 @@ public:
void Draw() const { CGraphics::DrawArray(m_start, m_vec.size() - m_start); }
};
#ifdef BOO_GRAPHICS_DEBUG_GROUPS
class GraphicsDebugGroup {
/* Stack only */
void* operator new(size_t);
void operator delete(void*);
void* operator new[](size_t);
void operator delete[](void*);
public:
explicit GraphicsDebugGroup(const char* name, const zeus::CColor& color = zeus::skWhite) {
zeus::simd_floats f(color.mSimd);
CGraphics::g_BooMainCommandQueue->pushDebugGroup(name, f.array());
}
~GraphicsDebugGroup() {
CGraphics::g_BooMainCommandQueue->popDebugGroup();
}
};
#define SCOPED_GRAPHICS_DEBUG_GROUP(...) GraphicsDebugGroup _GfxDbg_(__VA_ARGS__);
#else
#define SCOPED_GRAPHICS_DEBUG_GROUP(...)
#endif
} // namespace urde
......@@ -238,6 +238,8 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
}
void CLineRenderer::Render(bool alphaWrite, const zeus::CColor& moduColor) {
SCOPED_GRAPHICS_DEBUG_GROUP("CLineRenderer::Render", zeus::skGrey);
if (!m_final && m_nextVert > 1) {
if (m_mode == EPrimitiveMode::LineLoop) {
{
......
......@@ -406,6 +406,7 @@ void CMoviePlayer::SetFrame(const zeus::CVector3f& a, const zeus::CVector3f& b,
void CMoviePlayer::DrawFrame() {
if (xd0_drawTexSlot == UINT32_MAX)
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CMoviePlayer::DrawFrame", zeus::skYellow);
/* draw appropriate field */
CTHPTextureSet& tex = x80_textures[xd0_drawTexSlot];
......
......@@ -44,6 +44,7 @@ void CRainSplashGenerator::SRainSplash::Draw(float alpha, float dt, const zeus::
}
void CRainSplashGenerator::DoDraw(const zeus::CTransform& xf) const {
SCOPED_GRAPHICS_DEBUG_GROUP("CRainSplashGenerator::DoDraw", zeus::skYellow);
CGraphics::SetModelMatrix(xf);
if (x40_queueSize > 0) {
if (x38_queueTail <= x3c_queueHead) {
......
......@@ -29,6 +29,7 @@ zeus::CAABox CSimpleShadow::GetBounds() const {
void CSimpleShadow::Render(const TLockedToken<CTexture>& tex) const {
if (!x48_24_collision)
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CSimpleShadow::Render", zeus::skGrey);
CGraphics::DisableAllLights();
CGraphics::SetModelMatrix(x0_xf);
......
......@@ -60,6 +60,8 @@ void CAABoxShader::setAABB(const zeus::CAABox& aabb) {
}
void CAABoxShader::draw(const zeus::CColor& color) {
SCOPED_GRAPHICS_DEBUG_GROUP("CAABoxShader::draw", zeus::skMagenta);
m_uniform.m_xf = CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f();
m_uniform.m_color = color;
m_uniBuf->load(&m_uniform, sizeof(Uniform));
......
......@@ -26,6 +26,7 @@ CCameraBlurFilter::CCameraBlurFilter() {
void CCameraBlurFilter::draw(float amount, bool clearDepth) {
if (amount <= 0.f)
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CCameraBlurFilter::draw", zeus::skMagenta);
SClipScreenRect clipRect(g_Viewport);
CGraphics::ResolveSpareTexture(clipRect, 0, clearDepth);
......
......@@ -54,6 +54,8 @@ CColoredQuadFilter::CColoredQuadFilter(EFilterType type) {
}
void CColoredQuadFilter::draw(const zeus::CColor& color, const zeus::CRectangle& rect) {
SCOPED_GRAPHICS_DEBUG_GROUP("CColoredQuadFilter::draw", zeus::skMagenta);
m_uniform.m_matrix[0][0] = rect.size.x() * 2.f;
m_uniform.m_matrix[1][1] = rect.size.y() * 2.f;
m_uniform.m_matrix[3][0] = rect.position.x() * 2.f - 1.f;
......
......@@ -67,6 +67,8 @@ CColoredStripShader::CColoredStripShader(boo::IGraphicsDataFactory::Context& ctx
}
void CColoredStripShader::draw(const zeus::CColor& color, size_t numVerts, const Vert* verts) {
SCOPED_GRAPHICS_DEBUG_GROUP("CColoredStripShader::draw", zeus::skMagenta);
m_vbo->load(verts, sizeof(Vert) * numVerts);
m_uniform.m_matrix = CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f();
......
......@@ -18,6 +18,8 @@ void CEnergyBarShader::updateModelMatrix() {
void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector<Vertex>& verts0, const zeus::CColor& color1,
const std::vector<Vertex>& verts1, const zeus::CColor& color2,
const std::vector<Vertex>& verts2, const CTexture* tex) {
SCOPED_GRAPHICS_DEBUG_GROUP("CEnergyBarShader::draw", zeus::skMagenta);
size_t totalVerts = verts0.size() + verts1.size() + verts2.size();
if (!totalVerts)
return;
......
......@@ -47,12 +47,16 @@ CFogVolumeFilter::CFogVolumeFilter() {
}
void CFogVolumeFilter::draw2WayPass(const zeus::CColor& color) {
SCOPED_GRAPHICS_DEBUG_GROUP("CFogVolumeFilter::draw2WayPass", zeus::skMagenta);
m_uniBuf->load(&color, sizeof(zeus::CColor));
CGraphics::SetShaderDataBinding(m_dataBind2Way);
CGraphics::DrawArray(0, 4);
}
void CFogVolumeFilter::draw1WayPass(const zeus::CColor& color) {
SCOPED_GRAPHICS_DEBUG_GROUP("CFogVolumeFilter::draw1WayPass", zeus::skMagenta);
m_uniBuf->load(&color, sizeof(zeus::CColor));
CGraphics::SetShaderDataBinding(m_dataBind1Way);
CGraphics::DrawArray(0, 4);
......
......@@ -49,6 +49,7 @@ void CFogVolumePlaneShader::addFan(const zeus::CVector3f* verts, int numVerts) {
void CFogVolumePlaneShader::draw(int pass) {
if (m_verts.empty())
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CFogVolumePlaneShader::draw", zeus::skMagenta);
if (pass == 0) {
if (m_vertCapacity < m_verts.size())
CommitResources(m_verts.size());
......
......@@ -22,6 +22,7 @@ CMapSurfaceShader::CMapSurfaceShader(boo::IGraphicsDataFactory::Context& ctx,
}
void CMapSurfaceShader::draw(const zeus::CColor& color, u32 start, u32 count) {
SCOPED_GRAPHICS_DEBUG_GROUP("CMapSurfaceShader::draw", zeus::skMagenta);
Uniform uniform = {CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f(), color};
m_uniBuf->load(&uniform, sizeof(Uniform));
CGraphics::SetShaderDataBinding(m_dataBind);
......
......@@ -24,6 +24,7 @@ void CPhazonSuitFilter::Shutdown() {
#define BLUR_SCALE (1.f / 128.f)
void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex) {
SCOPED_GRAPHICS_DEBUG_GROUP("CPhazonSuitFilter::drawBlurPasses", zeus::skMagenta);
if (!m_dataBind || indTex != m_indTex) {
m_indTex = indTex;
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) {
......@@ -120,6 +121,7 @@ void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex) {
}
void CPhazonSuitFilter::draw(const zeus::CColor& color, float indScale, float indOffX, float indOffY) {
SCOPED_GRAPHICS_DEBUG_GROUP("CPhazonSuitFilter::draw", zeus::skMagenta);
struct Uniform {
zeus::CColor color;
zeus::CVector4f indScaleOff;
......
......@@ -14,6 +14,7 @@ void CRadarPaintShader::Shutdown() { s_Pipeline.reset(); }
void CRadarPaintShader::draw(const std::vector<Instance>& instances, const CTexture* tex) {
if (!instances.size())
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CRadarPaintShader::draw", zeus::skMagenta);
if (instances.size() > m_maxInsts) {
m_maxInsts = instances.size();
......
......@@ -62,6 +62,8 @@ CRandomStaticFilter::CRandomStaticFilter(EFilterType type, bool cookieCutter) :
}
void CRandomStaticFilter::draw(const zeus::CColor& color, float t) {
SCOPED_GRAPHICS_DEBUG_GROUP("CRandomStaticFilter::draw", zeus::skMagenta);
m_uniform.color = color;
m_uniform.randOff = ROUND_UP_32(int64_t(rand()) * 32767 / RAND_MAX);
m_uniform.discardThres = 1.f - t;
......
......@@ -49,6 +49,8 @@ CScanLinesFilter::CScanLinesFilter(EFilterType type, bool even) : m_even(even) {
}
void CScanLinesFilter::draw(const zeus::CColor& color) {
SCOPED_GRAPHICS_DEBUG_GROUP("CScanLinesFilter::draw", zeus::skMagenta);
m_uniform.color = color;
m_uniBuf->load(&m_uniform, sizeof(Uniform));
......
......@@ -59,6 +59,8 @@ CSpaceWarpFilter::CSpaceWarpFilter() {
}
void CSpaceWarpFilter::draw(const zeus::CVector3f& pt) {
SCOPED_GRAPHICS_DEBUG_GROUP("CSpaceWarpFilter::draw", zeus::skMagenta);
/* Indirect coords are full-texture sampling when warp is completely in viewport */
m_uniform.m_indXf[1][1] = 1.f;
m_uniform.m_indXf[0][0] = 1.f;
......
......@@ -200,6 +200,8 @@ CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, TLockedToken<CTexture
}
void CTexturedQuadFilter::draw(const zeus::CColor& color, float uvScale, const zeus::CRectangle& rect, float z) {
SCOPED_GRAPHICS_DEBUG_GROUP("CTexturedQuadFilter::draw", zeus::skMagenta);
Vert verts[4] = {
{{0.f, 0.f, z}, {0.f, 0.f}},
{{0.f, 1.f, z}, {0.f, uvScale}},
......@@ -227,6 +229,8 @@ void CTexturedQuadFilter::draw(const zeus::CColor& color, float uvScale, const z
}
void CTexturedQuadFilter::drawCropped(const zeus::CColor& color, float uvScale) {
SCOPED_GRAPHICS_DEBUG_GROUP("CTexturedQuadFilter::drawCropped", zeus::skMagenta);
float xFac = CGraphics::g_CroppedViewport.xc_width / float(g_Viewport.x8_width);
float yFac = CGraphics::g_CroppedViewport.x10_height / float(g_Viewport.xc_height);
float xBias = CGraphics::g_CroppedViewport.x4_left / float(g_Viewport.x8_width);
......@@ -248,6 +252,8 @@ void CTexturedQuadFilter::drawCropped(const zeus::CColor& color, float uvScale)
}
void CTexturedQuadFilter::drawVerts(const zeus::CColor& color, const Vert verts[4], float lod) {
SCOPED_GRAPHICS_DEBUG_GROUP("CTexturedQuadFilter::drawVerts", zeus::skMagenta);
m_vbo->load(verts, sizeof(Vert) * 4);
m_uniform.m_matrix = CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f();
......@@ -260,6 +266,8 @@ void CTexturedQuadFilter::drawVerts(const zeus::CColor& color, const Vert verts[
}
void CTexturedQuadFilter::DrawFilter(EFilterShape shape, const zeus::CColor& color, float t) {
SCOPED_GRAPHICS_DEBUG_GROUP("CTexturedQuadFilter::DrawFilter", zeus::skMagenta);
m_uniform.m_matrix = zeus::CMatrix4f();
m_uniform.m_lod = 0.f;
m_uniform.m_color = color;
......
......@@ -40,6 +40,8 @@ CThermalColdFilter::CThermalColdFilter() {
}
void CThermalColdFilter::draw() {
SCOPED_GRAPHICS_DEBUG_GROUP("CThermalColdFilter::draw", zeus::skMagenta);
CGraphics::ResolveSpareTexture(CGraphics::g_CroppedViewport);
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
CGraphics::SetShaderDataBinding(m_dataBind);
......
......@@ -35,6 +35,8 @@ CThermalHotFilter::CThermalHotFilter() {
}
void CThermalHotFilter::draw() {
SCOPED_GRAPHICS_DEBUG_GROUP("CThermalHotFilter::draw", zeus::skMagenta);
CGraphics::ResolveSpareTexture(CGraphics::g_CroppedViewport);
// m_uniBuf->load(&m_uniform, sizeof(m_uniform));
......
......@@ -35,6 +35,8 @@ CWorldShadowShader::CWorldShadowShader(u32 w, u32 h) : m_w(w), m_h(h) {
void CWorldShadowShader::bindRenderTarget() { CGraphics::g_BooMainCommandQueue->setRenderTarget(m_tex); }
void CWorldShadowShader::drawBase(float extent) {
SCOPED_GRAPHICS_DEBUG_GROUP("CWorldShadowShader::drawBase", zeus::skMagenta);
zeus::CVector3f verts[] = {
{-extent, 0.f, extent}, {extent, 0.f, extent}, {-extent, 0.f, -extent}, {extent, 0.f, -extent}};
m_vbo->load(verts, sizeof(zeus::CVector3f) * 4);
......@@ -48,6 +50,8 @@ void CWorldShadowShader::drawBase(float extent) {
}
void CWorldShadowShader::lightenShadow() {
SCOPED_GRAPHICS_DEBUG_GROUP("CWorldShadowShader::lightenShadow", zeus::skMagenta);
m_uniform.m_color = zeus::CColor(1.f, 0.25f);
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
......@@ -56,6 +60,8 @@ void CWorldShadowShader::lightenShadow() {
}
void CWorldShadowShader::blendPreviousShadow() {
SCOPED_GRAPHICS_DEBUG_GROUP("CWorldShadowShader::blendPreviousShadow", zeus::skMagenta);
if (!m_prevQuad)
m_prevQuad.emplace(EFilterType::Blend, m_tex.get());
zeus::CRectangle rect(0.f, 1.f, 1.f, -1.f);
......
......@@ -35,6 +35,8 @@ CXRayBlurFilter::CXRayBlurFilter(TLockedToken<CTexture>& tex) : m_paletteTex(tex
}
void CXRayBlurFilter::draw(float amount) {
SCOPED_GRAPHICS_DEBUG_GROUP("CXRayBlurFilter::draw", zeus::skMagenta);
CGraphics::ResolveSpareTexture(CGraphics::g_CroppedViewport);
float blurL = amount * g_tweakGui->GetXrayBlurScaleLinear() * 0.25f;
......
......@@ -55,6 +55,7 @@ void CAuiEnergyBarT01::Update(float dt) {
void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const {
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc)
return;
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiEnergyBarT01::Draw {}"), m_name).c_str(), zeus::skCyan);
CGraphics::SetModelMatrix(x34_worldXF);
const_cast<CEnergyBarShader&>(m_energyBarShader).updateModelMatrix();
......
......@@ -101,6 +101,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const {
CGraphics::SetModelMatrix(x34_worldXF);
if (!GetIsVisible() || !xb8_tex0Tok.IsLoaded())
return;
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiImagePane::Draw {}"), m_name).c_str(), zeus::skCyan);
GetIsFinishedLoadingWidgetSpecific();
if (!m_filters || m_filters->m_texId != xb8_tex0Tok.GetObjectTag()->id)
const_cast<CAuiImagePane*>(this)->m_filters.emplace(const_cast<CAuiImagePane*>(this)->xb8_tex0Tok);
......
......@@ -412,6 +412,7 @@ void CCompoundTargetReticle::UpdateOrbitZoneGroup(float dt, const CStateManager&
void CCompoundTargetReticle::Draw(const CStateManager& mgr, bool hideLockon) const {
if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed &&
!mgr.GetCameraManager()->IsInCinematicCamera()) {
SCOPED_GRAPHICS_DEBUG_GROUP("CCompoundTargetReticle::Draw", zeus::skCyan);
zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr);
CGraphics::SetViewPointMatrix(camXf);
if (!hideLockon) {
......
......@@ -9,6 +9,8 @@ CIOWin::EMessageReturn CConsoleOutputWindow::OnMessage(const CArchitectureMessag
return EMessageReturn::Normal;
}
void CConsoleOutputWindow::Draw() const {}
void CConsoleOutputWindow::Draw() const {
//SCOPED_GRAPHICS_DEBUG_GROUP("CConsoleOutputWindow::Draw", zeus::skGreen);
}
} // namespace urde
#include "CErrorOutputWindow.hpp"
#include "Graphics/CGraphics.hpp"
namespace urde {
......@@ -13,6 +14,8 @@ CIOWin::EMessageReturn CErrorOutputWindow::OnMessage(const CArchitectureMessage&
return EMessageReturn::Normal;
}
void CErrorOutputWindow::Draw() const {}
void CErrorOutputWindow::Draw() const {
//SCOPED_GRAPHICS_DEBUG_GROUP("CErrorOutputWindow::Draw", zeus::skGreen);
}
} // namespace urde
......@@ -20,7 +20,7 @@ CGuiFrame::CGuiFrame(CAssetId id, CGuiSys& sys, int a, int b, int c, CSimplePool
m_indexedLights.reserve(8);
x10_rootWidget.reset(new CGuiWidget(CGuiWidget::CGuiWidgetParms(
this, false, 0, 0, false, false, false, zeus::skWhite, CGuiWidget::EGuiModelDrawFlags::Alpha, false,
x8_guiSys.x8_mode != CGuiSys::EUsageMode::Zero)));
x8_guiSys.x8_mode != CGuiSys::EUsageMode::Zero, "<root>"s)));
x8_guiSys.m_registeredFrames.insert(this);
}
......@@ -131,6 +131,7 @@ void CGuiFrame::Reset() {
void CGuiFrame::Update(float dt) { xc_headWidget->Update(dt); }
void CGuiFrame::Draw(const CGuiWidgetDrawParms& parms) const {
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CGuiFrame::Draw FRME_{}"), x0_id).c_str(), zeus::skMagenta);
CGraphics::SetCullMode(ERglCullMode::None);
CGraphics::SetAmbientColor(zeus::skWhite);
DisableLights();
......
......@@ -41,6 +41,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const {
return;
if (GetIsVisible()) {
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CGuiModel::Draw {}"), m_name).c_str(), zeus::skCyan);
zeus::CColor moduCol = xa8_color2;
moduCol.a() *= parms.x0_alphaMod;
xb0_frame->EnableLights(xcc_lightMask, const_cast<CBooModel&>(model->GetInstance()));
......
......@@ -34,6 +34,7 @@ void CGuiTextPane::ScaleDimensions(const zeus::CVector3f& scale) {}
void CGuiTextPane::Draw(const CGuiWidgetDrawParms& parms) const {
if (!GetIsVisible())
return;
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CGuiTextPane::Draw {}"), m_name).c_str(), zeus::skCyan);
zeus::CVector2f dims = GetDimensions();
......
......@@ -188,6 +188,7 @@ void CGuiTextSupport::AutoSetExtent() {
void CGuiTextSupport::Render() const {
const_cast<CGuiTextSupport*>(this)->CheckAndRebuildRenderBuffer();
if (CTextRenderBuffer* buf = GetCurrentPageRenderBuffer()) {
SCOPED_GRAPHICS_DEBUG_GROUP("CGuiTextSupport::Draw", zeus::skBlue);
zeus::CTransform oldModel = CGraphics::g_GXModelMatrix;
CGraphics::SetModelMatrix(oldModel * zeus::CTransform::Scale(1.f, 1.f, -1.f));
buf->Render(x2c_geometryColor, x10_curTimeMod900);
......
......@@ -11,7 +11,8 @@ CGuiWidget::CGuiWidget(const CGuiWidgetParms& parms)
, xa4_color(parms.x10_color)
, xa8_color2(parms.x10_color)
, xac_drawFlags(parms.x14_drawFlags)
, xb0_frame(parms.x0_frame) {
, xb0_frame(parms.x0_frame)
, m_name(parms.m_name) {
xb6_24_pg = parms.xd_g;
xb6_25_isVisible = parms.xa_defaultVisible;
xb6_26_isActive = parms.xb_defaultActive;
......@@ -41,7 +42,7 @@ CGuiWidget::CGuiWidgetParms CGuiWidget::ReadWidgetHeader(CGuiFrame* frame, CInpu
EGuiModelDrawFlags df = EGuiModelDrawFlags(in.readUint32Big());
return CGuiWidget::CGuiWidgetParms(frame, useAnimController, selfId, parentId, defaultVis, defaultActive, cullFaces,
color, df, true, false);
color, df, true, false, std::move(name));
}
std::shared_ptr<CGuiWidget> CGuiWidget::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) {
......
......@@ -34,9 +34,10 @@ public:
bool xe_h;
zeus::CColor x10_color;
EGuiModelDrawFlags x14_drawFlags;
std::string m_name;
CGuiWidgetParms(CGuiFrame* frame, bool useAnimController, s16 selfId, s16 parentId, bool defaultVisible,
bool defaultActive, bool cullFaces, const zeus::CColor& color, EGuiModelDrawFlags drawFlags, bool g,
bool h)
bool h, std::string&& name)
: x0_frame(frame)
, x4_useAnimController(useAnimController)
, x6_selfId(selfId)
......@@ -47,7 +48,8 @@ public:
, xd_g(g)
, xe_h(h)
, x10_color(color)
, x14_drawFlags(drawFlags) {}
, x14_drawFlags(drawFlags)
, m_name(std::move(name)) {}
};
protected:
......@@ -76,6 +78,8 @@ protected:
std::optional<boo::SScrollDelta> m_lastScroll;
boo::SScrollDelta m_integerScroll;
std::string m_name;
public:
CGuiWidget(const CGuiWidgetParms& parms);
......
......@@ -67,6 +67,7 @@ void COrbitPointMarker::Update(float dt, const CStateManager& mgr) {
void COrbitPointMarker::Draw(const CStateManager& mgr) const {
if ((x1c_lastFreeOrbit || x20_interpTimer > 0.f) && g_tweakTargeting->DrawOrbitPoint() &&
x28_orbitPointModel.IsLoaded()) {
SCOPED_GRAPHICS_DEBUG_GROUP("COrbitPointMarker::Draw", zeus::skCyan);
const CGameCamera* curCam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr);
CGraphics::SetViewPointMatrix(camXf);
......
......@@ -49,6 +49,7 @@ CIOWin::EMessageReturn CSplashScreen::OnMessage(const CArchitectureMessage& msg,
void CSplashScreen::Draw() const {
if (!x25_textureLoaded)
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CSplashScreen::Draw", zeus::skGreen);
zeus::CColor color;
if (x14_which == ESplashScreen::Nintendo)
......
......@@ -77,6 +77,7 @@ void CArtifactDoll::CompleteArtifactHeadScan(const CStateManager& mgr) { UpdateA
void CArtifactDoll::Draw(float alpha, const CStateManager& mgr, bool inArtifactCategory, int selectedArtifact) {
if (!IsLoaded())
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CArtifactDoll::Draw", zeus::skPurple);
alpha *= x24_fader;
g_Renderer->SetPerspective(55.f, g_Viewport.x8_width, g_Viewport.xc_height, 0.2f, 4096.f);
......
#include "CCredits.hpp"
#include "Graphics/CGraphics.hpp"
namespace urde::MP1 {
......@@ -8,6 +9,8 @@ CIOWin::EMessageReturn CCredits::OnMessage(const CArchitectureMessage& msg, CArc
return EMessageReturn::Normal;
}
void CCredits::Draw() const {}
void CCredits::Draw() const {
SCOPED_GRAPHICS_DEBUG_GROUP("CCredits::Draw", zeus::skGreen);
}
} // namespace urde::MP1
......@@ -35,6 +35,7 @@ void CFaceplateDecoration::Update(float dt, CStateManager& stateMgr) {
void CFaceplateDecoration::Draw(CStateManager& stateMgr) {