EEVEE: Screen Space Reflection: Fix undefined behavior with invalid LOD

Some issues happened because the lod can become negative in some cases.
Also avoid sampling LOD with interpolation (floor).
This commit is contained in:
Clément Foucault 2020-10-20 21:59:04 +02:00
parent 3e5a354333
commit 65a3195781
1 changed files with 1 additions and 0 deletions

View File

@ -16,6 +16,7 @@ float sample_depth(vec2 uv, int index, float lod)
}
else {
#endif
lod = clamp(floor(lod), 0.0, 8.0);
/* Correct UVs for mipmaping mis-alignment */
uv *= mipRatio[int(lod) + hizMipOffset];
return textureLod(maxzBuffer, uv, lod).r;