Revert "OGL: Use floating point arithmetic to scale the depth value."

This reverts commit 05f42f94a0.
This commit is contained in:
Jules Blok
2015-06-06 20:07:49 +02:00
parent d3e47dfcf5
commit 5650b9e970
2 changed files with 5 additions and 5 deletions

View File

@ -429,6 +429,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
} }
D3D::context->Unmap(read_tex, 0); 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; return ret;
} }
else if (type == PEEK_COLOR) else if (type == PEEK_COLOR)

View File

@ -1023,18 +1023,17 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
// Scale the 32-bit value returned by glReadPixels to a 24-bit // Scale the 32-bit value returned by glReadPixels to a 24-bit
// value (GC uses a 24-bit Z-buffer). // value (GC uses a 24-bit Z-buffer).
float val = z / float(0xFFFFFFFF); // TODO: in RE0 this value is often off by one, which causes lighting to disappear
u32 ret = 0;
if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16) if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16)
{ {
// if Z is in 16 bit format you must return a 16 bit integer // if Z is in 16 bit format you must return a 16 bit integer
ret = MathUtil::Clamp<u32>((u32)(val * 65536.0f), 0, 0xFFFF); z = z >> 16;
} }
else else
{ {
ret = MathUtil::Clamp<u32>((u32)(val * 16777216.0f), 0, 0xFFFFFF); z = z >> 8;
} }
return ret; return z;
} }
case PEEK_COLOR: // GXPeekARGB case PEEK_COLOR: // GXPeekARGB