summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-01-15 16:34:33 -0700
committerBrian <brian@yutani.localnet.net>2007-01-15 16:34:33 -0700
commit0a097675f174ead793f9c7e3dcd17128279f079b (patch)
tree59e9598ff61cb121e0a6d2402a0eb6985660e1eb
parent82258b7af3f939ce3b323dedf17ef7dadd567237 (diff)
added vec3 constructor code
-rw-r--r--src/mesa/shader/slang/slang_simplify.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c
index 94e6e1ecc2..dfae746a40 100644
--- a/src/mesa/shader/slang/slang_simplify.c
+++ b/src/mesa/shader/slang/slang_simplify.c
@@ -155,6 +155,7 @@ slang_simplify(slang_operation *oper,
}
}
else if (n == 4 && isFloat[0] && isFloat[1] && isFloat[2] && isFloat[3]) {
+ /* vec4(flt, flt, flt, flt) constructor */
if (oper->type == slang_oper_call) {
if (strcmp((char *) oper->a_id, "vec4") == 0) {
oper->literal[0] = oper->children[0].literal[0];
@@ -166,5 +167,18 @@ slang_simplify(slang_operation *oper,
}
}
}
+ else if (n == 3 && isFloat[0] && isFloat[1] && isFloat[2]) {
+ /* vec3(flt, flt, flt) constructor */
+ if (oper->type == slang_oper_call) {
+ if (strcmp((char *) oper->a_id, "vec3") == 0) {
+ oper->literal[0] = oper->children[0].literal[0];
+ oper->literal[1] = oper->children[1].literal[0];
+ oper->literal[2] = oper->children[2].literal[0];
+ oper->literal[3] = 0.0;
+ slang_operation_destruct(oper);
+ oper->type = slang_oper_literal_float;
+ }
+ }
+ }
}