gedbg: Add mechanics to grab CLUT buffer.

This commit is contained in:
Unknown W. Brackets 2016-01-10 09:25:19 -08:00
parent 41a9e00f01
commit c6ffed6484
11 changed files with 47 additions and 0 deletions

View file

@ -223,6 +223,10 @@ public:
return false;
}
virtual bool GetCurrentClut(GPUDebugBuffer &buffer) {
return false;
}
// TODO:
// cached framebuffers / textures / vertices?
// get content of specific framebuffer / texture?

View file

@ -352,3 +352,12 @@ void *TextureCacheCommon::RearrangeBuf(void *inBuf, u32 inRowBytes, u32 outRowBy
return outBuf;
}
bool TextureCacheCommon::GetCurrentClutBuffer(GPUDebugBuffer &buffer) {
const u32 bpp = gstate.getClutPaletteFormat() == GE_CMODE_32BIT_ABGR8888 ? 4 : 2;
const u32 pixels = 1024 / bpp;
buffer.Allocate(pixels, 1, (GEBufferFormat)gstate.getClutPaletteFormat());
memcpy(buffer.GetData(), clutBufRaw_, 1024);
return true;
}

View file

@ -18,6 +18,7 @@
#pragma once
#include "Common/CommonTypes.h"
#include "GPU/Common/GPUDebugInterface.h"
enum TextureFiltering {
TEX_FILTER_AUTO = 1,
@ -40,6 +41,7 @@ public:
virtual ~TextureCacheCommon();
void LoadClut(u32 clutAddr, u32 loadBytes);
bool GetCurrentClutBuffer(GPUDebugBuffer &buffer);
virtual bool SetOffsetTexture(u32 offset);

View file

@ -30,6 +30,7 @@ enum PauseAction {
PAUSE_GETDEPTHBUF,
PAUSE_GETSTENCILBUF,
PAUSE_GETTEX,
PAUSE_GETCLUT,
PAUSE_SETCMDVALUE,
};
@ -52,6 +53,7 @@ static GPUDebugBuffer bufferFrame;
static GPUDebugBuffer bufferDepth;
static GPUDebugBuffer bufferStencil;
static GPUDebugBuffer bufferTex;
static GPUDebugBuffer bufferClut;
static int bufferLevel;
static u32 pauseSetCmdValue;
@ -97,6 +99,10 @@ static void RunPauseAction() {
bufferResult = gpuDebug->GetCurrentTexture(bufferTex, bufferLevel);
break;
case PAUSE_GETCLUT:
bufferResult = gpuDebug->GetCurrentClut(bufferClut);
break;
case PAUSE_SETCMDVALUE:
gpuDebug->SetCmdValue(pauseSetCmdValue);
break;
@ -171,6 +177,10 @@ bool GPU_GetCurrentTexture(const GPUDebugBuffer *&buffer, int level) {
return GetBuffer(buffer, PAUSE_GETTEX, bufferTex);
}
bool GPU_GetCurrentClut(const GPUDebugBuffer *&buffer) {
return GetBuffer(buffer, PAUSE_GETCLUT, bufferClut);
}
bool GPU_SetCmdValue(u32 op) {
if (!isStepping) {
return false;

View file

@ -32,6 +32,7 @@ namespace GPUStepping {
bool GPU_GetCurrentDepthbuffer(const GPUDebugBuffer *&buffer);
bool GPU_GetCurrentStencilbuffer(const GPUDebugBuffer *&buffer);
bool GPU_GetCurrentTexture(const GPUDebugBuffer *&buffer, int level);
bool GPU_GetCurrentClut(const GPUDebugBuffer *&buffer);
bool GPU_SetCmdValue(u32 op);
void ResumeFromStepping();

View file

@ -2185,6 +2185,10 @@ bool DIRECTX9_GPU::GetCurrentTexture(GPUDebugBuffer &buffer, int level) {
return success;
}
bool DIRECTX9_GPU::GetCurrentClut(GPUDebugBuffer &buffer) {
return textureCache_.GetCurrentClutBuffer(buffer);
}
bool DIRECTX9_GPU::GetDisplayFramebuffer(GPUDebugBuffer &buffer) {
return FramebufferManagerDX9::GetDisplayFramebuffer(buffer);
}

View file

@ -78,6 +78,7 @@ public:
bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer);
bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer);
bool GetCurrentTexture(GPUDebugBuffer &buffer, int level);
bool GetCurrentClut(GPUDebugBuffer &buffer) override;
static bool GetDisplayFramebuffer(GPUDebugBuffer &buffer);
bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices);

View file

@ -2401,6 +2401,10 @@ bool GLES_GPU::GetCurrentTexture(GPUDebugBuffer &buffer, int level) {
#endif
}
bool GLES_GPU::GetCurrentClut(GPUDebugBuffer &buffer) {
return textureCache_.GetCurrentClutBuffer(buffer);
}
bool GLES_GPU::GetDisplayFramebuffer(GPUDebugBuffer &buffer) {
return FramebufferManager::GetDisplayFramebuffer(buffer);
}

View file

@ -83,6 +83,7 @@ public:
bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override;
bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override;
bool GetCurrentTexture(GPUDebugBuffer &buffer, int level) override;
bool GetCurrentClut(GPUDebugBuffer &buffer) override;
static bool GetDisplayFramebuffer(GPUDebugBuffer &buffer);
bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices) override;

View file

@ -968,6 +968,16 @@ bool SoftGPU::GetCurrentTexture(GPUDebugBuffer &buffer, int level)
return Rasterizer::GetCurrentTexture(buffer, level);
}
bool SoftGPU::GetCurrentClut(GPUDebugBuffer &buffer)
{
const u32 bpp = gstate.getClutPaletteFormat() == GE_CMODE_32BIT_ABGR8888 ? 4 : 2;
const u32 pixels = 1024 / bpp;
buffer.Allocate(pixels, 1, (GEBufferFormat)gstate.getClutPaletteFormat());
memcpy(buffer.GetData(), clut, 1024);
return true;
}
bool SoftGPU::GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices)
{
return TransformUnit::GetCurrentSimpleVertices(count, vertices, indices);

View file

@ -84,6 +84,7 @@ public:
bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override;
bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override;
bool GetCurrentTexture(GPUDebugBuffer &buffer, int level) override;
bool GetCurrentClut(GPUDebugBuffer &buffer) override;
bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices) override;
protected: