diff options
author | Corbin Simpson <MostAwesomeDude@gmail.com> | 2010-02-01 19:47:46 -0800 |
---|---|---|
committer | Corbin Simpson <MostAwesomeDude@gmail.com> | 2010-02-01 19:48:24 -0800 |
commit | 565f0cef26d6da49ae58462d0c1f9b832ee71174 (patch) | |
tree | 8f7540c39d1bc677c63586a65d2f3b2c94df1c29 /src/gallium/drivers/r300 | |
parent | 01dcadab8b98f0ffa5bf0a859ca94ff78a8cb90a (diff) |
r300g: Fix funky segfault.
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r-- | src/gallium/drivers/r300/r300_tgsi_to_rc.c | 12 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_tgsi_to_rc.h | 2 |
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; }; |