Skip to content

Commit

Permalink
gsdx debug: use a pretty format name when dumping texture
Browse files Browse the repository at this point in the history
Much faster to read the format on the file name :)

+ remove a couple of useless ifdef
  • Loading branch information
gregory38 committed Sep 7, 2016
1 parent 6abd806 commit c638e5e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
20 changes: 8 additions & 12 deletions plugins/GSdx/GSRendererHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ GSTexture* GSRendererHW::GetOutput(int i, int& y_offset)
{
if(s_savef && s_n >= s_saven)
{
t->Save(m_dump_root + format("%05d_f%lld_fr%d_%05x_%d.bmp", s_n, m_perfmon.GetFrame(), i, (int)TEX0.TBP0, (int)TEX0.PSM));
t->Save(m_dump_root + format("%05d_f%lld_fr%d_%05x_%s.bmp", s_n, m_perfmon.GetFrame(), i, (int)TEX0.TBP0, psm_str(TEX0.PSM)));
}
}

Expand Down Expand Up @@ -528,7 +528,6 @@ void GSRendererHW::Draw()
rt->m_32_bits_fmt = m_texture_shuffle || (GSLocalMemory::m_psm[context->FRAME.PSM].bpp != 16);
}

#ifdef ENABLE_OGL_DEBUG
if(s_dump)
{
uint64 frame = m_perfmon.GetFrame();
Expand All @@ -545,8 +544,8 @@ void GSRendererHW::Draw()

if(s_savet && s_n >= s_saven && tex)
{
s = format("%05d_f%lld_tex_%05x_%d_%d%d_%02x_%02x_%02x_%02x.dds",
s_n, frame, (int)context->TEX0.TBP0, (int)context->TEX0.PSM,
s = format("%05d_f%lld_tex_%05x_%s_%d%d_%02x_%02x_%02x_%02x.dds",
s_n, frame, (int)context->TEX0.TBP0, psm_str(context->TEX0.PSM),
(int)context->CLAMP.WMS, (int)context->CLAMP.WMT,
(int)context->CLAMP.MINU, (int)context->CLAMP.MAXU,
(int)context->CLAMP.MINV, (int)context->CLAMP.MAXV);
Expand All @@ -555,7 +554,7 @@ void GSRendererHW::Draw()

if(tex->m_palette)
{
s = format("%05d_f%lld_tpx_%05x_%d.dds", s_n, frame, context->TEX0.CBP, context->TEX0.CPSM);
s = format("%05d_f%lld_tpx_%05x_%s.dds", s_n, frame, context->TEX0.CBP, psm_str(context->TEX0.CPSM));

tex->m_palette->Save(m_dump_root+s, true);
}
Expand All @@ -565,15 +564,15 @@ void GSRendererHW::Draw()

if(s_save && s_n >= s_saven)
{
s = format("%05d_f%lld_rt0_%05x_%d.bmp", s_n, frame, context->FRAME.Block(), context->FRAME.PSM);
s = format("%05d_f%lld_rt0_%05x_%s.bmp", s_n, frame, context->FRAME.Block(), psm_str(context->FRAME.PSM));

if (rt)
rt->m_texture->Save(m_dump_root+s);
}

if(s_savez && s_n >= s_saven)
{
s = format("%05d_f%lld_rz0_%05x_%d.bmp", s_n, frame, context->ZBUF.Block(), context->ZBUF.PSM);
s = format("%05d_f%lld_rz0_%05x_%s.bmp", s_n, frame, context->ZBUF.Block(), psm_str(context->ZBUF.PSM));

if (ds_tex)
ds_tex->Save(m_dump_root+s);
Expand All @@ -584,7 +583,6 @@ void GSRendererHW::Draw()
} else {
s_n += 2;
}
#endif

// The rectangle of the draw
GSVector4i r = GSVector4i(m_vt.m_min.p.xyxy(m_vt.m_max.p)).rintersect(GSVector4i(context->scissor.in));
Expand Down Expand Up @@ -716,7 +714,6 @@ void GSRendererHW::Draw()
(this->*m_hacks.m_oo)();
}

#ifdef ENABLE_OGL_DEBUG
if(s_dump)
{
uint64 frame = m_perfmon.GetFrame();
Expand All @@ -725,15 +722,15 @@ void GSRendererHW::Draw()

if(s_save && s_n >= s_saven)
{
s = format("%05d_f%lld_rt1_%05x_%d.bmp", s_n, frame, context->FRAME.Block(), context->FRAME.PSM);
s = format("%05d_f%lld_rt1_%05x_%s.bmp", s_n, frame, context->FRAME.Block(), psm_str(context->FRAME.PSM));

if (rt)
rt->m_texture->Save(m_dump_root+s);
}

if(s_savez && s_n >= s_saven)
{
s = format("%05d_f%lld_rz1_%05x_%d.bmp", s_n, frame, context->ZBUF.Block(), context->ZBUF.PSM);
s = format("%05d_f%lld_rz1_%05x_%s.bmp", s_n, frame, context->ZBUF.Block(), psm_str(context->ZBUF.PSM));

if (ds_tex)
ds_tex->Save(m_dump_root+s);
Expand All @@ -748,7 +745,6 @@ void GSRendererHW::Draw()
} else {
s_n += 1;
}
#endif

#ifdef DISABLE_HW_TEXTURE_CACHE

Expand Down
16 changes: 8 additions & 8 deletions plugins/GSdx/GSRendererSW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ GSTexture* GSRendererSW::GetOutput(int i, int& y_offset)
{
if(s_savef && s_n >= s_saven)
{
m_texture[i]->Save(m_dump_root + format("%05d_f%lld_fr%d_%05x_%d.bmp", s_n, m_perfmon.GetFrame(), i, (int)DISPFB.Block(), (int)DISPFB.PSM));
m_texture[i]->Save(m_dump_root + format("%05d_f%lld_fr%d_%05x_%s.bmp", s_n, m_perfmon.GetFrame(), i, (int)DISPFB.Block(), psm_str(DISPFB.PSM)));
}

s_n++;
Expand Down Expand Up @@ -551,7 +551,7 @@ void GSRendererSW::Draw()
m_mem.SaveBMP(m_dump_root+s, m_context->TEX0.TBP0, m_context->TEX0.TBW, 0, 1 << m_context->TEX0.TW, 1 << m_context->TEX0.TH);
}

s = format("%05d_f%lld_tex_%05x_%d.bmp", s_n, frame, (int)m_context->TEX0.TBP0, (int)m_context->TEX0.PSM);
s = format("%05d_f%lld_tex_%05x_%s.bmp", s_n, frame, (int)m_context->TEX0.TBP0, psm_str(m_context->TEX0.PSM));
m_mem.SaveBMP(m_dump_root+s, m_context->TEX0.TBP0, m_context->TEX0.TBW, m_context->TEX0.PSM, 1 << m_context->TEX0.TW, 1 << m_context->TEX0.TH);
}

Expand All @@ -566,13 +566,13 @@ void GSRendererSW::Draw()
m_mem.SaveBMP(m_dump_root+s, m_context->FRAME.Block(), m_context->FRAME.FBW, 0, GetFrameRect().width(), 512);
}

s = format("%05d_f%lld_rt0_%05x_%d.bmp", s_n, frame, m_context->FRAME.Block(), m_context->FRAME.PSM);
s = format("%05d_f%lld_rt0_%05x_%s.bmp", s_n, frame, m_context->FRAME.Block(), psm_str(m_context->FRAME.PSM));
m_mem.SaveBMP(m_dump_root+s, m_context->FRAME.Block(), m_context->FRAME.FBW, m_context->FRAME.PSM, GetFrameRect().width(), 512);
}

if(s_savez && s_n >= s_saven)
{
s = format("%05d_f%lld_rz0_%05x_%d.bmp", s_n, frame, m_context->ZBUF.Block(), m_context->ZBUF.PSM);
s = format("%05d_f%lld_rz0_%05x_%s.bmp", s_n, frame, m_context->ZBUF.Block(), psm_str(m_context->ZBUF.PSM));

m_mem.SaveBMP(m_dump_root+s, m_context->ZBUF.Block(), m_context->FRAME.FBW, m_context->ZBUF.PSM, GetFrameRect().width(), 512);
}
Expand All @@ -591,13 +591,13 @@ void GSRendererSW::Draw()
m_mem.SaveBMP(m_dump_root+s, m_context->FRAME.Block(), m_context->FRAME.FBW, 0, GetFrameRect().width(), 512);
}

s = format("%05d_f%lld_rt1_%05x_%d.bmp", s_n, frame, m_context->FRAME.Block(), m_context->FRAME.PSM);
s = format("%05d_f%lld_rt1_%05x_%s.bmp", s_n, frame, m_context->FRAME.Block(), psm_str(m_context->FRAME.PSM));
m_mem.SaveBMP(m_dump_root+s, m_context->FRAME.Block(), m_context->FRAME.FBW, m_context->FRAME.PSM, GetFrameRect().width(), 512);
}

if(s_savez && s_n >= s_saven)
{
s = format("%05d_f%lld_rz1_%05x_%d.bmp", s_n, frame, m_context->ZBUF.Block(), m_context->ZBUF.PSM);
s = format("%05d_f%lld_rz1_%05x_%s.bmp", s_n, frame, m_context->ZBUF.Block(), psm_str(m_context->ZBUF.PSM));

m_mem.SaveBMP(m_dump_root+s, m_context->ZBUF.Block(), m_context->FRAME.FBW, m_context->ZBUF.PSM, GetFrameRect().width(), 512);
}
Expand Down Expand Up @@ -693,14 +693,14 @@ void GSRendererSW::Sync(int reason)

if(s_save)
{
s = format("%05d_f%lld_rt1_%05x_%d.bmp", s_n, m_perfmon.GetFrame(), m_context->FRAME.Block(), m_context->FRAME.PSM);
s = format("%05d_f%lld_rt1_%05x_%s.bmp", s_n, m_perfmon.GetFrame(), m_context->FRAME.Block(), psm_str(m_context->FRAME.PSM));

m_mem.SaveBMP(m_dump_root+s, m_context->FRAME.Block(), m_context->FRAME.FBW, m_context->FRAME.PSM, GetFrameRect().width(), 512);
}

if(s_savez)
{
s = format("%05d_f%lld_zb1_%05x_%d.bmp", s_n, m_perfmon.GetFrame(), m_context->ZBUF.Block(), m_context->ZBUF.PSM);
s = format("%05d_f%lld_zb1_%05x_%s.bmp", s_n, m_perfmon.GetFrame(), m_context->ZBUF.Block(), psm_str(m_context->ZBUF.PSM));

m_mem.SaveBMP(m_dump_root+s, m_context->ZBUF.Block(), m_context->FRAME.FBW, m_context->ZBUF.PSM, GetFrameRect().width(), 512);
}
Expand Down

0 comments on commit c638e5e

Please sign in to comment.