Skip to content

Commit

Permalink
Tightening the screws
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Jozufozu committed Nov 8, 2024
1 parent 376ac76 commit c8d76c3
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c8d76c3

Please sign in to comment.