tgsi: Parse _SAT and _SAT opcode suffix.
authorMichal Krol <michal@tungstengraphics.com>
Sun, 13 Jul 2008 12:50:12 +0000 (14:50 +0200)
committerMichal Krol <michal@tungstengraphics.com>
Sun, 13 Jul 2008 12:50:12 +0000 (14:50 +0200)
src/gallium/auxiliary/tgsi/util/tgsi_dump.c
src/gallium/auxiliary/tgsi/util/tgsi_text.c

index cae74a9..8220e09 100644 (file)
@@ -716,7 +716,7 @@ tgsi_dump_instruction(
       TXT( "_SAT" );
       break;
    case TGSI_SAT_MINUS_PLUS_ONE:
-      TXT( "_SAT[-1,1]" );
+      TXT( "_SATNV" );
       break;
    default:
       assert( 0 );
index d5a9480..f3fc675 100644 (file)
@@ -588,6 +588,7 @@ static const char *texture_names[TGSI_TEXTURE_COUNT] =
 static boolean parse_instruction( struct translate_ctx *ctx )
 {
    uint i;
+   uint saturate = TGSI_SAT_NONE;
    const struct opcode_info *info;
    struct tgsi_full_instruction inst;
    uint advance;
@@ -599,7 +600,11 @@ static boolean parse_instruction( struct translate_ctx *ctx )
       const char *cur = ctx->cur;
 
       if (str_match_no_case( &cur, opcode_info[i].mnemonic )) {
-         /* TODO: _SAT suffix */
+         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 )) {
             ctx->cur = cur;
             break;
@@ -614,6 +619,7 @@ static boolean parse_instruction( struct translate_ctx *ctx )
 
    inst = tgsi_default_full_instruction();
    inst.Instruction.Opcode = i;
+   inst.Instruction.Saturate = saturate;
    inst.Instruction.NumDstRegs = info->num_dst;
    inst.Instruction.NumSrcRegs = info->num_src;