summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-08-05 16:58:31 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-08-05 16:58:31 -0600
commit013de307edd8590ae5a3444d3c18990ee4fd288e (patch)
tree7ab6a034a9041c4415d42186f592ed082f21048c /src
parent8abeeb35d3c9810e191510ebe3194ae9b1b49f35 (diff)
mesa: glsl: re-enable assignment type checking
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 582b47c239..036196a8d2 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2860,36 +2860,46 @@ _slang_gen_swizzle(slang_ir_node *child, GLuint swizzle)
* XXX more cases needed.
*/
static GLboolean
-_slang_assignment_compatible(const slang_typeinfo *t0,
- const slang_typeinfo *t1)
-
+_slang_assignment_compatible(slang_assemble_ctx *A,
+ slang_operation *op0,
+ slang_operation *op1)
{
-#if 1
- GLuint sz0 = _slang_sizeof_type_specifier(&t0->spec);
- GLuint sz1 = _slang_sizeof_type_specifier(&t1->spec);
+ slang_typeinfo t0, t1;
+ GLuint sz0, sz1;
+
+
+ slang_typeinfo_construct(&t0);
+ _slang_typeof_operation(A, op0, &t0);
+
+ slang_typeinfo_construct(&t1);
+ _slang_typeof_operation(A, op1, &t1);
+
+ sz0 = _slang_sizeof_type_specifier(&t0.spec);
+ sz1 = _slang_sizeof_type_specifier(&t1.spec);
+#if 1
if (sz0 != sz1) {
printf("size mismatch %u vs %u\n", sz0, sz1);
return GL_FALSE;
}
#endif
- if (t0->spec.type == SLANG_SPEC_STRUCT &&
- t1->spec.type == SLANG_SPEC_STRUCT &&
- t0->spec._struct->a_name != t1->spec._struct->a_name)
+ if (t0.spec.type == SLANG_SPEC_STRUCT &&
+ t1.spec.type == SLANG_SPEC_STRUCT &&
+ t0.spec._struct->a_name != t1.spec._struct->a_name)
return GL_FALSE;
#if 0 /* not used just yet - causes problems elsewhere */
- if (t0->spec.type == SLANG_SPEC_INT &&
- t1->spec.type == SLANG_SPEC_FLOAT)
+ if (t0.spec.type == SLANG_SPEC_INT &&
+ t1.spec.type == SLANG_SPEC_FLOAT)
return GL_FALSE;
- if (t0->spec.type == SLANG_SPEC_BOOL &&
- t1->spec.type == SLANG_SPEC_FLOAT)
+ if (t0.spec.type == SLANG_SPEC_BOOL &&
+ t1.spec.type == SLANG_SPEC_FLOAT)
return GL_FALSE;
- if (t0->spec.type == SLANG_SPEC_BOOL &&
- t1->spec.type == SLANG_SPEC_INT)
+ if (t0.spec.type == SLANG_SPEC_BOOL &&
+ t1.spec.type == SLANG_SPEC_INT)
return GL_FALSE;
#endif
return GL_TRUE;
@@ -2943,21 +2953,11 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
slang_ir_node *n, *lhs, *rhs;
/* lhs and rhs type checking */
- if (0)
- {
- slang_typeinfo t0, t1;
-
- slang_typeinfo_construct(&t0);
- _slang_typeof_operation(A, &oper->children[0], &t0);
-
- slang_typeinfo_construct(&t1);
- _slang_typeof_operation(A, &oper->children[1], &t1);
-
- if (!_slang_assignment_compatible(&t0, &t1)) {
- slang_info_log_error(A->log,
- "illegal types in assignment");
- return NULL;
- }
+ if (!_slang_assignment_compatible(A,
+ &oper->children[0],
+ &oper->children[1])) {
+ slang_info_log_error(A->log, "illegal types in assignment");
+ return NULL;
}
lhs = _slang_gen_operation(A, &oper->children[0]);