mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-11 12:45:05 +01:00
Shader: Implement "invert condition" feature of IFU instruction
If the bit 0 of the JMPU instruction is set, then the jump condition will be inverted. That is, a jump will happen when the boolean is false instead of when it is true.
This commit is contained in:
parent
0b6cc0592d
commit
083d2d89a5
@ -515,7 +515,8 @@ void RunInterpreter(UnitState<Debug>& state) {
|
|||||||
|
|
||||||
case OpCode::Id::JMPU:
|
case OpCode::Id::JMPU:
|
||||||
Record<DebugDataRecord::COND_BOOL_IN>(state.debug, iteration, uniforms.b[instr.flow_control.bool_uniform_id]);
|
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;
|
state.program_counter = instr.flow_control.dest_offset - 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -710,7 +710,9 @@ void JitCompiler::Compile_JMP(Instruction instr) {
|
|||||||
else
|
else
|
||||||
UNREACHABLE();
|
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);
|
Compile_Block(instr.flow_control.dest_offset);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user