Fix up handling of immediate values for TGSI shaders.
authorBrian <brian.paul@tungstengraphics.com>
Sat, 27 Oct 2007 01:31:35 +0000 (19:31 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Sat, 27 Oct 2007 01:31:35 +0000 (19:31 -0600)
Still disabled pending LLVM updates.

src/mesa/pipe/tgsi/exec/tgsi_dump.c
src/mesa/pipe/tgsi/exec/tgsi_exec.c
src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c

index e7eb811d18c685cc50b8ef303cfbd6bbb4da9b4f..f740500dec56d91b6f1377197fe19aaf3dd6e7a4 100644 (file)
@@ -780,11 +780,7 @@ dump_immediate_short(
    ENM( imm->Immediate.DataType, TGSI_IMMS_SHORT );
 
    TXT( " { " );
-#if 0
    for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
-#else
-   for( i = 0; i < imm->Immediate.Size; i++ ) {
-#endif
       switch( imm->Immediate.DataType ) {
       case TGSI_IMM_FLOAT32:
          FLT( imm->u.ImmediateFloat32[i].Float );
index 66a81b4bd83a2fe821979b6a1a508de0fcf1b202..f577f004d71708c72faaffb0b2c01ed98027e546 100644 (file)
@@ -170,24 +170,16 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
          break;
 
       case TGSI_TOKEN_TYPE_IMMEDIATE:
-#if 0
-         assert( (parse.FullToken.FullImmediate.Immediate.Size - 1) % 4 == 0 );
-         assert( mach->ImmLimit + (parse.FullToken.FullImmediate.Immediate.Size - 1) / 4 <= 256 );
+         {
+            uint size = parse.FullToken.FullImmediate.Immediate.Size - 1;
+            assert( size % 4 == 0 );
+            assert( mach->ImmLimit + size / 4 <= 256 );
 
-         for( i = 0; i < parse.FullToken.FullImmediate.Immediate.Size - 1; i++ ) {
-            mach->Imms[mach->ImmLimit + i / 4][i % 4] = parse.FullToken.FullImmediate.u.ImmediateFloat32[i].Float;
-         }
-         mach->ImmLimit += (parse.FullToken.FullImmediate.Immediate.Size - 1) / 4;
-#else
-         /* Add this immediate value (vector of 1,2,3,4 floats) to immediates array */
-         assert( parse.FullToken.FullImmediate.Immediate.Size <= 4 );
-         assert( mach->ImmLimit < TGSI_EXEC_NUM_IMMEDIATES );
-
-         for( i = 0; i < parse.FullToken.FullImmediate.Immediate.Size; i++ ) {
-            mach->Imms[mach->ImmLimit][i] = parse.FullToken.FullImmediate.u.ImmediateFloat32[i].Float;
+            for( i = 0; i < size; i++ ) {
+               mach->Imms[mach->ImmLimit + i / 4][i % 4] = parse.FullToken.FullImmediate.u.ImmediateFloat32[i].Float;
+            }
+            mach->ImmLimit += size / 4;
          }
-         mach->ImmLimit++;
-#endif
          break;
 
       case TGSI_TOKEN_TYPE_INSTRUCTION:
index 6ce7ab9b71cb9ce9b3d42f366869215cb3195d61..2c33f26d4803512b64d7d92d0d0422012dc89abe 100644 (file)
@@ -139,7 +139,7 @@ make_immediate(const float *value, uint size)
 {\r
    struct tgsi_full_immediate imm;\r
    imm.Immediate.Type = TGSI_TOKEN_TYPE_IMMEDIATE;\r
-   imm.Immediate.Size = size;\r
+   imm.Immediate.Size = 1 + size; /* one for the token itself */\r
    imm.Immediate.DataType = TGSI_IMM_FLOAT32;\r
    imm.u.ImmediateFloat32 = (struct tgsi_immediate_float32 *) value;\r
    return imm;\r