Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Fielder <jason_apple>2022-04-14 12:47:52 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-04-14 12:49:18 +0300
commitb0dc3aff2c73f2a1b65406dcb7fe73c95b9485ed (patch)
tree29642f7e85e2f5189549c1710854c421463a2e0d /source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl
parentd62f443f2d0b464131f77f770f9aa19d81164f0c (diff)
Metal: GLSL shader compatibility 3rd pass
Undefined behaviour for divergent control-flow fixes, replacement for partial vector references, and resolution of a number of calculation precision issues occuring on macOS. Authored by Apple: Michael Parkin-White Ref: T96261 Reviewed By: fclem Differential Revision: https://developer.blender.org/D14437
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl
index 11f57c0a82e..527bbd18896 100644
--- a/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/volumetric_integration_frag.glsl
@@ -70,7 +70,11 @@ void main()
vec3 Tr = exp(-s_extinction * s_len);
/* integrate along the current step segment */
- Lscat = (Lscat - Lscat * Tr) / max(vec3(1e-8), s_extinction);
+ /* Note: Original calculation carries precision issues when compiling for AMD GPUs
+ * and running Metal. This version of the equation retains precision well for all
+ * macOS HW configurations. */
+ Lscat = (Lscat * (1.0f - Tr)) / max(vec3(1e-8), s_extinction);
+
/* accumulate and also take into account the transmittance from previous steps */
finalScattering += finalTransmittance * Lscat;