From c8d76c32a7880e59ed4433a50af9c961b87aee8d Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Fri, 8 Nov 2024 09:58:40 -0800 Subject: [PATCH] Tightening the screws - Fix hiz test bounds clamping, good ol off by 1 error - Remove check for useMin since it's never used and the depth reduce shader is hard-coded already --- .../assets/flywheel/flywheel/internal/indirect/cull.glsl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl index 1869e33b8..96ed0cd81 100644 --- a/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl +++ b/common/src/backend/resources/assets/flywheel/flywheel/internal/indirect/cull.glsl @@ -102,19 +102,14 @@ bool _flw_isVisible(uint instanceIndex, uint modelIndex) { // Clamp to the texture bounds. // Since we're not going through a sampler out of bounds texel fetches will return 0. - bounds = clamp(bounds, ivec4(0), levelSizePair); + bounds = clamp(bounds, ivec4(0), levelSizePair - ivec4(1)); float depth01 = texelFetch(_flw_depthPyramid, bounds.xw, level).r; float depth11 = texelFetch(_flw_depthPyramid, bounds.zw, level).r; float depth10 = texelFetch(_flw_depthPyramid, bounds.zy, level).r; float depth00 = texelFetch(_flw_depthPyramid, bounds.xy, level).r; - float depth; - if (_flw_cullData.useMin == 0) { - depth = max(max(depth00, depth01), max(depth10, depth11)); - } else { - depth = min(min(depth00, depth01), min(depth10, depth11)); - } + float depth = max(max(depth00, depth01), max(depth10, depth11)); float depthSphere = 1. + _flw_cullData.znear / (center.z + radius);