Merge pull request #135 from degasus/videosw_debugutil

VideoSoftware: Remove const memory usage of DebugUtil
This commit is contained in:
Tony Wasserka 2014-04-12 13:58:46 +02:00
commit a516267722
3 changed files with 19 additions and 9 deletions

View File

@ -21,29 +21,37 @@
namespace DebugUtil namespace DebugUtil
{ {
u32 skipFrames = 0; static u32 skipFrames = 0;
bool drawingHwTriangles = false; static bool drawingHwTriangles = false;
enum { NumObjectBuffers = 40}; enum { NumObjectBuffers = 40};
u32 ObjectBuffer[NumObjectBuffers][EFB_WIDTH*EFB_HEIGHT]; static u32 *ObjectBuffer[NumObjectBuffers];
u32 TempBuffer[NumObjectBuffers]; static u32 TempBuffer[NumObjectBuffers];
bool DrawnToBuffer[NumObjectBuffers]; static bool DrawnToBuffer[NumObjectBuffers];
const char* ObjectBufferName[NumObjectBuffers]; static const char* ObjectBufferName[NumObjectBuffers];
int BufferBase[NumObjectBuffers]; static int BufferBase[NumObjectBuffers];
void Init() void Init()
{ {
for (int i = 0; i < NumObjectBuffers; i++) for (int i = 0; i < NumObjectBuffers; i++)
{ {
memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i])); ObjectBuffer[i] = new u32[EFB_WIDTH*EFB_HEIGHT]();
DrawnToBuffer[i] = false; DrawnToBuffer[i] = false;
ObjectBufferName[i] = nullptr; ObjectBufferName[i] = nullptr;
BufferBase[i] = 0; BufferBase[i] = 0;
} }
} }
void Shutdown()
{
for (int i = 0; i < NumObjectBuffers; i++)
{
delete[] ObjectBuffer[i];
}
}
void SaveTexture(const std::string& filename, u32 texmap, s32 mip) void SaveTexture(const std::string& filename, u32 texmap, s32 mip)
{ {
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1]; FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
@ -245,7 +253,7 @@ void OnObjectEnd()
swstats.thisFrame.numDrawnObjects, ObjectBufferName[i], i - BufferBase[i]); swstats.thisFrame.numDrawnObjects, ObjectBufferName[i], i - BufferBase[i]);
(void)TextureToPng((u8*)ObjectBuffer[i], EFB_WIDTH * 4, filename, EFB_WIDTH, EFB_HEIGHT, true); (void)TextureToPng((u8*)ObjectBuffer[i], EFB_WIDTH * 4, filename, EFB_WIDTH, EFB_HEIGHT, true);
memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i])); memset(ObjectBuffer[i], 0, EFB_WIDTH * EFB_HEIGHT * sizeof(u32));
} }
} }

View File

@ -7,6 +7,7 @@
namespace DebugUtil namespace DebugUtil
{ {
void Init(); void Init();
void Shutdown();
void GetTextureRGBA(u8 *dst, u32 texmap, s32 mip, u32 width, u32 height); void GetTextureRGBA(u8 *dst, u32 texmap, s32 mip, u32 width, u32 height);

View File

@ -167,6 +167,7 @@ void VideoSoftware::Shutdown()
// TODO: should be in Video_Cleanup // TODO: should be in Video_Cleanup
HwRasterizer::Shutdown(); HwRasterizer::Shutdown();
SWRenderer::Shutdown(); SWRenderer::Shutdown();
DebugUtil::Shutdown();
// Do our OSD callbacks // Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_SHUTDOWN); OSD::DoCallbacks(OSD::OSD_SHUTDOWN);