From 0b74bbb3dcf07489e1dbd1976f07093ad7821e51 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jul 2010 14:53:43 -0700 Subject: [PATCH] glsl: Fix the setup of refract()'s output for vec3/vec4 and k < 0.0. caught by valgrind. --- src/glsl/builtin_function.cpp | 4 ++-- src/glsl/builtins/110/refract | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 40c85e7..5b3b49d 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -1808,7 +1808,7 @@ static const char *builtins_110_refract = { " (expression float dot (var_ref n) (var_ref i))\n" " (expression float dot (var_ref n) (var_ref i))))))))\n" " (if (expression bool < (var_ref k) (constant float (0.0)))\n" - " ((return (constant vec3 (0.0 0.0))))\n" + " ((return (constant vec3 (0.0 0.0 0.0))))\n" " ((return (expression vec3 -\n" " (expression vec3 * (var_ref eta) (var_ref i))\n" " (expression vec3 *\n" @@ -1833,7 +1833,7 @@ static const char *builtins_110_refract = { " (expression float dot (var_ref n) (var_ref i))\n" " (expression float dot (var_ref n) (var_ref i))))))))\n" " (if (expression bool < (var_ref k) (constant float (0.0)))\n" - " ((return (constant vec4 (0.0 0.0))))\n" + " ((return (constant vec4 (0.0 0.0 0.0 0.0))))\n" " ((return (expression vec4 -\n" " (expression vec4 * (var_ref eta) (var_ref i))\n" " (expression vec4 *\n" diff --git a/src/glsl/builtins/110/refract b/src/glsl/builtins/110/refract index e9b1475..522ab41 100644 --- a/src/glsl/builtins/110/refract +++ b/src/glsl/builtins/110/refract @@ -64,7 +64,7 @@ (expression float dot (var_ref n) (var_ref i)) (expression float dot (var_ref n) (var_ref i)))))))) (if (expression bool < (var_ref k) (constant float (0.0))) - ((return (constant vec3 (0.0 0.0)))) + ((return (constant vec3 (0.0 0.0 0.0)))) ((return (expression vec3 - (expression vec3 * (var_ref eta) (var_ref i)) (expression vec3 * @@ -89,7 +89,7 @@ (expression float dot (var_ref n) (var_ref i)) (expression float dot (var_ref n) (var_ref i)))))))) (if (expression bool < (var_ref k) (constant float (0.0))) - ((return (constant vec4 (0.0 0.0)))) + ((return (constant vec4 (0.0 0.0 0.0 0.0)))) ((return (expression vec4 - (expression vec4 * (var_ref eta) (var_ref i)) (expression vec4 * -- 2.7.4