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:
authorAntony Riakiotakis <kalast@gmail.com>2015-02-03 17:08:28 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-02-03 17:08:42 +0300
commit3ff9e52dca8ce9e5900eb89fd06842f41b817b3d (patch)
treed4e64ac2ea841ee007a0369234cd0559d1df3d79 /source/blender
parent8186214c390e91d20dd78fbee345e668c3364c71 (diff)
Fix T43380 modulo operation in GLSL does not return negatives.
Make it so by checking operand sign.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 229abd7c5a6..17f0c20fad8 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -297,6 +297,10 @@ void math_modulo(float val1, float val2, out float outval)
outval = 0.0;
else
outval = mod(val1, val2);
+
+ /* 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) ? outval : -outval;
}
void math_abs(float val1, out float outval)