From 013de307edd8590ae5a3444d3c18990ee4fd288e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 Aug 2008 16:58:31 -0600 Subject: [PATCH] mesa: glsl: re-enable assignment type checking --- src/mesa/shader/slang/slang_codegen.c | 60 +++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 582b47c2392..036196a8d2b 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]); -- 2.30.2