diff options
author | Brian <[email protected]> | 2007-10-26 12:20:17 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-10-26 13:10:37 -0600 |
commit | 6b30f3888e46c3981f1e4fc34c155c7539275420 (patch) | |
tree | eefd579e38e123270b3b24d91a9d61453ec9cf0a /src/mesa/pipe/tgsi/exec | |
parent | 67e4b8299620db2e2f33795621b23e9827604bb1 (diff) |
Initial support for immediate values in TGSI programs.
These can be evaluated at compile time.
Code disabled pending clarifications of TGSI immediate data structures.
Diffstat (limited to 'src/mesa/pipe/tgsi/exec')
-rw-r--r-- | src/mesa/pipe/tgsi/exec/tgsi_dump.c | 6 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/exec/tgsi_exec.c | 11 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/exec/tgsi_exec.h | 4 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.c b/src/mesa/pipe/tgsi/exec/tgsi_dump.c index 9d21da09657..e7eb811d18c 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_dump.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_dump.c @@ -89,7 +89,7 @@ text_dump_flt( { char str[48]; - sprintf( str, "%40.6f", f ); + sprintf( str, "%10.4f", f ); text_dump_str( dump, str ); } @@ -780,7 +780,11 @@ 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 3f464372ca5..42aed9bd6b1 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -170,6 +170,7 @@ 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 ); @@ -177,6 +178,16 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach ) 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; + } + mach->ImmLimit++; +#endif break; case TGSI_TOKEN_TYPE_INSTRUCTION: diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.h b/src/mesa/pipe/tgsi/exec/tgsi_exec.h index 6c1d3683421..1805e724874 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.h +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.h @@ -93,12 +93,12 @@ struct tgsi_exec_labels #define TGSI_EXEC_NUM_TEMPS (32 + 4) #define TGSI_EXEC_NUM_ADDRS 1 +#define TGSI_EXEC_NUM_IMMEDIATES 256 #define TGSI_EXEC_MAX_COND_NESTING 10 #define TGSI_EXEC_MAX_LOOP_NESTING 10 #define TGSI_EXEC_MAX_CALL_NESTING 10 - /** * Run-time virtual machine state for executing TGSI shader. */ @@ -120,7 +120,7 @@ struct tgsi_exec_machine struct tgsi_sampler *Samplers; - float Imms[256][4]; + float Imms[TGSI_EXEC_NUM_IMMEDIATES][4]; unsigned ImmLimit; float (*Consts)[4]; struct tgsi_exec_vector *Inputs; |