From bafbfb4dce7a10fe91c8e0564750e69358ac9461 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 26 Oct 2007 19:31:35 -0600 Subject: Fix up handling of immediate values for TGSI shaders. Still disabled pending LLVM updates. --- src/mesa/pipe/tgsi/exec/tgsi_dump.c | 4 ---- src/mesa/pipe/tgsi/exec/tgsi_exec.c | 24 ++++++++---------------- src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c | 2 +- 3 files changed, 9 insertions(+), 21 deletions(-) (limited to 'src/mesa/pipe/tgsi') diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.c b/src/mesa/pipe/tgsi/exec/tgsi_dump.c index e7eb811d18c..f740500dec5 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 66a81b4bd83..f577f004d71 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 6ce7ab9b71c..2c33f26d480 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; -- cgit v1.2.3