mojoshader_compiler.c
changeset 1012 04a23c4b0c70
parent 1011 0758e03a79d9
child 1013 b41b88d368b0
--- a/mojoshader_compiler.c	Tue Mar 15 01:45:05 2011 -0700
+++ b/mojoshader_compiler.c	Wed Mar 16 12:46:22 2011 -0700
@@ -5306,6 +5306,9 @@
     //  an irTemp, an irMemory, or an irESeq that results in a temp or memory.
     //  As such, we figure out which it is, and offset appropriately for the
     //  member.
+    const MOJOSHADER_astDataType *dt = reduce_datatype(ctx, ast->datatype);
+    const MOJOSHADER_astDataTypeType type = datatype_base(ctx, dt)->type;
+    const int elems = datatype_elems(ctx, dt);
     MOJOSHADER_irExpression *expr = build_ir_expr(ctx, ast->identifier);
     MOJOSHADER_irExpression *finalexpr = expr;
 
@@ -5321,6 +5324,10 @@
     else
         assert(0 && "Unexpected condition");
 
+    // Replace the struct type with the type of the member.
+    expr->info.type = type;
+    expr->info.elements = elems;
+
     return expr;
 } // build_ir_derefstruct