Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed struct dereference reporting wrong type in the IR.
  • Loading branch information
icculus committed Mar 16, 2011
1 parent 04efd0f commit 1fb7836
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mojoshader_compiler.c
Expand Up @@ -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;

Expand All @@ -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

Expand Down

0 comments on commit 1fb7836

Please sign in to comment.