if (this->type->is_error())
return NULL;
+ const glsl_type *return_type = this->type;
ir_constant *op[ARRAY_SIZE(this->operands)] = { NULL, };
ir_constant_data data;
}
}
+ switch (return_type->base_type) {
+ case GLSL_TYPE_FLOAT16:
+ return_type = glsl_type::get_instance(GLSL_TYPE_FLOAT,
+ return_type->vector_elements,
+ return_type->matrix_columns,
+ return_type->explicit_stride,
+ return_type->interface_row_major);
+ break;
+ case GLSL_TYPE_INT16:
+ return_type = glsl_type::get_instance(GLSL_TYPE_INT,
+ return_type->vector_elements,
+ return_type->matrix_columns,
+ return_type->explicit_stride,
+ return_type->interface_row_major);
+ break;
+ case GLSL_TYPE_UINT16:
+ return_type = glsl_type::get_instance(GLSL_TYPE_UINT,
+ return_type->vector_elements,
+ return_type->matrix_columns,
+ return_type->explicit_stride,
+ return_type->interface_row_major);
+ break;
+ default:
+ /* nothing to do */
+ break;
+ }
+
if (op[1] != NULL)
switch (this->operation) {
case ir_binop_lshift:
memcpy(&data, &op[0]->value, sizeof(data));
- switch (this->type->base_type) {
+ switch (return_type->base_type) {
% for dst_type, src_types in op.signatures():
case ${src_types[0].glsl_type}:
data.${dst_type.union_field}[idx] = op[1]->value.${src_types[0].union_field}[0];
# This template is for ir_quadop_vector.
constant_template_vector = mako.template.Template("""\
case ${op.get_enum_name()}:
- for (unsigned c = 0; c < this->type->vector_elements; c++) {
- switch (this->type->base_type) {
+ for (unsigned c = 0; c < return_type->vector_elements; c++) {
+ switch (return_type->base_type) {
% for dst_type, src_types in op.signatures():
case ${src_types[0].glsl_type}:
data.${dst_type.union_field}[c] = op[c]->value.${src_types[0].union_field}[0];
unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1;
for (unsigned c = 0, c2 = 0; c < components; c2 += c2_inc, c++) {
- switch (this->type->base_type) {
+ switch (return_type->base_type) {
% for dst_type, src_types in op.signatures():
case ${src_types[0].glsl_type}:
data.${dst_type.union_field}[c] = ${op.get_c_expression(src_types, ("c", "c", "c2"))};
constant_template_csel = mako.template.Template("""\
case ${op.get_enum_name()}:
for (unsigned c = 0; c < components; c++) {
- switch (this->type->base_type) {
+ switch (return_type->base_type) {
% for dst_type, src_types in op.signatures():
case ${src_types[1].glsl_type}:
data.${dst_type.union_field}[c] = ${op.get_c_expression(src_types)};