VideoSoftware: remove const memory usage of DebugUtil

This commit is contained in:
degasus 2014-03-05 15:19:10 +01:00
parent 4b60bdd2d0
commit 96ffbe345d
3 changed files with 19 additions and 9 deletions

View File

@ -21,29 +21,37 @@
namespace DebugUtil
{
u32 skipFrames = 0;
bool drawingHwTriangles = false;
static u32 skipFrames = 0;
static bool drawingHwTriangles = false;
enum { NumObjectBuffers = 40};
u32 ObjectBuffer[NumObjectBuffers][EFB_WIDTH*EFB_HEIGHT];
u32 TempBuffer[NumObjectBuffers];
static u32 *ObjectBuffer[NumObjectBuffers];
static u32 TempBuffer[NumObjectBuffers];
bool DrawnToBuffer[NumObjectBuffers];
const char* ObjectBufferName[NumObjectBuffers];
int BufferBase[NumObjectBuffers];
static bool DrawnToBuffer[NumObjectBuffers];
static const char* ObjectBufferName[NumObjectBuffers];
static int BufferBase[NumObjectBuffers];
void Init()
{
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;
ObjectBufferName[i] = nullptr;
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)
{
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
@ -245,7 +253,7 @@ void OnObjectEnd()
swstats.thisFrame.numDrawnObjects, ObjectBufferName[i], i - BufferBase[i]);
(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
{
void Init();
void Shutdown();
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
HwRasterizer::Shutdown();
SWRenderer::Shutdown();
DebugUtil::Shutdown();
// Do our OSD callbacks
OSD::DoCallbacks(OSD::OSD_SHUTDOWN);