From 1fb78366d7b995c6546ad8c19bd02dc55bf1a8f6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 16 Mar 2011 12:46:22 -0700 Subject: [PATCH] Fixed struct dereference reporting wrong type in the IR. --- mojoshader_compiler.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mojoshader_compiler.c b/mojoshader_compiler.c index 9d608694..28d89718 100644 --- a/mojoshader_compiler.c +++ b/mojoshader_compiler.c @@ -5306,6 +5306,9 @@ static MOJOSHADER_irExpression *build_ir_derefstruct(Context *ctx, const MOJOSHA // 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 @@ static MOJOSHADER_irExpression *build_ir_derefstruct(Context *ctx, const MOJOSHA 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