diff options
author | Michal Krol <[email protected]> | 2008-07-17 20:40:13 +0200 |
---|---|---|
committer | Michal Krol <[email protected]> | 2008-07-17 20:40:13 +0200 |
commit | f2053cfa1ac4e4e2e0083670aac5df766adad5f9 (patch) | |
tree | f6427e323b6567ab5df0b8c4567ee7d26ed42fc5 | |
parent | 10d1dc68a413eaf642bf1bda2e5452835f7b7050 (diff) |
tgsi: Fix parsing an instruction with no operands.
-rw-r--r-- | src/gallium/auxiliary/tgsi/util/tgsi_text.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/tgsi/util/tgsi_text.c b/src/gallium/auxiliary/tgsi/util/tgsi_text.c index 803f7a23b8e..9ed0f52fc7c 100644 --- a/src/gallium/auxiliary/tgsi/util/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/util/tgsi_text.c @@ -758,13 +758,20 @@ parse_instruction( for (i = 0; i < TGSI_OPCODE_LAST; i++) { const char *cur = ctx->cur; - if (str_match_no_case( &cur, opcode_info[i].mnemonic )) { + info = &opcode_info[i]; + if (str_match_no_case( &cur, info->mnemonic )) { if (str_match_no_case( &cur, "_SATNV" )) saturate = TGSI_SAT_MINUS_PLUS_ONE; else if (str_match_no_case( &cur, "_SAT" )) saturate = TGSI_SAT_ZERO_ONE; - if (*cur == '\0' || eat_white( &cur )) { + if (info->num_dst + info->num_src + info->is_tex == 0) { + if (!is_digit_alpha_underscore( cur )) { + ctx->cur = cur; + break; + } + } + else if (*cur == '\0' || eat_white( &cur )) { ctx->cur = cur; break; } @@ -777,7 +784,6 @@ parse_instruction( report_error( ctx, "Expected `DCL', `IMM' or a label" ); return FALSE; } - info = &opcode_info[i]; inst = tgsi_default_full_instruction(); inst.Instruction.Opcode = i; @@ -1031,6 +1037,9 @@ static boolean translate( struct translate_ctx *ctx ) return FALSE; } + if (*ctx->cur == '\0') + break; + if (parse_label( ctx, &label_val )) { if (!parse_instruction( ctx, TRUE )) return FALSE; |