diff --git a/Source/Core/Core/Src/HW/MemmapFunctions.cpp b/Source/Core/Core/Src/HW/MemmapFunctions.cpp index ff41da7911..425a40e759 100644 --- a/Source/Core/Core/Src/HW/MemmapFunctions.cpp +++ b/Source/Core/Core/Src/HW/MemmapFunctions.cpp @@ -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); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 83095cabd5..d83a4e82c4 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -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: