[Bf-blender-cvs] [6e8321f] master: Fix GLSL compatible_pow to give 1.0 for 0 ^ 0

Sv. Lockal noreply at git.blender.org
Tue Jan 14 19:59:25 CET 2014


Commit: 6e8321f2c033367dc6a7d6ec305c2a27e0b62969
Author: Sv. Lockal
Date:   Tue Jan 14 22:58:07 2014 +0400
https://developer.blender.org/rB6e8321f2c033367dc6a7d6ec305c2a27e0b62969

Fix GLSL compatible_pow to give 1.0 for 0 ^ 0

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

M	source/blender/gpu/shaders/gpu_shader_material.glsl

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

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 3a4aa75..cdb3f57 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -6,6 +6,9 @@ float exp_blender(float f)
 
 float compatible_pow(float x, float y)
 {
+	if(y == 0.0) /* x^0 -> 1, including 0^0 */
+		return 1.0;
+
 	/* glsl pow doesn't accept negative x */
 	if(x < 0.0) {
 		if(mod(-y, 2.0) == 0.0)




More information about the Bf-blender-cvs mailing list