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:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-11-04 14:50:29 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2014-11-04 14:55:40 +0300
commit176f0102eaacc9f9caa5de24326137a8c3fa0f89 (patch)
tree1cf7a2ac76cba32606919483d776b2755c8e75a5 /source/blender/gpu/shaders
parent988b3d718835c1474353ff3aa04fce5e17ed2f2e (diff)
Fix T42445: Clamp flag has no effect on result value in Math and MixRGB shader nodes (Blender Render)
Quite striaghtforward implementation, with the only weird thing that for some reason my video driver wasn't happy with calling the function "clamp" giving some weirdo shader compilation error messages. Called the GPU function clamp_val which can handle float and vec3.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 5a0812cb367..39e8b31197f 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -722,6 +722,16 @@ void invert(float fac, vec4 col, out vec4 outcol)
outcol.w = col.w;
}
+void clamp_val(vec3 vec, vec3 min, vec3 max, out vec3 out_vec)
+{
+ out_vec = clamp(vec, min, max);
+}
+
+void clamp_val(float value, float min, float max, out float out_value)
+{
+ out_value = clamp(value, min, max);
+}
+
void hue_sat(float hue, float sat, float value, float fac, vec4 col, out vec4 outcol)
{
vec4 hsv;