mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 07:21:14 +01:00
DX11: Simpler depth-fetch. All DX10+ cards should have enough float precision to make this safe.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7269 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
df809630c5
commit
74f22a57d1
@ -204,27 +204,14 @@ static const char EFB_ENCODE_PS[] =
|
||||
"float4 Fetch_3(uint2 coord)\n"
|
||||
"{\n"
|
||||
"float2 texCoord = CalcTexCoord(coord);\n"
|
||||
// Ref: <http://www.horde3d.org/forums/viewtopic.php?f=1&t=569>
|
||||
// Ref: <http://code.google.com/p/dolphin-emu/source/detail?r=6217>
|
||||
"float depth = 255.99998474121094 * EFBTexture.Sample(EFBSampler, texCoord).r;\n"
|
||||
"float4 result = depth.rrrr;\n"
|
||||
|
||||
"result.a = floor(result.a);\n" // bits 31..24
|
||||
|
||||
"result.rgb -= result.a;\n"
|
||||
"result.rgb *= 256.0;\n"
|
||||
"result.r = floor(result.r);\n" // bits 23..16
|
||||
|
||||
"result.gb -= result.r;\n"
|
||||
"result.gb *= 256.0;\n"
|
||||
"result.g = floor(result.g);\n" // bits 15..8
|
||||
|
||||
"result.b -= result.g;\n"
|
||||
"result.b *= 256.0;\n"
|
||||
"result.b = floor(result.b);\n" // bits 7..0
|
||||
|
||||
"result = float4(result.arg / 255.0, 1.0);\n"
|
||||
"return result;\n"
|
||||
"uint depth24 = 0xFFFFFF * EFBTexture.Sample(EFBSampler, texCoord).r;\n"
|
||||
"uint4 bytes = uint4(\n"
|
||||
"(depth24 >> 16) & 0xFF,\n" // r
|
||||
"(depth24 >> 8) & 0xFF,\n" // g
|
||||
"depth24 & 0xFF,\n" // b
|
||||
"255);\n" // a
|
||||
"return bytes / 255.0;\n"
|
||||
"}\n"
|
||||
|
||||
"#ifdef DYNAMIC_MODE\n"
|
||||
|
@ -68,7 +68,8 @@ namespace DX11
|
||||
|
||||
// Format: B - G8 R8
|
||||
// Used in Wind Waker for depth-of-field. Usually used with srcFormat 3 to
|
||||
// render depth textures.
|
||||
// render depth textures. The bytes are swapped, so games have to correct it
|
||||
// in RAM before using it as a texture.
|
||||
|
||||
// Format: C - B8 G8
|
||||
// FIXME: Unseen.
|
||||
|
Loading…
x
Reference in New Issue
Block a user