[Bf-blender-cvs] [65a3195781c] master: EEVEE: Screen Space Reflection: Fix undefined behavior with invalid LOD

Clément Foucault noreply at git.blender.org
Tue Oct 20 22:06:48 CEST 2020


Commit: 65a3195781cbcca859b1f466f5395b226add4cb6
Author: Clément Foucault
Date:   Tue Oct 20 21:59:04 2020 +0200
Branches: master
https://developer.blender.org/rB65a3195781cbcca859b1f466f5395b226add4cb6

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).

===================================================================

M	source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl

===================================================================

diff --git a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
index 22c306bb0fd..cad1346609a 100644
--- a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
@@ -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;



More information about the Bf-blender-cvs mailing list