diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-29 15:11:05 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-29 15:18:31 -0700 |
commit | 6e659caaa946339a2de3890a8bed091ccb65102a (patch) | |
tree | c40d1bd962428a9966c98f1e9bae34f81c976bd4 /ast_to_hir.cpp | |
parent | 251eb753187fee83e6413f44f8b3cf0be1b4f4cb (diff) |
Implement HIR conversion for ast_nequal and ast_equal
The following tests now pass:
shaders/glsl-unused-varying.frag
shaders/glsl-fs-sqrt-branch.frag
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r-- | ast_to_hir.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index 8d34adf8ef..4674cfcdd5 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -582,7 +582,30 @@ ast_expression::hir(exec_list *instructions, case ast_nequal: case ast_equal: - /* FINISHME: Implement equality operators. */ + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + /* From page 58 (page 64 of the PDF) of the GLSL 1.50 spec: + * + * "The equality operators equal (==), and not equal (!=) + * operate on all types. They result in a scalar Boolean. If + * the operand types do not match, then there must be a + * conversion from Section 4.1.10 "Implicit Conversions" + * applied to one operand that can make them match, in which + * case this conversion is done." + */ + /* FINISHME: Apply implicit conversions */ + if (op[0]->type != op[1]->type) { + _mesa_glsl_error(& loc, state, "operands of `%s' must have the same " + "type", (this->oper == ast_equal) ? "==" : "!="); + error_emitted = true; + } + + result = new ir_expression(operations[this->oper], glsl_type::bool_type, + op[0], op[1]); + type = glsl_type::bool_type; + + assert(result->type == glsl_type::bool_type); break; case ast_bit_and: |