diff options
author | Brian <[email protected]> | 2007-10-02 15:17:37 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-10-02 15:17:37 -0600 |
commit | fe1d15acc7b0ed5d6eb22829f2d8547a36a852a9 (patch) | |
tree | 35446d986960cae665a8e231e29607de3bb8c164 | |
parent | 8955bc34581ac716cf5cabb02fde5260ab3ae207 (diff) |
added micro_trunc(), re-order some code
-rw-r--r-- | src/mesa/pipe/tgsi/exec/tgsi_exec.c | 79 |
1 files changed, 47 insertions, 32 deletions
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c index 5a50bd5aed6..4a42238636f 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -179,6 +179,10 @@ tgsi_exec_machine_init( GLuint i, k; struct tgsi_parse_context parse; +#if 0 + tgsi_dump(tokens, 0); +#endif + mach->Tokens = tokens; mach->Samplers = samplers; @@ -735,6 +739,17 @@ micro_ishr( } static void +micro_trunc( + union tgsi_exec_channel *dst, + const union tgsi_exec_channel *src0 ) +{ + dst->f[0] = (float) (int) src0->u[0]; + dst->f[1] = (float) (int) src0->u[1]; + dst->f[2] = (float) (int) src0->u[2]; + dst->f[3] = (float) (int) src0->u[3]; +} + +static void micro_ushr( union tgsi_exec_channel *dst, const union tgsi_exec_channel *src0, @@ -1995,13 +2010,6 @@ exec_instruction( assert (0); break; - case TGSI_OPCODE_BRK: - /* turn off loop channels for each enabled exec channel */ - mach->LoopMask &= ~mach->ExecMask; - /* Todo: if mach->LoopMask == 0, jump to end of loop */ - UPDATE_EXEC_MASK(mach); - break; - case TGSI_OPCODE_IF: /* push CondMask */ assert(mach->CondStackTop < TGSI_EXEC_MAX_COND_NESTING); @@ -2024,16 +2032,6 @@ exec_instruction( /* Todo: If CondMask==0, jump to ELSE */ break; - case TGSI_OPCODE_LOOP: - /* push LoopMask */ - assert(mach->LoopStackTop < TGSI_EXEC_MAX_LOOP_NESTING); - mach->LoopStack[mach->LoopStackTop++] = mach->LoopMask; - break; - - case TGSI_OPCODE_REP: - assert (0); - break; - case TGSI_OPCODE_ELSE: /* invert CondMask wrt previous mask */ { @@ -2046,11 +2044,6 @@ exec_instruction( } break; - case TGSI_OPCODE_END: - /* halt execution */ - *pc = -1; - break; - case TGSI_OPCODE_ENDIF: /* pop CondMask */ assert(mach->CondStackTop > 0); @@ -2058,6 +2051,15 @@ exec_instruction( UPDATE_EXEC_MASK(mach); break; + case TGSI_OPCODE_END: + /* halt execution */ + *pc = -1; + break; + + case TGSI_OPCODE_REP: + assert (0); + break; + case TGSI_OPCODE_ENDREP: assert (0); break; @@ -2095,8 +2097,11 @@ exec_instruction( break; case TGSI_OPCODE_TRUNC: - /* TGSI_OPCODE_INT */ - assert (0); + FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { + FETCH( &r[0], 0, chan_index ); + micro_trunc( &r[0], &r[0] ); + STORE( &r[0], 0, chan_index ); + } break; case TGSI_OPCODE_SHL: @@ -2160,10 +2165,6 @@ exec_instruction( assert (0); break; - case TGSI_OPCODE_CONT: - assert (0); - break; - case TGSI_OPCODE_EMIT: mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] += 16; mach->Primitives[mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0]]++; @@ -2174,16 +2175,14 @@ exec_instruction( mach->Primitives[mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0]] = 0; break; + case TGSI_OPCODE_LOOP: + /* fall-through (for now) */ case TGSI_OPCODE_BGNLOOP2: /* push LoopMask */ assert(mach->LoopStackTop < TGSI_EXEC_MAX_LOOP_NESTING); mach->LoopStack[mach->LoopStackTop++] = mach->LoopMask; break; - case TGSI_OPCODE_BGNSUB: - /* no-op */ - break; - case TGSI_OPCODE_ENDLOOP: /* fall-through (for now at least) */ case TGSI_OPCODE_ENDLOOP2: @@ -2199,6 +2198,22 @@ exec_instruction( } break; + case TGSI_OPCODE_BRK: + /* turn off loop channels for each enabled exec channel */ + mach->LoopMask &= ~mach->ExecMask; + /* Todo: if mach->LoopMask == 0, jump to end of loop */ + UPDATE_EXEC_MASK(mach); + break; + + case TGSI_OPCODE_CONT: + assert (0); + break; + + + case TGSI_OPCODE_BGNSUB: + /* no-op */ + break; + case TGSI_OPCODE_ENDSUB: assert( 0 ); break; |