summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/tgsi/tgsi_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_exec.c')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 7ec30fb0e04..d914ef5d6f0 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -4781,7 +4781,7 @@ micro_umsb(union tgsi_exec_channel *dst,
dst->i[3] = util_last_bit(src->u[3]) - 1;
}
-static void
+static bool
exec_instruction(
struct tgsi_exec_machine *mach,
const struct tgsi_full_instruction *inst,
@@ -5100,7 +5100,7 @@ exec_instruction(
mach->CondStackTop = 0;
mach->LoopStackTop = 0;
*pc = -1;
- return;
+ return true;
}
assert(mach->CallStackTop > 0);
@@ -5749,10 +5749,12 @@ exec_instruction(
break;
case TGSI_OPCODE_BARRIER:
case TGSI_OPCODE_MEMBAR:
+ return false;
break;
default:
assert( 0 );
}
+ return true;
}
static void
@@ -5796,13 +5798,16 @@ uint
tgsi_exec_machine_run( struct tgsi_exec_machine *mach, int start_pc )
{
uint i;
- int pc = 0;
- tgsi_exec_machine_setup_masks(mach);
+ mach->pc = start_pc;
+
+ if (!start_pc) {
+ tgsi_exec_machine_setup_masks(mach);
- /* execute declarations (interpolants) */
- for (i = 0; i < mach->NumDeclarations; i++) {
- exec_declaration( mach, mach->Declarations+i );
+ /* execute declarations (interpolants) */
+ for (i = 0; i < mach->NumDeclarations; i++) {
+ exec_declaration( mach, mach->Declarations+i );
+ }
}
{
@@ -5811,24 +5816,29 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach, int start_pc )
struct tgsi_exec_vector outputs[PIPE_MAX_ATTRIBS];
uint inst = 1;
- memset(mach->Temps, 0, sizeof(temps));
- if (mach->Outputs)
- memset(mach->Outputs, 0, sizeof(outputs));
- memset(temps, 0, sizeof(temps));
- memset(outputs, 0, sizeof(outputs));
+ if (!start_pc) {
+ memset(mach->Temps, 0, sizeof(temps));
+ if (mach->Outputs)
+ memset(mach->Outputs, 0, sizeof(outputs));
+ memset(temps, 0, sizeof(temps));
+ memset(outputs, 0, sizeof(outputs));
+ }
#endif
/* execute instructions, until pc is set to -1 */
- while (pc != -1) {
-
+ while (mach->pc != -1) {
+ bool barrier_hit;
#if DEBUG_EXECUTION
uint i;
- tgsi_dump_instruction(&mach->Instructions[pc], inst++);
+ tgsi_dump_instruction(&mach->Instructions[mach->pc], inst++);
#endif
- assert(pc < (int) mach->NumInstructions);
- exec_instruction(mach, mach->Instructions + pc, &pc);
+ assert(mach->pc < (int) mach->NumInstructions);
+ barrier_hit = !exec_instruction(mach, mach->Instructions + mach->pc, &mach->pc);
+
+ if (barrier_hit && mach->ShaderType == PIPE_SHADER_COMPUTE)
+ return 0;
#if DEBUG_EXECUTION
for (i = 0; i < TGSI_EXEC_NUM_TEMPS + TGSI_EXEC_NUM_TEMP_EXTRAS; i++) {