diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index a952b82904..89eb09b041 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -827,7 +827,7 @@ bool GSRendererHW::OI_DoubleHalfClear(GSTexture* rt, GSTexture* ds, GSTextureCac if ((m_vt.m_primclass == GS_SPRITE_CLASS) && !PRIM->TME && !m_context->ZBUF.ZMSK && (m_context->FRAME.FBW >= 7) && rt) { GSVertex* v = &m_vertex.buff[0]; - //GL_INS("OI_DoubleHalfClear: psm:%x. Z:%d R:%d G:%d B:%d A:%d", m_context->FRAME.PSM, + //GL_INS("OI_DoubleHalfClear: psm:%s. Z:%d R:%d G:%d B:%d A:%d", psm_str(m_context->FRAME.PSM), // v[1].XYZ.Z, v[1].RGBAQ.R, v[1].RGBAQ.G, v[1].RGBAQ.B, v[1].RGBAQ.A); // Check it is a clear on the first primitive only diff --git a/plugins/GSdx/GSState.cpp b/plugins/GSdx/GSState.cpp index 4c7b7550d2..f883e3b22a 100644 --- a/plugins/GSdx/GSState.cpp +++ b/plugins/GSdx/GSState.cpp @@ -1574,8 +1574,8 @@ void GSState::Write(const uint8* mem, int len) return; } - GL_CACHE("Write! ... => 0x%x W:%d F:%d (DIR %d%d), dPos(%d %d) size(%d %d)", - m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW, m_env.BITBLTBUF.DPSM, + GL_CACHE("Write! ... => 0x%x W:%d F:%s (DIR %d%d), dPos(%d %d) size(%d %d)", + m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW, psm_str(m_env.BITBLTBUF.DPSM), m_env.TRXPOS.DIRX, m_env.TRXPOS.DIRY, m_env.TRXPOS.DSAX, m_env.TRXPOS.DSAY, w, h); @@ -1666,8 +1666,8 @@ void GSState::Read(uint8* mem, int len) int h = m_env.TRXREG.RRH; GSVector4i r(sx, sy, sx + w, sy + h); - GL_CACHE("Read! len=%d SBP=%05x SBW=%d SPSM=%d SSAX=%d SSAY=%d RRW=%d RRH=%d", - len, (int)m_env.BITBLTBUF.SBP, (int)m_env.BITBLTBUF.SBW, (int)m_env.BITBLTBUF.SPSM, sx, sy, w, h); + GL_CACHE("Read! len=%d SBP=%05x SBW=%d SPSM=%s SSAX=%d SSAY=%d RRW=%d RRH=%d", + len, (int)m_env.BITBLTBUF.SBP, (int)m_env.BITBLTBUF.SBW, psm_str(m_env.BITBLTBUF.SPSM), sx, sy, w, h); if(!m_tr.Update(w, h, GSLocalMemory::m_psm[m_env.BITBLTBUF.SPSM].trbpp, len)) { @@ -1704,9 +1704,9 @@ void GSState::Move() int w = m_env.TRXREG.RRW; int h = m_env.TRXREG.RRH; - GL_CACHE("Move! 0x%x W:%d F:%d => 0x%x W:%d F:%d (DIR %d%d), sPos(%d %d) dPos(%d %d) size(%d %d)", - m_env.BITBLTBUF.SBP, m_env.BITBLTBUF.SBW, m_env.BITBLTBUF.SPSM, - m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW, m_env.BITBLTBUF.DPSM, + GL_CACHE("Move! 0x%x W:%d F:%s => 0x%x W:%d F:%s (DIR %d%d), sPos(%d %d) dPos(%d %d) size(%d %d)", + m_env.BITBLTBUF.SBP, m_env.BITBLTBUF.SBW, psm_str(m_env.BITBLTBUF.SPSM), + m_env.BITBLTBUF.DBP, m_env.BITBLTBUF.DBW, psm_str(m_env.BITBLTBUF.DPSM), m_env.TRXPOS.DIRX, m_env.TRXPOS.DIRY, sx, sy, dx, dy, w, h); diff --git a/plugins/GSdx/GSTextureCache.cpp b/plugins/GSdx/GSTextureCache.cpp index 4a1721493d..4159c5973e 100644 --- a/plugins/GSdx/GSTextureCache.cpp +++ b/plugins/GSdx/GSTextureCache.cpp @@ -107,7 +107,7 @@ GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0 if (!CanConvertDepth()) { if (dst) { - GL_CACHE("LookupDepthSource not supported (0x%x, F:0x%x)", TEX0.TBP0, TEX0.PSM); + GL_CACHE("LookupDepthSource not supported (0x%x, %s)", TEX0.TBP0, psm_str(TEX0.PSM)); throw GSDXRecoverableError(); } else { // LookupSource call LookupDepthSource, I'm sure it is nice testcase for formal tools ;) @@ -129,9 +129,9 @@ GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0 } if (dst) { - GL_CACHE("TC depth: dst %s hit: %d (0x%x, F:0x%x)", to_string(dst->m_type), + GL_CACHE("TC depth: dst %s hit: %d (0x%x, %s)", to_string(dst->m_type), dst->m_texture ? dst->m_texture->GetID() : 0, - TEX0.TBP0, psm); + TEX0.TBP0, psm_str(psm)); // Create a shared texture source src = new Source(m_renderer, TEX0, TEXA, m_temp, true); @@ -156,7 +156,7 @@ GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0 m_src.m_surfaces.insert(src); } else { - GL_CACHE("TC depth: ERROR miss (0x%x, F:0x%x)", TEX0.TBP0, psm); + GL_CACHE("TC depth: ERROR miss (0x%x, %s)", TEX0.TBP0, psm_str(psm)); // Possible ? In this case we could call LookupSource // Or just put a basic texture // src->m_texture = m_renderer->m_dev->CreateTexture(tw, th); @@ -332,19 +332,19 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con { #ifdef ENABLE_OGL_DEBUG if (dst) { - GL_CACHE("TC: dst %s hit (%s): %d (0x%x, F:0x%x)", to_string(dst->m_type), half_right ? "half" : "full", + GL_CACHE("TC: dst %s hit (%s): %d (0x%x, %s", to_string(dst->m_type), half_right ? "half" : "full", dst->m_texture ? dst->m_texture->GetID() : 0, - TEX0.TBP0, TEX0.PSM); + TEX0.TBP0, psm_str(TEX0.PSM)); } else { - GL_CACHE("TC: src miss (0x%x, F:0x%x)", TEX0.TBP0, TEX0.PSM); + GL_CACHE("TC: src miss (0x%x, %s)", TEX0.TBP0, psm_str(TEX0.PSM)); } #endif src = CreateSource(TEX0, TEXA, dst, half_right); } else { - GL_CACHE("TC: src hit: %d (0x%x, F:0x%x)", + GL_CACHE("TC: src hit: %d (0x%x, %s)", src->m_texture ? src->m_texture->GetID() : 0, - TEX0.TBP0, TEX0.PSM); + TEX0.TBP0, psm_str(TEX0.PSM)); } if (src->m_palette) @@ -390,7 +390,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int } if (dst) { - GL_CACHE("TC: Lookup Target(%s) %dx%d, hit: %d (0x%x, F:0x%x)", to_string(type), w, h, dst->m_texture->GetID(), bp, TEX0.PSM); + GL_CACHE("TC: Lookup Target(%s) %dx%d, hit: %d (0x%x, %s)", to_string(type), w, h, dst->m_texture->GetID(), bp, psm_str(TEX0.PSM)); dst->Update(); @@ -417,10 +417,10 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int int shader; bool fmt_16_bits = (psm_s.bpp == 16 && GSLocalMemory::m_psm[t->m_TEX0.PSM].bpp == 16); if (type == DepthStencil) { - GL_CACHE("TC: Lookup Target(Depth) %dx%d, hit Color (0x%x, F:0x%x was F:0x%x)", w, h, bp, TEX0.PSM, t->m_TEX0.PSM); + GL_CACHE("TC: Lookup Target(Depth) %dx%d, hit Color (0x%x, %s was %s)", w, h, bp, psm_str(TEX0.PSM), psm_str(t->m_TEX0.PSM)); shader = (fmt_16_bits) ? ShaderConvert_RGB5A1_TO_FLOAT16 : ShaderConvert_RGBA8_TO_FLOAT32 + psm_s.fmt; } else { - GL_CACHE("TC: Lookup Target(Color) %dx%d, hit Depth (0x%x, F:0x%x was F:0x%x)", w, h, bp, TEX0.PSM, t->m_TEX0.PSM); + GL_CACHE("TC: Lookup Target(Color) %dx%d, hit Depth (0x%x, %s was %s)", w, h, bp, psm_str(TEX0.PSM), psm_str(t->m_TEX0.PSM)); shader = (fmt_16_bits) ? ShaderConvert_FLOAT16_TO_RGB5A1 : ShaderConvert_FLOAT32_TO_RGBA8; } m_renderer->m_dev->StretchRect(t->m_texture, sRect, dst->m_texture, dRect, shader, false); @@ -432,7 +432,7 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int if(dst == NULL) { - GL_CACHE("TC: Lookup Target(%s) %dx%d, miss (0x%x, F:0x%x)", to_string(type), w, h, bp, TEX0.PSM); + GL_CACHE("TC: Lookup Target(%s) %dx%d, miss (0x%x, %s)", to_string(type), w, h, bp, psm_str(TEX0.PSM)); dst = CreateTarget(TEX0, w, h, type); diff --git a/plugins/GSdx/GSUtil.cpp b/plugins/GSdx/GSUtil.cpp index 5de503b658..40c2803d06 100644 --- a/plugins/GSdx/GSUtil.cpp +++ b/plugins/GSdx/GSUtil.cpp @@ -440,3 +440,30 @@ void GSmkdir(const char* dir) } #endif + +const char* psm_str(int psm) +{ + switch(psm) { + // Normal color + case PSM_PSMCT32: return "C_32"; + case PSM_PSMCT24: return "C_24"; + case PSM_PSMCT16: return "C_16"; + case PSM_PSMCT16S: return "C_16S"; + + // Palette color + case PSM_PSMT8: return "P_8"; + case PSM_PSMT4: return "P_4"; + case PSM_PSMT8H: return "P_8H"; + case PSM_PSMT4HL: return "P_4HL"; + case PSM_PSMT4HH: return "P_4HH"; + + // Depth + case PSM_PSMZ32: return "Z_32"; + case PSM_PSMZ24: return "Z_24"; + case PSM_PSMZ16: return "Z_16"; + case PSM_PSMZ16S: return "Z_16S"; + + default:break; + } + return "BAD_PSM"; +} diff --git a/plugins/GSdx/GSUtil.h b/plugins/GSdx/GSUtil.h index 88d9383afc..94552fbaf4 100644 --- a/plugins/GSdx/GSUtil.h +++ b/plugins/GSdx/GSUtil.h @@ -69,3 +69,5 @@ public: #if defined(__unix__) void GSmkdir(const char* dir); #endif + +const char* psm_str(int psm);