Cleanup: Overlay: Avoid non-uniform control flow for texture sampling

This commit is contained in:
Clément Foucault
2024-10-16 17:01:00 +02:00
parent f38827802a
commit e6f8924870

View File

@@ -53,17 +53,17 @@ void main()
vec2 uv = gl_FragCoord.xy * sizeViewportInv;
float depth_occluder = texture(depthTex, uv).r;
float depth_min = depth_occluder;
vec2 texel_uv_size = sizeViewportInv;
vec2 uv_offset = sizeViewportInv;
if (dir_horiz) {
depth_min = min(depth_min, texture(depthTex, uv + vec2(-texel_uv_size.x, 0.0)).r);
depth_min = min(depth_min, texture(depthTex, uv + vec2(texel_uv_size.x, 0.0)).r);
uv_offset.y = 0.0;
}
else {
depth_min = min(depth_min, texture(depthTex, uv + vec2(0, -texel_uv_size.y)).r);
depth_min = min(depth_min, texture(depthTex, uv + vec2(0, texel_uv_size.y)).r);
uv_offset.x = 0.0;
}
depth_min = min(depth_min, texture(depthTex, uv - texel_uv_size).r);
depth_min = min(depth_min, texture(depthTex, uv + texel_uv_size).r);
float delta = abs(depth_occluder - depth_min);
# ifndef SELECT_ENABLE