mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-11 06:59:07 +01:00
Fix PeekZ when not using native resolution
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3643 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b69d218a82
commit
ae2a5b8587
@ -261,7 +261,10 @@ EVT_COMMAND_SCROLL(IDM_VOLUME, CFrame::MM_OnVolume)
|
|||||||
//EVT_MENU(IDM_MM_LOG, CFrame::MM_OnLog)
|
//EVT_MENU(IDM_MM_LOG, CFrame::MM_OnLog)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_SFML) && HAVE_SFML
|
||||||
EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay)
|
EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay)
|
||||||
|
#endif
|
||||||
|
|
||||||
EVT_MENU(IDM_BROWSE, CFrame::OnBrowse)
|
EVT_MENU(IDM_BROWSE, CFrame::OnBrowse)
|
||||||
EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
|
EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard)
|
||||||
EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow)
|
EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow)
|
||||||
|
@ -714,6 +714,7 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset)
|
|||||||
float u_max;
|
float u_max;
|
||||||
float v_min;
|
float v_min;
|
||||||
float v_max;
|
float v_max;
|
||||||
|
|
||||||
if (g_Config.bAutoScale)
|
if (g_Config.bAutoScale)
|
||||||
{
|
{
|
||||||
u_max = (xfbSource->sourceRc.right - xfbSource->sourceRc.left);
|
u_max = (xfbSource->sourceRc.right - xfbSource->sourceRc.left);
|
||||||
@ -725,6 +726,7 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset)
|
|||||||
u_max = (float)xfbSource->texWidth;
|
u_max = (float)xfbSource->texWidth;
|
||||||
v_max = (float)xfbSource->texHeight;
|
v_max = (float)xfbSource->texHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
v_min -= yOffset;
|
v_min -= yOffset;
|
||||||
v_max -= yOffset;
|
v_max -= yOffset;
|
||||||
|
|
||||||
@ -909,6 +911,7 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset)
|
|||||||
|
|
||||||
// Place messages on the picture, then copy it to the screen
|
// Place messages on the picture, then copy it to the screen
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
|
||||||
// Why save this as s_bNativeResolution if we updated it every frame?
|
// Why save this as s_bNativeResolution if we updated it every frame?
|
||||||
s_bNativeResolution = g_Config.bNativeResolution;
|
s_bNativeResolution = g_Config.bNativeResolution;
|
||||||
|
|
||||||
@ -921,7 +924,6 @@ void Renderer::Swap(u32 xfbAddr, u32 srcWidth, u32 srcHeight, s32 yOffset)
|
|||||||
// Renderer::SetZBufferRender();
|
// Renderer::SetZBufferRender();
|
||||||
// SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, GetTargetWidth(), GetTargetHeight());
|
// SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, GetTargetWidth(), GetTargetHeight());
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -467,23 +467,26 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
|
|||||||
if (!g_VideoInitialize.bUseDualCore)
|
if (!g_VideoInitialize.bUseDualCore)
|
||||||
{
|
{
|
||||||
u32 z = 0;
|
u32 z = 0;
|
||||||
|
float xScale = Renderer::GetTargetScaleX();
|
||||||
|
float yScale = Renderer::GetTargetScaleY();
|
||||||
|
|
||||||
if (g_Config.iMultisampleMode != MULTISAMPLE_OFF)
|
if (g_Config.iMultisampleMode != MULTISAMPLE_OFF)
|
||||||
{
|
{
|
||||||
// Find the proper dimensions
|
// Find the proper dimensions
|
||||||
TRectangle source, scaledTargetSource;
|
TRectangle source, scaledTargetSource;
|
||||||
ComputeBackbufferRectangle(&source);
|
ComputeBackbufferRectangle(&source);
|
||||||
source.Scale(Renderer::GetTargetScaleX(), Renderer::GetTargetScaleY(), &scaledTargetSource);
|
source.Scale(xScale, yScale, &scaledTargetSource);
|
||||||
// This will resolve and bind to the depth buffer
|
// This will resolve and bind to the depth buffer
|
||||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Renderer::ResolveAndGetDepthTarget(scaledTargetSource));
|
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Renderer::ResolveAndGetDepthTarget(scaledTargetSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the z value!
|
// Read the z value! Also adjust the pixel to read to the upscaled EFB resolution
|
||||||
glReadPixels(x, Renderer::GetTargetHeight()-y, 1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &z);
|
// Plus we need to flip the y value as the OGL image is upside down
|
||||||
|
glReadPixels(x*xScale, Renderer::GetTargetHeight() - y*yScale, xScale, yScale, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &z);
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
// Mask away the stencil bits
|
// Clamp the 32bits value returned by glReadPixels to a 24bits value (GC uses a 24bits Z-Buffer)
|
||||||
return z & 0xffffff;
|
return z / 0x100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user