*/
glsl_base_type param_base_type = first_param->type->base_type;
assert(param_base_type == GLSL_TYPE_FLOAT ||
- param_base_type == GLSL_TYPE_DOUBLE);
+ first_param->type->is_double());
ir_variable *rhs_var =
new(ctx) ir_variable(glsl_type::get_instance(param_base_type, 4, 1),
"mat_ctor_vec",
*/
assert(type_a->is_matrix() || type_b->is_matrix());
assert(type_a->base_type == GLSL_TYPE_FLOAT ||
- type_a->base_type == GLSL_TYPE_DOUBLE);
+ type_a->is_double());
assert(type_b->base_type == GLSL_TYPE_FLOAT ||
- type_b->base_type == GLSL_TYPE_DOUBLE);
+ type_b->is_double());
/* "* The operator is add (+), subtract (-), or divide (/), and the
* operands are matrices with the same number of rows and the same
if (state->is_version(120, 300))
break;
case GLSL_TYPE_DOUBLE:
- if (check_type->base_type == GLSL_TYPE_DOUBLE && (state->is_version(410, 0) || state->ARB_vertex_attrib_64bit_enable))
+ if (check_type->is_double() && (state->is_version(410, 0) || state->ARB_vertex_attrib_64bit_enable))
break;
/* FALLTHROUGH */
default:
return new(mem_ctx) ir_constant(type, &data);
}
-#define IMM_FP(type, val) (type->base_type == GLSL_TYPE_DOUBLE) ? imm(val) : imm((float)val)
+#define IMM_FP(type, val) (type->is_double()) ? imm(val) : imm((float)val)
ir_dereference_variable *
builtin_builder::var_ref(ir_variable *var)
ir_variable *t = body.make_temp(x_type, "t");
if (x_type->vector_elements == 1) {
/* Both are floats */
- if (edge_type->base_type == GLSL_TYPE_DOUBLE)
+ if (edge_type->is_double())
body.emit(assign(t, f2d(b2f(gequal(x, edge)))));
else
body.emit(assign(t, b2f(gequal(x, edge))));
} else if (edge_type->vector_elements == 1) {
/* x is a vector but edge is a float */
for (int i = 0; i < x_type->vector_elements; i++) {
- if (edge_type->base_type == GLSL_TYPE_DOUBLE)
+ if (edge_type->is_double())
body.emit(assign(t, f2d(b2f(gequal(swizzle(x, i, 1), edge))), 1 << i));
else
body.emit(assign(t, b2f(gequal(swizzle(x, i, 1), edge)), 1 << i));
} else {
/* Both are vectors */
for (int i = 0; i < x_type->vector_elements; i++) {
- if (edge_type->base_type == GLSL_TYPE_DOUBLE)
+ if (edge_type->is_double())
body.emit(assign(t, f2d(b2f(gequal(swizzle(x, i, 1), swizzle(edge, i, 1)))),
1 << i));
else
ir_variable *c;
ir_variable *r;
- if (type->base_type == GLSL_TYPE_DOUBLE) {
+ if (type->is_double()) {
r = in_var(glsl_type::dvec(type->matrix_columns), "r");
c = in_var(glsl_type::dvec(type->vector_elements), "c");
} else {
ir_function_signature *
builtin_builder::_ldexp(const glsl_type *x_type, const glsl_type *exp_type)
{
- return binop(x_type->base_type == GLSL_TYPE_DOUBLE ? fp64 : gpu_shader5_or_es31_or_integer_functions,
+ return binop(x_type->is_double() ? fp64 : gpu_shader5_or_es31_or_integer_functions,
ir_binop_ldexp, x_type, x_type, exp_type);
}
if (type->is_matrix()) {
/* Matrix - fill diagonal (rest is already set to 0) */
assert(type->base_type == GLSL_TYPE_FLOAT ||
- type->base_type == GLSL_TYPE_DOUBLE);
+ type->is_double());
for (unsigned i = 0; i < type->matrix_columns; i++) {
if (type->base_type == GLSL_TYPE_FLOAT)
this->value.f[i * type->vector_elements + i] =
return false;
for (unsigned i = 0; i < type->components(); i++) {
- if (type->base_type == GLSL_TYPE_DOUBLE) {
+ if (type->is_double()) {
if (value.d[i] != other->value.d[i])
return false;
} else {
for (unsigned j = 0; j < p; j++) {
for (unsigned i = 0; i < n; i++) {
for (unsigned k = 0; k < m; k++) {
- if (op[0]->type->base_type == GLSL_TYPE_DOUBLE)
+ if (op[0]->type->is_double())
data.d[i+n*j] += op[0]->value.d[i+n*k]*op[1]->value.d[k+m*j];
else
data.f[i+n*j] += op[0]->value.f[i+n*k]*op[1]->value.f[k+m*j];
constant_template_lrp = mako.template.Template("""\
case ${op.get_enum_name()}: {
assert(op[0]->type->base_type == GLSL_TYPE_FLOAT ||
- op[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ op[0]->type->is_double());
assert(op[1]->type->base_type == GLSL_TYPE_FLOAT ||
- op[1]->type->base_type == GLSL_TYPE_DOUBLE);
+ op[1]->type->is_double());
assert(op[2]->type->base_type == GLSL_TYPE_FLOAT ||
- op[2]->type->base_type == GLSL_TYPE_DOUBLE);
+ op[2]->type->is_double());
unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1;
for (unsigned c = 0, c2 = 0; c < components; c2 += c2_inc, c++) {
if (from_type == to_type)
return PARAMETER_EXACT_MATCH;
- if (to_type->base_type == GLSL_TYPE_DOUBLE) {
+ if (to_type->is_double()) {
if (from_type->base_type == GLSL_TYPE_FLOAT)
return PARAMETER_FLOAT_TO_DOUBLE;
return PARAMETER_INT_TO_DOUBLE;
case ir_unop_sign:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT ||
ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT ||
- ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE ||
+ ir->operands[0]->type->is_double() ||
ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
assert(ir->type == ir->operands[0]->type);
break;
case ir_unop_rsq:
case ir_unop_sqrt:
assert(ir->type->base_type == GLSL_TYPE_FLOAT ||
- ir->type->base_type == GLSL_TYPE_DOUBLE);
+ ir->type->is_double());
assert(ir->type == ir->operands[0]->type);
break;
case ir_unop_bitcast_u642d:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64);
- assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->type->is_double());
break;
case ir_unop_bitcast_i642d:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
- assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->type->is_double());
break;
case ir_unop_bitcast_d2u64:
- assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->operands[0]->type->is_double());
assert(ir->type->base_type == GLSL_TYPE_UINT64);
break;
case ir_unop_bitcast_d2i64:
- assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->operands[0]->type->is_double());
assert(ir->type->base_type == GLSL_TYPE_INT64);
break;
case ir_unop_i642i:
break;
case ir_unop_i642d:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
- assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->type->is_double());
break;
case ir_unop_u642d:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64);
- assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->type->is_double());
break;
case ir_unop_i2i64:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
assert(ir->type->base_type == GLSL_TYPE_INT64);
break;
case ir_unop_d2i64:
- assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->operands[0]->type->is_double());
assert(ir->type->base_type == GLSL_TYPE_INT64);
break;
case ir_unop_i2u64:
assert(ir->type->base_type == GLSL_TYPE_UINT64);
break;
case ir_unop_d2u64:
- assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->operands[0]->type->is_double());
assert(ir->type->base_type == GLSL_TYPE_UINT64);
break;
case ir_unop_u642i64:
case ir_unop_floor:
case ir_unop_fract:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT ||
- ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ ir->operands[0]->type->is_double());
assert(ir->operands[0]->type == ir->type);
break;
case ir_unop_sin:
break;
case ir_unop_d2f:
- assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->operands[0]->type->is_double());
assert(ir->type->base_type == GLSL_TYPE_FLOAT);
break;
case ir_unop_f2d:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
- assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->type->is_double());
break;
case ir_unop_d2i:
- assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->operands[0]->type->is_double());
assert(ir->type->base_type == GLSL_TYPE_INT);
break;
case ir_unop_i2d:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
- assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->type->is_double());
break;
case ir_unop_d2u:
- assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->operands[0]->type->is_double());
assert(ir->type->base_type == GLSL_TYPE_UINT);
break;
case ir_unop_u2d:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
- assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->type->is_double());
break;
case ir_unop_d2b:
- assert(ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ assert(ir->operands[0]->type->is_double());
assert(ir->type->is_boolean());
break;
case ir_unop_frexp_sig:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT ||
- ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
- assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
+ ir->operands[0]->type->is_double());
+ assert(ir->type->is_double());
break;
case ir_unop_frexp_exp:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT ||
- ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ ir->operands[0]->type->is_double());
assert(ir->type->base_type == GLSL_TYPE_INT);
break;
case ir_unop_subroutine_to_int:
assert(ir->type == glsl_type::float_type ||
ir->type == glsl_type::double_type);
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT ||
- ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ ir->operands[0]->type->is_double());
assert(ir->operands[0]->type->is_vector());
assert(ir->operands[0]->type == ir->operands[1]->type);
break;
case ir_triop_fma:
assert(ir->type->base_type == GLSL_TYPE_FLOAT ||
- ir->type->base_type == GLSL_TYPE_DOUBLE);
+ ir->type->is_double());
assert(ir->type == ir->operands[0]->type);
assert(ir->type == ir->operands[1]->type);
assert(ir->type == ir->operands[2]->type);
case ir_triop_lrp:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT ||
- ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE);
+ ir->operands[0]->type->is_double());
assert(ir->operands[0]->type == ir->operands[1]->type);
assert(ir->operands[2]->type == ir->operands[0]->type ||
ir->operands[2]->type == glsl_type::float_type ||
if (type->without_array()->is_matrix()) {
const glsl_type *matrix = type->without_array();
- const unsigned N = matrix->base_type == GLSL_TYPE_DOUBLE ? 8 : 4;
+ const unsigned N = matrix->is_double() ? 8 : 4;
const unsigned items =
row_major ? matrix->matrix_columns : matrix->vector_elements;
* gather the vector from each stored row.
*/
assert(deref->type->base_type == GLSL_TYPE_FLOAT ||
- deref->type->base_type == GLSL_TYPE_DOUBLE);
+ deref->type->is_double());
/* Matrices, row_major or not, are stored as if they were
* arrays of vectors of the appropriate size in std140.
* Arrays have their strides rounded up to a vec4, so the
case ir_binop_div:
if (is_vec_one(op_const[0]) && (
ir->type->base_type == GLSL_TYPE_FLOAT ||
- ir->type->base_type == GLSL_TYPE_DOUBLE)) {
+ ir->type->is_double())) {
return new(mem_ctx) ir_expression(ir_unop_rcp,
ir->operands[1]->type,
ir->operands[1],
break;
case ir_binop_ldexp:
- if (ir->operands[0]->type->base_type == GLSL_TYPE_DOUBLE) {
+ if (ir->operands[0]->type->is_double()) {
emit_asm(ir, TGSI_OPCODE_DLDEXP, result_dst, op[0], op[1]);
} else {
assert(!"Invalid ldexp for non-double opcode in glsl_to_tgsi_visitor::visit()");