diff options
| author | Jules Blok <jules.blok@gmail.com> | 2015-05-20 13:48:34 +0200 |
|---|---|---|
| committer | Jules Blok <jules.blok@gmail.com> | 2015-05-20 14:22:30 +0200 |
| commit | 05f42f94a0442fef64c994cb78f4d621bb1fc7ff (patch) | |
| tree | c6b28f49b7ba24ccd353a265dc75f8db5a2329f7 /Source/Core | |
| parent | 05d60f4fef5fb7377ed1f2f905b48e93926501b3 (diff) | |
OGL: Use floating point arithmetic to scale the depth value.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/VideoBackends/D3D/Render.cpp | 1 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/OGL/Render.cpp | 9 |
2 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index db841e5dd0..dd2ad1886f 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -428,7 +428,6 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) } D3D::context->Unmap(read_tex, 0); - // TODO: in RE0 this value is often off by one in Video_DX9 (where this code is derived from), which causes lighting to disappear return ret; } else if (type == PEEK_COLOR) diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index b66e10d0cf..4f6fcdcffc 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -1019,17 +1019,18 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) // Scale the 32-bit value returned by glReadPixels to a 24-bit // value (GC uses a 24-bit Z-buffer). - // TODO: in RE0 this value is often off by one, which causes lighting to disappear + float val = z / float(0xFFFFFFFF); + u32 ret = 0; if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16) { // if Z is in 16 bit format you must return a 16 bit integer - z = z >> 16; + ret = MathUtil::Clamp<u32>((u32)(val * 65536.0f), 0, 0xFFFF); } else { - z = z >> 8; + ret = MathUtil::Clamp<u32>((u32)(val * 16777216.0f), 0, 0xFFFFFF); } - return z; + return ret; } case PEEK_COLOR: // GXPeekARGB |
