glsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f
[mesa.git] / src / glsl / hir_field_selection.cpp
index 3c33127b5f88b004ec03996fc7faa50b78abc876..0035a5f81fd972aec13c75aecdce70ca4f11054d 100644 (file)
@@ -61,7 +61,8 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
         _mesa_glsl_error(& loc, state, "Invalid swizzle / mask `%s'",
                          expr->primary_expression.identifier);
       }
-   } else if (op->type->base_type == GLSL_TYPE_STRUCT) {
+   } else if (op->type->base_type == GLSL_TYPE_STRUCT
+              || op->type->base_type == GLSL_TYPE_INTERFACE) {
       result = new(ctx) ir_dereference_record(op,
                                              expr->primary_expression.identifier);
 
@@ -72,8 +73,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
       }
    } else if (expr->subexpressions[1] != NULL) {
       /* Handle "method calls" in GLSL 1.20 - namely, array.length() */
-      if (state->language_version < 120)
-        _mesa_glsl_error(&loc, state, "Methods not supported in GLSL 1.10.");
+      state->check_version(120, 300, &loc, "Methods not supported");
 
       ast_expression *call = expr->subexpressions[1];
       assert(call->oper == ast_function_call);
@@ -98,5 +98,5 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
                       expr->primary_expression.identifier);
    }
 
-   return result ? result : ir_call::get_error_instruction(ctx);
+   return result ? result : ir_rvalue::error_value(ctx);
 }