mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-17 04:39:34 +00:00
Support reversed buffer formats in the ge debugger.
So that it doesn't show garbage under the softgpu.
This commit is contained in:
parent
ce11fd7e4b
commit
ac8edb4282
@ -38,22 +38,39 @@ enum GPUDebugBufferFormat {
|
||||
GPU_DBG_FORMAT_8888 = 3,
|
||||
GPU_DBG_FORMAT_INVALID = 0xFF,
|
||||
|
||||
// These are reversed versions.
|
||||
GPU_DBG_FORMAT_REVERSE_FLAG = 4,
|
||||
GPU_DBG_FORMAT_565_REV = 4,
|
||||
GPU_DBG_FORMAT_5551_REV = 5,
|
||||
GPU_DBG_FORMAT_4444_REV = 6,
|
||||
|
||||
// These don't, they're for depth/stencil buffers.
|
||||
GPU_DBG_FORMAT_FLOAT = 0x10,
|
||||
GPU_DBG_FORMAT_16BIT = 0x11,
|
||||
GPU_DBG_FORMAT_8BIT = 0x12,
|
||||
};
|
||||
|
||||
inline GPUDebugBufferFormat &operator |=(GPUDebugBufferFormat &lhs, const GPUDebugBufferFormat &rhs) {
|
||||
lhs = GPUDebugBufferFormat((int)lhs | (int)rhs);
|
||||
return lhs;
|
||||
}
|
||||
|
||||
struct GPUDebugBuffer {
|
||||
GPUDebugBuffer() : alloc_(false), data_(NULL) {
|
||||
}
|
||||
|
||||
GPUDebugBuffer(void *data, u32 stride, u32 height, GEBufferFormat fmt)
|
||||
GPUDebugBuffer(void *data, u32 stride, u32 height, GEBufferFormat fmt, bool reversed = false)
|
||||
: alloc_(false), data_((u8 *)data), stride_(stride), height_(height), fmt_(GPUDebugBufferFormat(fmt)), flipped_(false) {
|
||||
if (reversed && fmt_ < GPU_DBG_FORMAT_8888) {
|
||||
fmt_ |= GPU_DBG_FORMAT_REVERSE_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
GPUDebugBuffer(void *data, u32 stride, u32 height, GETextureFormat fmt)
|
||||
GPUDebugBuffer(void *data, u32 stride, u32 height, GETextureFormat fmt, bool reversed = false)
|
||||
: alloc_(false), data_((u8 *)data), stride_(stride), height_(height), fmt_(GPUDebugBufferFormat(fmt)), flipped_(false) {
|
||||
if (reversed && fmt_ < GPU_DBG_FORMAT_8888) {
|
||||
fmt_ |= GPU_DBG_FORMAT_REVERSE_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
GPUDebugBuffer(void *data, u32 stride, u32 height, GPUDebugBufferFormat fmt)
|
||||
@ -91,8 +108,12 @@ struct GPUDebugBuffer {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Allocate(u32 stride, u32 height, GEBufferFormat fmt, bool flipped = false) {
|
||||
Allocate(stride, height, GPUDebugBufferFormat(fmt), flipped);
|
||||
void Allocate(u32 stride, u32 height, GEBufferFormat fmt, bool flipped = false, bool reversed = false) {
|
||||
GPUDebugBufferFormat actualFmt = GPUDebugBufferFormat(fmt);
|
||||
if (reversed && actualFmt < GPU_DBG_FORMAT_8888) {
|
||||
actualFmt |= GPU_DBG_FORMAT_REVERSE_FLAG;
|
||||
}
|
||||
Allocate(stride, height, actualFmt, flipped);
|
||||
}
|
||||
|
||||
void Allocate(u32 stride, u32 height, GPUDebugBufferFormat fmt, bool flipped = false) {
|
||||
|
@ -1533,7 +1533,7 @@ bool FramebufferManager::GetCurrentFramebuffer(GPUDebugBuffer &buffer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
buffer.Allocate(vfb->renderWidth, vfb->renderHeight, GE_FORMAT_8888, true);
|
||||
buffer.Allocate(vfb->renderWidth, vfb->renderHeight, GE_FORMAT_8888, true, true);
|
||||
if (vfb->fbo)
|
||||
fbo_bind_for_read(vfb->fbo);
|
||||
#ifndef USING_GLES2
|
||||
|
@ -224,6 +224,13 @@ void SimpleGLWindow::Draw(u8 *data, int w, int h, bool flipped, Format fmt) {
|
||||
} else if (fmt == FORMAT_565) {
|
||||
glfmt = GL_UNSIGNED_SHORT_5_6_5;
|
||||
components = GL_RGB;
|
||||
} else if (fmt == FORMAT_4444_REV) {
|
||||
glfmt = GL_UNSIGNED_SHORT_4_4_4_4_REV;
|
||||
} else if (fmt == FORMAT_5551_REV) {
|
||||
glfmt = GL_UNSIGNED_SHORT_1_5_5_5_REV;
|
||||
} else if (fmt == FORMAT_565_REV) {
|
||||
glfmt = GL_UNSIGNED_SHORT_5_6_5_REV;
|
||||
components = GL_RGB;
|
||||
} else if (fmt == FORMAT_16BIT) {
|
||||
glfmt = GL_UNSIGNED_SHORT;
|
||||
components = GL_RED;
|
||||
|
@ -25,10 +25,13 @@ struct SimpleGLWindow {
|
||||
static const PTCHAR windowClass;
|
||||
|
||||
enum Format {
|
||||
FORMAT_565 = 0,
|
||||
FORMAT_5551 = 1,
|
||||
FORMAT_4444 = 2,
|
||||
FORMAT_565_REV = 0,
|
||||
FORMAT_5551_REV = 1,
|
||||
FORMAT_4444_REV = 2,
|
||||
FORMAT_8888 = 3,
|
||||
FORMAT_565 = 4,
|
||||
FORMAT_5551 = 5,
|
||||
FORMAT_4444 = 6,
|
||||
|
||||
FORMAT_FLOAT = 0x10,
|
||||
FORMAT_16BIT = 0x11,
|
||||
|
@ -31,7 +31,7 @@ void CGEDebugger::UpdatePrimPreview(u32 op) {
|
||||
return;
|
||||
}
|
||||
if (!gpuDebug) {
|
||||
ERROR_LOG(COMMON, "Invalid debugging environment, shutting down?", op);
|
||||
ERROR_LOG(COMMON, "Invalid debugging environment, shutting down?");
|
||||
return;
|
||||
}
|
||||
if (count == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user