mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
added micro_trunc(), re-order some code
This commit is contained in:
parent
8955bc3458
commit
fe1d15acc7
1 changed files with 47 additions and 32 deletions
|
|
@ -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;
|
||||
|
|
@ -734,6 +738,17 @@ micro_ishr(
|
|||
dst->i[3] = src0->i[3] >> src1->i[3];
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue