From 8e1db43431a84ee9e64a8eb3d69913360f83b68e Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 8 May 2015 15:51:46 +0200 Subject: [PATCH] gsdx-debug: debug stuff --- plugins/GSdx/GSDeviceOGL.cpp | 4 ++++ plugins/GSdx/GSDeviceOGL.h | 10 +++++----- plugins/GSdx/GSDrawingContext.h | 12 ++++++------ plugins/GSdx/GSRendererHW.cpp | 10 +++++++--- plugins/GSdx/GSRendererOGL.cpp | 2 +- plugins/GSdx/GSRendererSW.cpp | 2 +- plugins/GSdx/GSState.cpp | 5 +++++ 7 files changed, 29 insertions(+), 16 deletions(-) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index f19df34409..7cc1911fa3 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -146,6 +146,8 @@ GSDeviceOGL::~GSDeviceOGL() GSTexture* GSDeviceOGL::CreateSurface(int type, int w, int h, bool msaa, int format) { + GL_PUSH("Create surface"); + // A wrapper to call GSTextureOGL, with the different kind of parameter GSTextureOGL* t = NULL; t = new GSTextureOGL(type, w, h, format, m_fbo_read); @@ -161,6 +163,8 @@ GSTexture* GSDeviceOGL::CreateSurface(int type, int w, int h, bool msaa, int for // No need to clear the stencil now. break; } + + GL_POP(); return t; } diff --git a/plugins/GSdx/GSDeviceOGL.h b/plugins/GSdx/GSDeviceOGL.h index 69f634c2ac..1c5e480265 100644 --- a/plugins/GSdx/GSDeviceOGL.h +++ b/plugins/GSdx/GSDeviceOGL.h @@ -89,13 +89,13 @@ public: glDisable(GL_BLEND); } - if (m_enable) { #ifdef ENABLE_OGL_DEBUG - if (m_bogus) { - GL_INS("!!! Bogus blending effect !!!"); - fprintf(stderr, "Bogus blending effect used : %s\n", (m_bogus == 1) ? "impossible effect" : "clear effect"); - } + if (m_bogus) { + GL_INS("!!! Bogus blending effect !!!"); + fprintf(stderr, "Bogus blending effect used : %s\n", (m_bogus == 1) ? "impossible effect" : "clear effect"); + } #endif + if (m_enable) { if (HasConstantFactor()) { if (GLState::bf != factor) { GLState::bf = factor; diff --git a/plugins/GSdx/GSDrawingContext.h b/plugins/GSdx/GSDrawingContext.h index 44d6f589b9..66c743d1a8 100644 --- a/plugins/GSdx/GSDrawingContext.h +++ b/plugins/GSdx/GSDrawingContext.h @@ -138,12 +138,12 @@ public: fprintf(fp, "TEX0\n" "\tTBP0:%d\n" "\tTBW:%d\n" - "\tPSM:%d\n" + "\tPSM:0x%x\n" "\tTW:%d\n" "\tTCC:%d\n" "\tTFX:%d\n" "\tCBP:%d\n" - "\tCPSM:%d\n" + "\tCPSM:0x%x\n" "\tCSM:%d\n" "\tCSA:%d\n" "\tCLD:%d\n" @@ -159,9 +159,9 @@ public: "\tK:%d\n\n" , TEX1.LCM, TEX1.MXL, TEX1.MMAG, TEX1.MMIN, TEX1.MTBA, TEX1.L, TEX1.K); fprintf(fp, "TEX2\n" - "\tPSM:%d\n" + "\tPSM:0x%x\n" "\tCBP:%d\n" - "\tCPSM:%d\n" + "\tCPSM:0x%x\n" "\tCSM:%d\n" "\tCSA:%d\n" "\tCLD:%d\n\n" @@ -204,12 +204,12 @@ public: fprintf(fp, "FRAME\n" "\tFBP:%d\n" "\tFBW:%d\n" - "\tPSM:%d\n" + "\tPSM:0x%x\n" "\tFBMSK:%d\n\n" , FRAME.FBP, FRAME.FBW, FRAME.PSM, FRAME.FBMSK); fprintf(fp, "ZBUF\n" "\tZBP:%d\n" - "\tPSM:%d\n" + "\tPSM:0x%x\n" "\tZMSK:%d\n\n" , ZBUF.ZBP, ZBUF.PSM, ZBUF.ZMSK); diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index 1cfc69c2c3..3e315f29fd 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -317,6 +317,10 @@ void GSRendererHW::Draw() s_n += 3; // Keep it sync with SW renderer return; } +#ifdef ENABLE_OGL_DEBUG + std::string help = format("HW Draw %d", s_n); + GL_PUSH(help.c_str()); +#endif GSDrawingEnvironment& env = m_env; GSDrawingContext* context = m_context; @@ -360,9 +364,7 @@ void GSRendererHW::Draw() GetTextureMinMax(r, context->TEX0, context->CLAMP, m_vt.IsLinear()); - GL_PUSH("Lookup Source"); tex = m_tc->LookupSource(context->TEX0, env.TEXA, r); - GL_POP(); if(!tex) return; @@ -416,7 +418,7 @@ void GSRendererHW::Draw() if (s_n >= s_saven) { // Dump Register state - s = format("%05d_context_d%lld.txt", s_n); + s = format("%05d_context.txt", s_n); m_env.Dump(root_hw+s); m_context->Dump(root_hw+s); @@ -561,6 +563,8 @@ void GSRendererHW::Draw() m_tc->Read(rt, r); #endif + + GL_POP(); } // hacks diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index d625c8bc6a..0bdedb058b 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -190,7 +190,7 @@ bool GSRendererOGL::PrimitiveOverlap() void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex) { #ifdef ENABLE_OGL_DEBUG - std::string help = format("Draw %d", s_n); + std::string help = format("GL Draw in (%d/%d)", static_cast(rt)->GetID(), static_cast(ds)->GetID()); GL_PUSH(help.c_str()); #endif GSDrawingEnvironment& env = m_env; diff --git a/plugins/GSdx/GSRendererSW.cpp b/plugins/GSdx/GSRendererSW.cpp index 0a2b4ec5b5..de474ea4d1 100644 --- a/plugins/GSdx/GSRendererSW.cpp +++ b/plugins/GSdx/GSRendererSW.cpp @@ -543,7 +543,7 @@ void GSRendererSW::Draw() if (s_n >= s_saven) { // Dump Register state - s = format("%05d_context_d%lld.txt", s_n); + s = format("%05d_context.txt", s_n); m_env.Dump(root_sw+s); m_context->Dump(root_sw+s); diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index c0c8f1ed68..2b0c118252 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -5500,6 +5500,11 @@ bool GSState::IsBadFrame(int& skip, int UserHacks_SkipDraw) skip = 1; } } +#ifdef ENABLE_OGL_DEBUG + } else if (fi.TME) { + if(fi.TPSM == PSM_PSMZ32 || fi.TPSM == PSM_PSMZ24 || fi.TPSM == PSM_PSMZ16 || fi.TPSM == PSM_PSMZ16S) + GL_INS("!!! Depth Texture !!!"); +#endif } if(skip > 0)