[Bf-blender-cvs] [ffc95a33b62] master: Fix T51434: Module math operation is wrong in GLSL shading

Carlo Andreacchio noreply at git.blender.org
Tue May 9 12:33:23 CEST 2017


Commit: ffc95a33b62821e8eb66cf7003942e37976d20d7
Author: Carlo Andreacchio
Date:   Tue May 9 12:31:19 2017 +0200
Branches: master
https://developer.blender.org/rBffc95a33b62821e8eb66cf7003942e37976d20d7

Fix T51434: Module math operation is wrong in GLSL shading

Based on patch from @lazydodo.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D2661

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

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 b88fba12f55..42561d7baaf 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -403,7 +403,7 @@ void math_modulo(float val1, float val2, out float outval)
 
 	/* change sign to match C convention, mod in GLSL will take absolute for negative numbers,
 	 * see https://www.opengl.org/sdk/docs/man/html/mod.xhtml */
-	outval = (val1 > 0.0) ? outval : -outval;
+	outval = (val1 > 0.0) ? outval : outval - val2;
 }
 
 void math_abs(float val1, out float outval)




More information about the Bf-blender-cvs mailing list