summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/tgsi
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-10-26 19:31:35 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-10-26 19:31:35 -0600
commitbafbfb4dce7a10fe91c8e0564750e69358ac9461 (patch)
treedb1e3c3ebdaa36456bdff5b5b4d6a5bebde2fe60 /src/mesa/pipe/tgsi
parent19710c95da683097372aa54b7538eaa2de778aa5 (diff)
Fix up handling of immediate values for TGSI shaders.
Still disabled pending LLVM updates.
Diffstat (limited to 'src/mesa/pipe/tgsi')
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_dump.c4
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.c24
-rw-r--r--src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c2
3 files changed, 9 insertions, 21 deletions
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.c b/src/mesa/pipe/tgsi/exec/tgsi_dump.c
index e7eb811d18..f740500dec 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_dump.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_dump.c
@@ -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 );
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
index 66a81b4bd8..f577f004d7 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
@@ -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:
diff --git a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
index 6ce7ab9b71..2c33f26d48 100644
--- a/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
+++ b/src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c
@@ -139,7 +139,7 @@ make_immediate(const float *value, uint size)
{
struct tgsi_full_immediate imm;
imm.Immediate.Type = TGSI_TOKEN_TYPE_IMMEDIATE;
- imm.Immediate.Size = size;
+ imm.Immediate.Size = 1 + size; /* one for the token itself */
imm.Immediate.DataType = TGSI_IMM_FLOAT32;
imm.u.ImmediateFloat32 = (struct tgsi_immediate_float32 *) value;
return imm;