GS/HW: Make sure both bitwise values are unsigned for ps_convert_float32_float24 depth.

This commit is contained in:
lightningterror 2024-07-08 15:54:47 +02:00
parent 51fcd7b886
commit fdcb0efe0a
4 changed files with 4 additions and 4 deletions

View File

@ -240,7 +240,7 @@ float rgb5a1_to_depth16(float4 val)
float ps_convert_float32_float24(PS_INPUT input) : SV_Depth float ps_convert_float32_float24(PS_INPUT input) : SV_Depth
{ {
// Truncates depth value to 24bits // Truncates depth value to 24bits
uint d = uint(sample_c(input.t).r * exp2(32.0f)) & 0xFFFFFF; uint d = uint(sample_c(input.t).r * exp2(32.0f)) & 0xFFFFFFu;
return float(d) * exp2(-32.0f); return float(d) * exp2(-32.0f);
} }

View File

@ -148,7 +148,7 @@ float rgb5a1_to_depth16(vec4 unorm)
void ps_convert_float32_float24() void ps_convert_float32_float24()
{ {
// Truncates depth value to 24bits // Truncates depth value to 24bits
uint d = uint(sample_c().r * exp2(32.0f)) & 0xFFFFFF; uint d = uint(sample_c().r * exp2(32.0f)) & 0xFFFFFFu;
gl_FragDepth = float(d) * exp2(-32.0f); gl_FragDepth = float(d) * exp2(-32.0f);
} }
#endif #endif

View File

@ -218,7 +218,7 @@ float rgb5a1_to_depth16(vec4 unorm)
void ps_convert_float32_float24() void ps_convert_float32_float24()
{ {
// Truncates depth value to 24bits // Truncates depth value to 24bits
uint d = uint(sample_c(v_tex).r * exp2(32.0f)) & 0xFFFFFF; uint d = uint(sample_c(v_tex).r * exp2(32.0f)) & 0xFFFFFFu;
gl_FragDepth = float(d) * exp2(-32.0f); gl_FragDepth = float(d) * exp2(-32.0f);
} }
#endif #endif

View File

@ -3,4 +3,4 @@
/// Version number for GS and other shaders. Increment whenever any of the contents of the /// Version number for GS and other shaders. Increment whenever any of the contents of the
/// shaders change, to invalidate the cache. /// shaders change, to invalidate the cache.
static constexpr u32 SHADER_CACHE_VERSION = 51; static constexpr u32 SHADER_CACHE_VERSION = 52;