Module: Mesa Branch: mesa_7_7_branch Commit: fb1fe8e76f133b8c9e3713cc7c263a8e63fab40c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb1fe8e76f133b8c9e3713cc7c263a8e63fab40c
Author: Zack Rusin <za...@vmware.com> Date: Fri Feb 5 19:22:45 2010 -0500 gallium/tgsi: fix soa dependencies in mul and cmp instructions master has this done in a lot nicer way, this is a simple patch to stop the bleeding in a minimally intrusive manner. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 57 ++++++++++++++++++++++++-------- 1 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index bd9b986..d91b27a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -336,7 +336,9 @@ tgsi_exec_machine_bind_shader( /* XXX we only handle SOA dependencies properly for MOV/SWZ * at this time! */ - if (opcode != TGSI_OPCODE_MOV) { + if (opcode != TGSI_OPCODE_MOV && + opcode != TGSI_OPCODE_MUL && + opcode != TGSI_OPCODE_CMP) { debug_printf("Warning: SOA dependency in instruction" " is not handled:\n"); tgsi_dump_instruction(&parse.FullToken.FullInstruction, @@ -1852,7 +1854,7 @@ exec_instruction( int *pc ) { uint chan_index; - union tgsi_exec_channel r[10]; + union tgsi_exec_channel r[3 * NUM_CHANNELS]; union tgsi_exec_channel d[8]; (*pc)++; @@ -1980,14 +1982,27 @@ exec_instruction( break; case TGSI_OPCODE_MUL: - FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) - { - FETCH(&r[0], 0, chan_index); - FETCH(&r[1], 1, chan_index); + if (inst->Flags & SOA_DEPENDENCY_FLAG) { + FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) + { + FETCH(&r[chan_index], 0, chan_index); + FETCH(&r[chan_index + NUM_CHANNELS], 1, chan_index); + } + FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) + { + micro_mul( &r[chan_index], &r[chan_index], &r[chan_index + NUM_CHANNELS] ); + STORE(&r[chan_index], 0, chan_index); + } + } else { + FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) + { + FETCH(&r[0], 0, chan_index); + FETCH(&r[1], 1, chan_index); - micro_mul( &r[0], &r[0], &r[1] ); + micro_mul( &r[0], &r[0], &r[1] ); - STORE(&r[0], 0, chan_index); + STORE(&r[0], 0, chan_index); + } } break; @@ -2663,14 +2678,28 @@ exec_instruction( break; case TGSI_OPCODE_CMP: - FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { - FETCH(&r[0], 0, chan_index); - FETCH(&r[1], 1, chan_index); - FETCH(&r[2], 2, chan_index); + if (inst->Flags & SOA_DEPENDENCY_FLAG) { + FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { + FETCH(&r[chan_index], 0, chan_index); + FETCH(&r[chan_index + NUM_CHANNELS], 1, chan_index); + FETCH(&r[chan_index + 2 * NUM_CHANNELS], 2, chan_index); + } + FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { + micro_lt( &r[chan_index], &r[chan_index], + &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[chan_index + NUM_CHANNELS], + &r[chan_index + 2*NUM_CHANNELS] ); + STORE(&r[chan_index], 0, chan_index); + } + } else { + FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { + FETCH(&r[0], 0, chan_index); + FETCH(&r[1], 1, chan_index); + FETCH(&r[2], 2, chan_index); - micro_lt( &r[0], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[1], &r[2] ); + micro_lt( &r[0], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[1], &r[2] ); - STORE(&r[0], 0, chan_index); + STORE(&r[0], 0, chan_index); + } } break; _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit