}
if (!idx->type->is_error()) {
- if (!idx->type->is_integer()) {
+ if (!idx->type->is_integer_32()) {
_mesa_glsl_error(& idx_loc, state, "array index must be integer type");
} else if (!idx->type->is_scalar()) {
_mesa_glsl_error(& idx_loc, state, "array index must be scalar");
* declared size.
*/
ir_constant *const const_index = idx->constant_expression_value(mem_ctx);
- if (const_index != NULL && idx->type->is_integer()) {
+ if (const_index != NULL && idx->type->is_integer_32()) {
const int idx = const_index->value.i[0];
const char *type_name = "error";
unsigned bound = 0;
return glsl_type::error_type;
}
- if (!type_b->is_integer()) {
+ if (!type_b->is_integer_32()) {
_mesa_glsl_error(loc, state, "RHS of operator %s must be an integer or "
"integer vector", ast_expression::operator_string(op));
return glsl_type::error_type;
return 0;
}
- if (!ir->type->is_integer()) {
+ if (!ir->type->is_integer_32()) {
_mesa_glsl_error(& loc, state,
"array size must be integer type");
return 0;
*/
const glsl_type *const t = type->without_array();
- return (t->is_float() || t->is_integer() || t->contains_opaque()) &&
+ return (t->is_float() || t->is_integer_32() || t->contains_opaque()) &&
!t->is_struct();
}
* scalar integer."
*/
if (!test_expression->type->is_scalar() ||
- !test_expression->type->is_integer()) {
+ !test_expression->type->is_integer_32()) {
YYLTYPE loc = this->test_expression->get_location();
_mesa_glsl_error(& loc,
glsl_type::int_type->can_implicitly_convert_to(glsl_type::uint_type,
state);
- if ((!type_a->is_integer() || !type_b->is_integer()) ||
+ if ((!type_a->is_integer_32() || !type_b->is_integer_32()) ||
!integer_conversion_supported) {
_mesa_glsl_error(&loc, state, "type mismatch with switch "
"init-expression and case label (%s != %s)",
ir_constant *const const_int =
ir->constant_expression_value(ralloc_parent(ir));
- if (const_int == NULL || !const_int->type->is_integer()) {
+ if (const_int == NULL || !const_int->type->is_integer_32()) {
YYLTYPE loc = const_expression->get_location();
_mesa_glsl_error(&loc, state, "%s must be an integral constant "
"expression", qual_indentifier);
ir_constant *const const_int =
ir->constant_expression_value(ralloc_parent(ir));
- if (const_int == NULL || !const_int->type->is_integer()) {
+ if (const_int == NULL || !const_int->type->is_integer_32()) {
_mesa_glsl_error(loc, state, "%s must be an integral constant "
"expression", qual_indentifier);
return false;
bool
ir_constant::is_uint16_constant() const
{
- if (!type->is_integer())
+ if (!type->is_integer_32())
return false;
return value.u[0] < (1 << 16);
ir_constant *const index_c =
da->array_index->constant_expression_value(variable_context);
- if (!index_c || !index_c->type->is_scalar() || !index_c->type->is_integer())
+ if (!index_c || !index_c->type->is_scalar() ||
+ !index_c->type->is_integer_32())
break;
const int index = index_c->type->base_type == GLSL_TYPE_INT ?
abort();
}
- if (!ir->array_index->type->is_integer()) {
+ if (!ir->array_index->type->is_integer_32()) {
printf("ir_dereference_array @ %p does not have integer index: %s\n",
(void *) ir, ir->array_index->type->name);
abort();
case ir_unop_bitfield_reverse:
assert(ir->operands[0]->type == ir->type);
- assert(ir->type->is_integer());
+ assert(ir->type->is_integer_32());
break;
case ir_unop_bit_count:
case ir_unop_find_msb:
case ir_unop_find_lsb:
assert(ir->operands[0]->type->vector_elements == ir->type->vector_elements);
- assert(ir->operands[0]->type->is_integer());
+ assert(ir->operands[0]->type->is_integer_32());
assert(ir->type->base_type == GLSL_TYPE_INT);
break;
case ir_binop_imul_high:
assert(ir->type == ir->operands[0]->type);
assert(ir->type == ir->operands[1]->type);
- assert(ir->type->is_integer());
+ assert(ir->type->is_integer_32());
break;
case ir_binop_carry:
case ir_binop_lshift:
case ir_binop_rshift:
assert(ir->operands[0]->type->is_integer_32_64() &&
- ir->operands[1]->type->is_integer());
+ ir->operands[1]->type->is_integer_32());
if (ir->operands[0]->type->is_scalar()) {
assert(ir->operands[1]->type->is_scalar());
}
case ir_binop_vector_extract:
assert(ir->operands[0]->type->is_vector());
assert(ir->operands[1]->type->is_scalar()
- && ir->operands[1]->type->is_integer());
+ && ir->operands[1]->type->is_integer_32());
break;
case ir_binop_interpolate_at_offset:
break;
case ir_triop_bitfield_extract:
- assert(ir->type->is_integer());
+ assert(ir->type->is_integer_32());
assert(ir->operands[0]->type == ir->type);
assert(ir->operands[1]->type == ir->type);
assert(ir->operands[2]->type == ir->type);
assert(ir->operands[1]->type->is_scalar());
assert(ir->operands[0]->type->base_type == ir->operands[1]->type->base_type);
assert(ir->operands[2]->type->is_scalar()
- && ir->operands[2]->type->is_integer());
+ && ir->operands[2]->type->is_integer_32());
assert(ir->type == ir->operands[0]->type);
break;
case ir_quadop_bitfield_insert:
- assert(ir->type->is_integer());
+ assert(ir->type->is_integer_32());
assert(ir->operands[0]->type == ir->type);
assert(ir->operands[1]->type == ir->type);
assert(ir->operands[2]->type == ir->type);
return -1;
}
- if (!iter->type->is_integer()) {
+ if (!iter->type->is_integer_32()) {
const ir_expression_operation op = iter->type->is_double()
? ir_unop_d2i : ir_unop_f2i;
ir_rvalue *cast =
void
lower_instructions_visitor::int_div_to_mul_rcp(ir_expression *ir)
{
- assert(ir->operands[1]->type->is_integer());
+ assert(ir->operands[1]->type->is_integer_32());
/* Be careful with integer division -- we need to do it as a
* float and re-truncate, since rcp(n > 1) of an integer would
break;
case ir_binop_div:
- if (ir->operands[1]->type->is_integer() && lowering(INT_DIV_TO_MUL_RCP))
+ if (ir->operands[1]->type->is_integer_32() && lowering(INT_DIV_TO_MUL_RCP))
int_div_to_mul_rcp(ir);
else if ((ir->operands[1]->type->is_float() && lowering(FDIV_TO_MUL_RCP)) ||
(ir->operands[1]->type->is_double() && lowering(DDIV_TO_MUL_RCP)))
ir_rvalue *deref = (ir_rvalue *) inst;
assert(deref->type->is_scalar() &&
- (deref->type->is_integer() || deref->type->is_float()));
+ (deref->type->is_integer_32() || deref->type->is_float()));
ir_variable *var = deref->variable_referenced();
assert(var);
ir_rvalue *deref = (ir_rvalue *) inst;
assert(deref->type->is_scalar() &&
- (deref->type->is_integer() || deref->type->is_float()));
+ (deref->type->is_integer_32() || deref->type->is_float()));
ir_variable *var = deref->variable_referenced();
assert(var);
{
unsigned middle = (begin + end) >> 1;
- assert(index->type->is_integer());
+ assert(index->type->is_integer_32());
ir_constant *const middle_c = (index->type->base_type == GLSL_TYPE_UINT)
? new(body.mem_ctx) ir_constant((unsigned)middle)
return false;
/* int and uint can be converted to float. */
- if (desired->is_float() && this->is_integer())
+ if (desired->is_float() && this->is_integer_32())
return true;
/* With GLSL 4.0, ARB_gpu_shader5, or MESA_shader_integer_functions, int
if ((!state || state->has_double()) && desired->is_double()) {
if (this->is_float())
return true;
- if (this->is_integer())
+ if (this->is_integer_32())
return true;
}
}
/**
- * Query whether or not a type is an integral type
+ * Query whether or not a type is an 32-bit integer.
*/
- bool is_integer() const
+ bool is_integer_32() const
{
return (base_type == GLSL_TYPE_UINT) || (base_type == GLSL_TYPE_INT);
}
*/
bool is_integer_32_64() const
{
- return is_integer() || is_integer_64();
+ return is_integer_32() || is_integer_64();
}
/**
break;
case ir_binop_mod:
/* Floating point should be lowered by MOD_TO_FLOOR in the compiler. */
- assert(ir->type->is_integer());
+ assert(ir->type->is_integer_32());
emit(ir, OPCODE_MUL, result_dst, op[0], op[1]);
break;