struct lp_tgsi_info *info;
unsigned num_imms;
- float imm[128][4];
+ float imm[LP_MAX_TGSI_IMMEDIATES][4];
struct lp_tgsi_channel_info temp[32][4];
};
struct lp_tgsi_info *info)
{
struct tgsi_parse_context parse;
- struct analysis_context ctx;
+ struct analysis_context *ctx;
unsigned index;
unsigned chan;
tgsi_scan_shader(tokens, &info->base);
- memset(&ctx, 0, sizeof ctx);
- ctx.info = info;
+ ctx = CALLOC(1, sizeof(struct analysis_context));
+ ctx->info = info;
tgsi_parse_init(&parse, tokens);
goto finished;
}
- analyse_instruction(&ctx, inst);
+ analyse_instruction(ctx, inst);
}
break;
const unsigned size =
parse.FullToken.FullImmediate.Immediate.NrTokens - 1;
assert(size <= 4);
- if (ctx.num_imms < Elements(ctx.imm)) {
+ if (ctx->num_imms < Elements(ctx->imm)) {
for (chan = 0; chan < size; ++chan) {
float value = parse.FullToken.FullImmediate.u[chan].Float;
- ctx.imm[ctx.num_imms][chan] = value;
+ ctx->imm[ctx->num_imms][chan] = value;
if (value < 0.0f || value > 1.0f) {
info->unclamped_immediates = TRUE;
}
}
- ++ctx.num_imms;
+ ++ctx->num_imms;
}
}
break;
finished:
tgsi_parse_free(&parse);
+ FREE(ctx);
/*