From b69d218a8284fa3805bcc1508814c7492fc4f94a Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 1 Jul 2009 23:57:20 +0000 Subject: [PATCH] fix GXPeekZ when using aa git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3642 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index d83a4e82c4..386b4d68c3 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -467,13 +467,22 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y) if (!g_VideoInitialize.bUseDualCore) { u32 z = 0; - TRectangle source, scaledTargetSource; - ComputeBackbufferRectangle(&source); - source.Scale(Renderer::GetTargetScaleX(), Renderer::GetTargetScaleY(), &scaledTargetSource); - GLuint depth_tex = Renderer::ResolveAndGetDepthTarget(scaledTargetSource); + + if (g_Config.iMultisampleMode != MULTISAMPLE_OFF) + { + // Find the proper dimensions + TRectangle source, scaledTargetSource; + ComputeBackbufferRectangle(&source); + source.Scale(Renderer::GetTargetScaleX(), Renderer::GetTargetScaleY(), &scaledTargetSource); + // This will resolve and bind to the depth buffer + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Renderer::ResolveAndGetDepthTarget(scaledTargetSource)); + } + + // Read the z value! glReadPixels(x, Renderer::GetTargetHeight()-y, 1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &z); GL_REPORT_ERRORD(); - // mask away the stencil bits + + // Mask away the stencil bits return z & 0xffffff; } }