VideoBackends: Use proper floating point depth precision.

This commit is contained in:
Jules Blok
2015-05-05 23:34:45 +02:00
parent 268b8fd26f
commit c4f85a38e6
5 changed files with 12 additions and 12 deletions

View File

@ -146,7 +146,7 @@ const char depth_matrix_program[] = {
" in float4 pos : SV_Position,\n"
" in float3 uv0 : TEXCOORD0){\n"
" float4 texcol = Tex0.Sample(samp0,uv0);\n"
" int depth = int(round(texcol.x * float(0xFFFFFF)));\n"
" int depth = int(round(texcol.x * 16777216.0));\n"
// Convert to Z24 format
" int4 workspace;\n"
@ -180,7 +180,7 @@ const char depth_matrix_program_msaa[] = {
" for(int i = 0; i < SAMPLES; ++i)\n"
" texcol += Tex0.Load(int3(uv0.x*(width), uv0.y*(height), uv0.z), i);\n"
" texcol /= SAMPLES;\n"
" int depth = int(round(texcol.x * float(0xFFFFFF)));\n"
" int depth = int(round(texcol.x * 16777216.0));\n"
// Convert to Z24 format
" int4 workspace;\n"

View File

@ -419,11 +419,11 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16)
{
// if Z is in 16 bit format you must return a 16 bit integer
ret = ((u32)(val * 0xffff));
ret = ((u32)(val * 65536.0f));
}
else
{
ret = ((u32)(val * 0xffffff));
ret = ((u32)(val * 16777216.0f));
}
D3D::context->Unmap(read_tex, 0);