don't return stencil bits in the response for PEEK_Z. compensate for ogl's upside-down coords...

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3632 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-07-01 19:29:35 +00:00
parent c3547effe6
commit 2fc917dd79
2 changed files with 10 additions and 8 deletions

View File

@ -130,10 +130,10 @@ void ReadFromHardware(T &_var, u32 em_address, u32 effective_address, Memory::XC
int y = (em_address >> 12) & 0x3ff;
if (em_address & 0x00400000) {
_var = CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(EFBAccessType::PEEK_Z, x, y);
DEBUG_LOG(MEMMAP, "EFB Z Read @ %i, %i\t= %i", x, y, _var);
DEBUG_LOG(MEMMAP, "EFB Z Read @ %i, %i\t= 0x%08x", x, y, _var);
} else {
_var = CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(EFBAccessType::PEEK_COLOR, x, y);
DEBUG_LOG(MEMMAP, "EFB Color Read @ %i, %i\t= %i", x, y, _var);
DEBUG_LOG(MEMMAP, "EFB Color Read @ %i, %i\t= 0x%08x", x, y, _var);
}
}
else if (em_address <= 0xcc009000)
@ -202,6 +202,7 @@ void WriteToHardware(u32 em_address, const T data, u32 effective_address, Memory
{
int x = (em_address & 0xfff) >> 2;
int y = (em_address >> 12) & 0x3ff;
// TODO figure out a way to send data without falling into the template trap
if (em_address & 0x00400000) {
CPluginManager::GetInstance().GetVideo()->Video_AccessEFB(EFBAccessType::POKE_Z, x, y);
DEBUG_LOG(MEMMAP, "EFB Z Write %08x @ %i, %i", data, x, y);

View File

@ -462,7 +462,7 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
{
switch (type)
{
case EFBAccessType::PEEK_Z:
case PEEK_Z:
{
if (!g_VideoInitialize.bUseDualCore)
{
@ -471,20 +471,21 @@ u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
ComputeBackbufferRectangle(&source);
source.Scale(Renderer::GetTargetScaleX(), Renderer::GetTargetScaleY(), &scaledTargetSource);
GLuint depth_tex = Renderer::ResolveAndGetDepthTarget(scaledTargetSource);
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &z);
glReadPixels(x, Renderer::GetTargetHeight()-y, 1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &z);
GL_REPORT_ERRORD();
return z;
// mask away the stencil bits
return z & 0xffffff;
}
}
break;
case EFBAccessType::POKE_Z:
case POKE_Z:
break;
case EFBAccessType::PEEK_COLOR:
case PEEK_COLOR:
break;
case EFBAccessType::POKE_COLOR:
case POKE_COLOR:
break;
default: