summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_codegen.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-03 17:24:24 -0700
committerBrian <[email protected]>2007-02-03 17:24:24 -0700
commit93b975a1d9fcc4a10987676f7368809522f27d71 (patch)
treeebf408cfd8fbca10dea39eb594346e4fe03636b9 /src/mesa/shader/slang/slang_codegen.c
parent5ee684cba9b1f63090e184125e5890da4fc1d28c (diff)
Add literal_size field to slang_operation.
Used to track the number of components in a float/int/bool literal. Helps with some typechecking things. Fixes problems with calls such as "distance(v2, vec2(1.0, 2.0))"
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 4cb161a5b65..6b7df0597b6 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -1040,7 +1040,7 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
static slang_ir_node *
_slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun,
- slang_operation *oper, slang_operation *dest)
+ slang_operation *oper, slang_operation *dest)
{
slang_ir_node *n;
slang_operation *inlined;
@@ -1694,6 +1694,7 @@ _slang_gen_logical_and(slang_assemble_ctx *A, slang_operation *oper)
slang_operation_copy(&select->children[1], &oper->children[1]);
select->children[2].type = slang_oper_literal_bool;
ASSIGN_4V(select->children[2].literal, 0, 0, 0, 0);
+ select->children[2].literal_size = 2;
n = _slang_gen_select(A, select);
@@ -1724,6 +1725,7 @@ _slang_gen_logical_or(slang_assemble_ctx *A, slang_operation *oper)
select->children[1].type = slang_oper_literal_bool;
ASSIGN_4V(select->children[2].literal, 1, 1, 1, 1);
slang_operation_copy(&select->children[2], &oper->children[1]);
+ select->children[2].literal_size = 2;
n = _slang_gen_select(A, select);
@@ -1867,9 +1869,19 @@ _slang_gen_declaration(slang_assemble_ctx *A, slang_operation *oper)
if (!var) {
RETURN_ERROR2("Undefined variable:", varName, 0);
}
+#if 0
/* XXX make copy of this initializer? */
+ {
+ slang_operation dup;
+ slang_operation_construct(&dup);
+ slang_operation_copy(&dup, v->initializer);
+ _slang_simplify(&dup, &A->space, A->atoms);
+ rhs = _slang_gen_operation(A, &dup);
+ }
+#else
_slang_simplify(v->initializer, &A->space, A->atoms);
rhs = _slang_gen_operation(A, v->initializer);
+#endif
assert(rhs);
init = new_node(IR_MOVE, var, rhs);
/*