diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-04-28 17:03:50 -0500 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-04-29 11:39:56 -0500 |
commit | 59af21c3e991d13ffaf79494ea608a67b7d3e7f0 (patch) | |
tree | 9661e86603f90c2b6cfabea3ed7f418ef01b7840 | |
parent | 4055babc7557f788e6c8f3cbb2c62d6161cf6903 (diff) |
tgsi/text: fix parsing of memory instructions
Properly handle Target and Format parameters when present.
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_text.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index c7f1664f91..ea1ee530c5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -1134,23 +1134,37 @@ parse_instruction( cur = ctx->cur; eat_opt_white(&cur); - for (i = 0; inst.Instruction.Memory && *cur == ','; i++) { - uint j; + + for (; inst.Instruction.Memory && *cur == ','; + ctx->cur = cur, eat_opt_white(&cur)) { + int j; + cur++; eat_opt_white(&cur); - ctx->cur = cur; - for (j = 0; j < 3; j++) { - if (str_match_nocase_whole(&ctx->cur, tgsi_memory_names[j])) { - inst.Memory.Qualifier |= 1U << j; - break; - } + + j = str_match_name_from_array(&cur, tgsi_memory_names, + ARRAY_SIZE(tgsi_memory_names)); + if (j >= 0) { + inst.Memory.Qualifier |= 1U << j; + continue; } - if (j == 3) { - report_error(ctx, "Expected memory qualifier"); - return FALSE; + + j = str_match_name_from_array(&cur, tgsi_texture_names, + ARRAY_SIZE(tgsi_texture_names)); + if (j >= 0) { + inst.Memory.Texture = j; + continue; } - cur = ctx->cur; - eat_opt_white(&cur); + + j = str_match_format(&cur); + if (j >= 0) { + inst.Memory.Format = j; + continue; + } + + ctx->cur = cur; + report_error(ctx, "Expected memory qualifier, texture target, or format\n"); + return FALSE; } cur = ctx->cur; |