summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/DebugUtil.cpp
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2014-07-14 23:51:55 +1200
committerScott Mansell <phiren@gmail.com>2014-07-17 11:43:59 +1200
commit92eed472132a5d4589779bee5fc1d63db6023059 (patch)
tree4cea8f0f83a5a3da33066a4b063723f62afdc7e8 /Source/Core/VideoBackends/Software/DebugUtil.cpp
parent3ac4e9f171b116d4b09990058c18741598bb2ef8 (diff)
Fixed Frame dumping in VideoSoftware.
Old code dumped the efb, which was no-longer relevant since the backend gained xfb support. New code dumps the colour texture which is about to be rendered to the screen so correctly reflects the bypassXFB option.
Diffstat (limited to 'Source/Core/VideoBackends/Software/DebugUtil.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/DebugUtil.cpp37
1 files changed, 11 insertions, 26 deletions
diff --git a/Source/Core/VideoBackends/Software/DebugUtil.cpp b/Source/Core/VideoBackends/Software/DebugUtil.cpp
index 5998b10b09..c1a7980aa2 100644
--- a/Source/Core/VideoBackends/Software/DebugUtil.cpp
+++ b/Source/Core/VideoBackends/Software/DebugUtil.cpp
@@ -11,6 +11,7 @@
#include "VideoBackends/Software/EfbInterface.h"
#include "VideoBackends/Software/HwRasterizer.h"
#include "VideoBackends/Software/SWCommandProcessor.h"
+#include "VideoBackends/Software/SWRenderer.h"
#include "VideoBackends/Software/SWStatistics.h"
#include "VideoBackends/Software/SWVideoConfig.h"
#include "VideoBackends/Software/TextureSampler.h"
@@ -66,7 +67,7 @@ static void SaveTexture(const std::string& filename, u32 texmap, s32 mip)
GetTextureRGBA(data, texmap, mip, width, height);
- (void)TextureToPng(data, width*4, filename, width, height, true);
+ TextureToPng(data, width*4, filename, width, height, true);
delete[] data;
}
@@ -150,30 +151,15 @@ static void DumpEfb(const std::string& filename)
}
}
- (void)TextureToPng(data, EFB_WIDTH * 4, filename, EFB_WIDTH, EFB_HEIGHT, true);
+ TextureToPng(data, EFB_WIDTH * 4, filename, EFB_WIDTH, EFB_HEIGHT, true);
delete[] data;
}
-static void DumpDepth(const std::string& filename)
-{
- u8 *data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
- u8 *writePtr = data;
- for (int y = 0; y < EFB_HEIGHT; y++)
- {
- for (int x = 0; x < EFB_WIDTH; x++)
- {
- u32 depth = EfbInterface::GetDepth(x, y);
- // depth to rgba
- *(writePtr++) = depth & 0xff;
- *(writePtr++) = (depth >> 8) & 0xff;
- *(writePtr++) = (depth >> 16) & 0xff;
- *(writePtr++) = 255;
- }
- }
- (void)TextureToPng(data, EFB_WIDTH * 4, filename, EFB_WIDTH, EFB_HEIGHT, true);
- delete[] data;
+static void DumpColorTexture(const std::string& filename, u32 width, u32 height)
+{
+ TextureToPng(SWRenderer::getCurrentColorTexture(), width * 4, filename, width, height, true);
}
void DrawObjectBuffer(s16 x, s16 y, u8 *color, int bufferBase, int subBuffer, const char *name)
@@ -252,7 +238,7 @@ void OnObjectEnd()
File::GetUserPath(D_DUMPFRAMES_IDX).c_str(),
swstats.thisFrame.numDrawnObjects, ObjectBufferName[i], i - BufferBase[i]);
- (void)TextureToPng((u8*)ObjectBuffer[i], EFB_WIDTH * 4, filename, EFB_WIDTH, EFB_HEIGHT, true);
+ TextureToPng((u8*)ObjectBuffer[i], EFB_WIDTH * 4, filename, EFB_WIDTH, EFB_HEIGHT, true);
memset(ObjectBuffer[i], 0, EFB_WIDTH * EFB_HEIGHT * sizeof(u32));
}
@@ -262,16 +248,15 @@ void OnObjectEnd()
}
}
-void OnFrameEnd()
+// If frame dumping is enabled, dump whatever is drawn to the screen.
+void OnFrameEnd(u32 width, u32 height)
{
if (!g_bSkipCurrentFrame)
{
if (g_SWVideoConfig.bDumpFrames)
{
- DumpEfb(StringFromFormat("%sframe%i_color.png",
- File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), swstats.frameCount));
- DumpDepth(StringFromFormat("%sframe%i_depth.png",
- File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), swstats.frameCount));
+ DumpColorTexture(StringFromFormat("%sframe%i_color.png",
+ File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), swstats.frameCount), width, height);
}
}
}