Merge pull request #1369 from yuriks/jmpu-inverted

Shader: Implement "invert condition" feature of IFU instruction
master
bunnei 2016-01-26 09:58:16 +07:00
commit c407b6ce2f
2 changed files with 5 additions and 2 deletions

@ -515,7 +515,8 @@ void RunInterpreter(UnitState<Debug>& state) {
case OpCode::Id::JMPU:
Record<DebugDataRecord::COND_BOOL_IN>(state.debug, iteration, uniforms.b[instr.flow_control.bool_uniform_id]);
if (uniforms.b[instr.flow_control.bool_uniform_id]) {
if (uniforms.b[instr.flow_control.bool_uniform_id] == !(instr.flow_control.num_instructions & 1)) {
state.program_counter = instr.flow_control.dest_offset - 1;
}
break;

@ -710,7 +710,9 @@ void JitCompiler::Compile_JMP(Instruction instr) {
else
UNREACHABLE();
FixupBranch b = J_CC(CC_NZ, true);
bool inverted_condition = (instr.opcode.Value() == OpCode::Id::JMPU) &&
(instr.flow_control.num_instructions & 1);
FixupBranch b = J_CC(inverted_condition ? CC_Z : CC_NZ, true);
Compile_Block(instr.flow_control.dest_offset);