diff --git a/GPU/Common/GPUDebugInterface.h b/GPU/Common/GPUDebugInterface.h index e95a06615d..eeb48a5393 100644 --- a/GPU/Common/GPUDebugInterface.h +++ b/GPU/Common/GPUDebugInterface.h @@ -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) { diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index 28f2874b75..5acab52df1 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -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 diff --git a/Windows/GEDebugger/SimpleGLWindow.cpp b/Windows/GEDebugger/SimpleGLWindow.cpp index 0db94d4028..0e8c81fc0f 100644 --- a/Windows/GEDebugger/SimpleGLWindow.cpp +++ b/Windows/GEDebugger/SimpleGLWindow.cpp @@ -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; diff --git a/Windows/GEDebugger/SimpleGLWindow.h b/Windows/GEDebugger/SimpleGLWindow.h index 310fec5746..0feec1c3fd 100644 --- a/Windows/GEDebugger/SimpleGLWindow.h +++ b/Windows/GEDebugger/SimpleGLWindow.h @@ -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, diff --git a/Windows/GEDebugger/VertexPreview.cpp b/Windows/GEDebugger/VertexPreview.cpp index 283844a185..accfe56f40 100644 --- a/Windows/GEDebugger/VertexPreview.cpp +++ b/Windows/GEDebugger/VertexPreview.cpp @@ -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) {