}
break;
case GLSL_TYPE_BOOL: {
- int z = 0;
- ir_constant *const zero = new ir_constant(src->type, &z);
+ ir_constant *zero = NULL;
+
+ switch (b) {
+ case GLSL_TYPE_UINT: zero = new ir_constant(unsigned(0)); break;
+ case GLSL_TYPE_INT: zero = new ir_constant(int(0)); break;
+ case GLSL_TYPE_FLOAT: zero = new ir_constant(0.0f); break;
+ }
result = new ir_expression(ir_binop_nequal, desired_type, src, zero);
}
*/
const int c = component / src->type->column_type()->vector_elements;
const int r = component % src->type->column_type()->vector_elements;
- ir_constant *const col_index = new ir_constant(glsl_type::int_type, &c);
+ ir_constant *const col_index = new ir_constant(c);
ir_dereference *const col = new ir_dereference_array(src, col_index);
col->type = src->type->column_type();
case ast_int_constant:
type = glsl_type::int_type;
- result = new ir_constant(type, & this->primary_expression);
+ result = new ir_constant(this->primary_expression.int_constant);
break;
case ast_uint_constant:
type = glsl_type::uint_type;
- result = new ir_constant(type, & this->primary_expression);
+ result = new ir_constant(this->primary_expression.uint_constant);
break;
case ast_float_constant:
type = glsl_type::float_type;
- result = new ir_constant(type, & this->primary_expression);
+ result = new ir_constant(this->primary_expression.float_constant);
break;
case ast_bool_constant:
type = glsl_type::bool_type;
- result = new ir_constant(type, & this->primary_expression);
+ result = new ir_constant(bool(this->primary_expression.bool_constant));
break;
case ast_sequence: {
inst = new ir_assignment(lhs, rhs, NULL);
instructions->push_tail(inst);
- const float z = 0.0f;
- ir_constant *const zero = new ir_constant(glsl_type::float_type, &z);
+ ir_constant *const zero = new ir_constant(0.0f);
for (unsigned i = 1; i < column_type->vector_elements; i++) {
ir_dereference *const lhs_ref = new ir_dereference_variable(column);
swiz[5 - i], swiz[6 - i],
column_type->vector_elements);
- ir_constant *const idx = new ir_constant(glsl_type::int_type, &i);
+ ir_constant *const idx = new ir_constant(int(i));
ir_dereference *const lhs =
new ir_dereference_array(declarations[16], idx);
*/
for (unsigned i = 0; i < column_type->vector_elements; i++) {
for (unsigned j = 0; j < row_type->vector_elements; j++) {
- ir_constant *row_index = new ir_constant(glsl_type::int_type, &i);
+ ir_constant *row_index = new ir_constant(int(i));
ir_dereference *const row_access =
new ir_dereference_array(declarations[16], row_index);