diff options
author | Kenneth Graunke <[email protected]> | 2010-12-06 16:00:24 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2011-01-11 23:28:58 -0800 |
commit | 1412dea94953243b5cd3a452f676afd046101192 (patch) | |
tree | edcd6452564b73f28d9aa0c42453f7e3e66ac805 | |
parent | 4eb7284ef98c24331761cbe683c5bd89058e3ad3 (diff) |
glsl: Add type inference support for remaining expression opcodes.
-rw-r--r-- | src/glsl/ir.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index b8b0fed9d1c..742dd41b9f4 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -261,12 +261,38 @@ ir_expression::ir_expression(int op, ir_rvalue *op0) case ir_unop_floor: case ir_unop_fract: case ir_unop_round_even: + case ir_unop_sin: case ir_unop_cos: + case ir_unop_sin_reduced: + case ir_unop_cos_reduced: case ir_unop_dFdx: case ir_unop_dFdy: this->type = op0->type; break; + case ir_unop_f2i: + case ir_unop_b2i: + this->type = glsl_type::get_instance(GLSL_TYPE_INT, + op0->type->vector_elements, 1); + break; + + case ir_unop_b2f: + case ir_unop_i2f: + case ir_unop_u2f: + this->type = glsl_type::get_instance(GLSL_TYPE_FLOAT, + op0->type->vector_elements, 1); + break; + + case ir_unop_f2b: + case ir_unop_i2b: + this->type = glsl_type::get_instance(GLSL_TYPE_BOOL, + op0->type->vector_elements, 1); + break; + + case ir_unop_noise: + this->type = glsl_type::float_type; + break; + case ir_unop_any: this->type = glsl_type::bool_type; break; @@ -302,6 +328,8 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1) case ir_binop_max: case ir_binop_pow: case ir_binop_mul: + case ir_binop_div: + case ir_binop_mod: if (op0->type->is_scalar()) { this->type = op1->type; } else if (op1->type->is_scalar()) { @@ -315,7 +343,11 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1) break; case ir_binop_logic_and: + case ir_binop_logic_xor: case ir_binop_logic_or: + case ir_binop_bit_and: + case ir_binop_bit_xor: + case ir_binop_bit_or: if (op0->type->is_scalar()) { this->type = op1->type; } else if (op1->type->is_scalar()) { @@ -323,10 +355,26 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1) } break; + case ir_binop_equal: + case ir_binop_nequal: + case ir_binop_lequal: + case ir_binop_gequal: + case ir_binop_less: + case ir_binop_greater: + assert(op0->type == op1->type); + this->type = glsl_type::get_instance(GLSL_TYPE_BOOL, + op0->type->vector_elements, 1); + break; + case ir_binop_dot: this->type = glsl_type::float_type; break; + case ir_binop_lshift: + case ir_binop_rshift: + this->type = op0->type; + break; + default: assert(!"not reached: missing automatic type setup for ir_expression"); this->type = glsl_type::float_type; |