mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
r300g: Fix funky segfault.
This commit is contained in:
parent
01dcadab8b
commit
565f0cef26
2 changed files with 8 additions and 6 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue