Convert structure field dereferences to HIR
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 19 Apr 2010 22:41:23 +0000 (15:41 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 29 Apr 2010 01:22:54 +0000 (18:22 -0700)
hir_field_selection.cpp

index 17c3f5c5ba359b680544f9b04c2ecf09ce2ed071..685cf75dcf033cffd04f8c8d4f9c328e1c463a29 100644 (file)
@@ -62,7 +62,13 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
                          expr->primary_expression.identifier);
       }
    } else if (op->type->base_type == GLSL_TYPE_STRUCT) {
-      /* FINISHME: Handle field selection from structures. */
+      result = new ir_dereference(op, expr->primary_expression.identifier);
+
+      if (result->type->is_error()) {
+        _mesa_glsl_error(& loc, state, "Cannot access field `%s' of "
+                         "structure",
+                         expr->primary_expression.identifier);
+      }
    } else {
       _mesa_glsl_error(& loc, state, "Cannot access field `%s' of "
                       "non-structure / non-vector.",