From c60e009a9138a573d2219ee2ad85e3203b09a7ae Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 15 Jul 2008 10:56:30 +0200 Subject: tgsi: Numerical label before an instruction is optional. --- src/gallium/auxiliary/tgsi/util/tgsi_text.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_text.c b/src/gallium/auxiliary/tgsi/util/tgsi_text.c index 1b283feb4c..6cab475b88 100644 --- a/src/gallium/auxiliary/tgsi/util/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/util/tgsi_text.c @@ -740,7 +740,10 @@ static const char *texture_names[TGSI_TEXTURE_COUNT] = "SHADOWRECT" }; -static boolean parse_instruction( struct translate_ctx *ctx ) +static boolean +parse_instruction( + struct translate_ctx *ctx, + boolean has_label ) { uint i; uint saturate = TGSI_SAT_NONE; @@ -767,7 +770,10 @@ static boolean parse_instruction( struct translate_ctx *ctx ) } } if (i == TGSI_OPCODE_LAST) { - report_error( ctx, "Unknown opcode" ); + if (has_label) + report_error( ctx, "Unknown opcode" ); + else + report_error( ctx, "Expected `DCL', `IMM' or a label" ); return FALSE; } info = &opcode_info[i]; @@ -1025,7 +1031,7 @@ static boolean translate( struct translate_ctx *ctx ) } if (parse_label( ctx, &label_val )) { - if (!parse_instruction( ctx )) + if (!parse_instruction( ctx, TRUE )) return FALSE; } else if (str_match_no_case( &ctx->cur, "DCL" )) { @@ -1036,8 +1042,7 @@ static boolean translate( struct translate_ctx *ctx ) if (!parse_immediate( ctx )) return FALSE; } - else { - report_error( ctx, "Expected `DCL', `IMM' or a label" ); + else if (!parse_instruction( ctx, FALSE )) { return FALSE; } } -- cgit v1.2.3