Skip to content

Commit

Permalink
Merge pull request #16 from steam-test1/BreakCFix
Browse files Browse the repository at this point in the history
Attempt at implementing BreakC
  • Loading branch information
AndresTraks authored Jan 17, 2025
2 parents 9e2aca6 + 8b3a09f commit b98b20e
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Hlsl/HlslSimpleWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,31 @@ private void WriteInstruction(D3D9Instruction instruction)
GetSourceName(instruction, 1), GetSourceName(instruction, 2));
break;
case Opcode.BreakC:
WriteLine("break;");
string ifComparisonBreak;
switch (instruction.Comparison)
{
case IfComparison.GT:
ifComparisonBreak = ">";
break;
case IfComparison.EQ:
ifComparisonBreak = "==";
break;
case IfComparison.GE:
ifComparisonBreak = ">=";
break;
case IfComparison.LE:
ifComparisonBreak = "<=";
break;
case IfComparison.NE:
ifComparisonBreak = "!=";
break;
case IfComparison.LT:
ifComparisonBreak = "<";
break;
default:
throw new InvalidOperationException();
}
WriteLine("if ({0} {2} {1}) break;", GetSourceName(instruction, 0), GetSourceName(instruction, 1), ifComparisonBreak);
break;
case Opcode.Cmp:
// TODO: should be per-component
Expand Down

0 comments on commit b98b20e

Please sign in to comment.