summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/r300/r300_tgsi_to_rc.c12
-rw-r--r--src/gallium/drivers/r300/r300_tgsi_to_rc.h2
2 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c
index 6b2bc78799..941ec17016 100644
--- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c
+++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c
@@ -317,11 +317,8 @@ static void handle_immediate(struct tgsi_to_rc * ttr,
}
if (can_swizzle) {
- struct swizzled_imms* si =
- &ttr->imms_to_swizzle[ttr->imms_to_swizzle_count];
-
- si->index = index;
- si->swizzle = swizzle;
+ ttr->imms_to_swizzle[ttr->imms_to_swizzle_count].index = index;
+ ttr->imms_to_swizzle[ttr->imms_to_swizzle_count].swizzle = swizzle;
ttr->imms_to_swizzle_count++;
} else {
constant.Type = RC_CONSTANT_IMMEDIATE;
@@ -352,6 +349,9 @@ void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens)
ttr->immediate_offset = ttr->compiler->Program.Constants.Count;
+ ttr->imms_to_swizzle = malloc(ttr->info->immediate_count * sizeof(struct swizzled_imms));
+ ttr->imms_to_swizzle_count = 0;
+
tgsi_parse_init(&parser, tokens);
while (!tgsi_parse_end_of_tokens(&parser)) {
@@ -372,6 +372,8 @@ void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens)
tgsi_parse_free(&parser);
+ free(ttr->imms_to_swizzle);
+
rc_calculate_inputs_outputs(ttr->compiler);
}
diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.h b/src/gallium/drivers/r300/r300_tgsi_to_rc.h
index f1e66f46bb..39b473c7bf 100644
--- a/src/gallium/drivers/r300/r300_tgsi_to_rc.h
+++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.h
@@ -39,7 +39,7 @@ struct tgsi_to_rc {
const struct tgsi_shader_info * info;
int immediate_offset;
- struct swizzled_imms imms_to_swizzle[10];
+ struct swizzled_imms * imms_to_swizzle;
unsigned imms_to_swizzle_count;
};