From a32ccd3eb8571d07550d30f5a3e129cd5ee1367b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 23 Dec 2017 01:31:04 -0800 Subject: [PATCH] GE Debugger: Fix preview when zooming. Before, the coordinates were only right when scaled to fit. When you zoomed in and panned, it would show in the wrong place because it wasn't accounting for the flipped backbuffer. --- Windows/GEDebugger/VertexPreview.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Windows/GEDebugger/VertexPreview.cpp b/Windows/GEDebugger/VertexPreview.cpp index 75577a1a3c..8bad6b3331 100644 --- a/Windows/GEDebugger/VertexPreview.cpp +++ b/Windows/GEDebugger/VertexPreview.cpp @@ -189,8 +189,9 @@ void CGEDebugger::UpdatePrimPreview(u32 op) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); glBindTexture(GL_TEXTURE_2D, 0); - glViewport((GLint)x, (GLint)y, (GLsizei)fw, (GLsizei)fh); - glScissor((GLint)x, (GLint)y, (GLsizei)fw, (GLsizei)fh); + // The surface is upside down, so vertical offsets are negated. + glViewport((GLint)x, (GLint)-(y + fh - primaryWindow->Height()), (GLsizei)fw, (GLsizei)fh); + glScissor((GLint)x, (GLint)-(y + fh - primaryWindow->Height()), (GLsizei)fw, (GLsizei)fh); BindPreviewProgram(previewProgram); // TODO: Probably there's a better way and place to do this. @@ -277,8 +278,9 @@ void CGEDebugger::UpdatePrimPreview(u32 op) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); glBindTexture(GL_TEXTURE_2D, 0); - glViewport((GLint)x, (GLint)y, (GLsizei)fw, (GLsizei)fh); - glScissor((GLint)x, (GLint)y, (GLsizei)fw, (GLsizei)fh); + // The surface is upside down, so vertical offsets are flipped. + glViewport((GLint)x, (GLint)-(y + fh - secondWindow->Height()), (GLsizei)fw, (GLsizei)fh); + glScissor((GLint)x, (GLint)-(y + fh - secondWindow->Height()), (GLsizei)fw, (GLsizei)fh); BindPreviewProgram(texPreviewProgram); if (texPreviewVao == 0 && gl_extensions.ARB_vertex_array_object) {