Esempio n. 1
0
        private void GenInst2(ShaderProgram Program, uint InstOp)
        {
            ShaderOpCode OpCode = (ShaderOpCode)(InstOp >> 26);

            ShaderInst2 Inst = new ShaderInst2(InstOp);

            switch (OpCode)
            {
            case ShaderOpCode.BreakC: GenBreakC(Program, Inst); break;

            case ShaderOpCode.Call:   GenCall(Program, Inst); break;

            case ShaderOpCode.CallC:  GenCallC(Program, Inst); break;

            case ShaderOpCode.IfC:    GenIfC(Program, Inst); break;

            case ShaderOpCode.JmpC:   GenJmpC(Program, Inst); break;
            }
        }
Esempio n. 2
0
        private static string GetCond(ShaderInst2 Inst)
        {
            string RefX = Inst.RefX ? string.Empty : "!";
            string RefY = Inst.RefY ? string.Empty : "!";

            string Cond = string.Empty;

            switch (Inst.CondOp)
            {
            case 0: Cond = $"{RefX}{CmpRegName}.x || {RefY}{CmpRegName}.y"; break;

            case 1: Cond = $"{RefX}{CmpRegName}.x && {RefY}{CmpRegName}.y"; break;

            case 2: Cond = $"{RefX}{CmpRegName}.x";                         break;

            case 3: Cond = $"{RefY}{CmpRegName}.y";                         break;
            }

            return(Cond);
        }
Esempio n. 3
0
 private void GenJmpC(ShaderProgram Program, ShaderInst2 Inst)
 {
     GenJmp(Program, GetCond(Inst), Inst.Dest);
 }
Esempio n. 4
0
 private void GenIfC(ShaderProgram Program, ShaderInst2 Inst)
 {
     GenIf(Program, GetCond(Inst), Inst.Dest, Inst.Count);
 }
Esempio n. 5
0
 private void GenCallC(ShaderProgram Program, ShaderInst2 Inst)
 {
     Append($"if ({GetCond(Inst)}) {GetCall(Program, Inst.Dest, Inst.Count)}");
 }
Esempio n. 6
0
 private void GenCall(ShaderProgram Program, ShaderInst2 Inst)
 {
     Append(GetCall(Program, Inst.Dest, Inst.Count));
 }
Esempio n. 7
0
 private void GenBreakC(ShaderProgram Program, ShaderInst2 Inst)
 {
     Append($"if ({GetCond(Inst)}) break;");
 }