[Mesa-dev] [PATCH 6/6] tgsi/text: fix parsing of memory instructions
Ilia Mirkin
imirkin at alum.mit.edu
Thu Apr 28 22:56:57 UTC 2016
Patches 3-6 are Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
On Thu, Apr 28, 2016 at 6:50 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Properly handle Target and Format parameters when present.
> ---
> src/gallium/auxiliary/tgsi/tgsi_text.c | 40 +++++++++++++++++++++++-----------
> 1 file changed, 27 insertions(+), 13 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
> index a707a6f..14956df 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;
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list