diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen')
4 files changed, 31 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index 2e7f9f1b..5fcc1b27 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs @@ -189,6 +189,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl { case VariableType.Bool: return "bool"; case VariableType.F32: return "precise float"; + case VariableType.F64: return "double"; case VariableType.S32: return "int"; case VariableType.U32: return "uint"; } diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs index 73a71f9e..fe982770 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs @@ -136,6 +136,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions case Instruction.Lod: return InstGenMemory.Lod(context, operation); + case Instruction.PackDouble2x32: + return InstGenPacking.PackDouble2x32(context, operation); + case Instruction.PackHalf2x16: return InstGenPacking.PackHalf2x16(context, operation); @@ -154,6 +157,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions case Instruction.TextureSize: return InstGenMemory.TextureSize(context, operation); + case Instruction.UnpackDouble2x32: + return InstGenPacking.UnpackDouble2x32(context, operation); + case Instruction.UnpackHalf2x16: return InstGenPacking.UnpackHalf2x16(context, operation); } diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs index 8dec3499..15f9b666 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs @@ -50,6 +50,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions Add(Instruction.CompareLessU32, InstType.OpBinary, "<", 4); Add(Instruction.CompareNotEqual, InstType.OpBinaryCom, "!=", 5); Add(Instruction.ConditionalSelect, InstType.OpTernary, "?:", 12); + Add(Instruction.ConvertFP32ToFP64, InstType.CallUnary, "double"); + Add(Instruction.ConvertFP64ToFP32, InstType.CallUnary, "float"); Add(Instruction.ConvertFPToS32, InstType.CallUnary, "int"); Add(Instruction.ConvertFPToU32, InstType.CallUnary, "uint"); Add(Instruction.ConvertS32ToFP, InstType.CallUnary, "float"); @@ -83,6 +85,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions Add(Instruction.LogicalOr, InstType.OpBinaryCom, "||", 11); Add(Instruction.LoopBreak, InstType.OpNullary, "break"); Add(Instruction.LoopContinue, InstType.OpNullary, "continue"); + Add(Instruction.PackDouble2x32, InstType.Special); Add(Instruction.PackHalf2x16, InstType.Special); Add(Instruction.ShiftLeft, InstType.OpBinary, "<<", 3); Add(Instruction.ShiftRightS32, InstType.OpBinary, ">>", 3); @@ -113,6 +116,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions Add(Instruction.TextureSample, InstType.Special); Add(Instruction.TextureSize, InstType.Special); Add(Instruction.Truncate, InstType.CallUnary, "trunc"); + Add(Instruction.UnpackDouble2x32, InstType.Special); Add(Instruction.UnpackHalf2x16, InstType.Special); Add(Instruction.VoteAll, InstType.CallUnary, "allInvocationsARB"); Add(Instruction.VoteAllEqual, InstType.CallUnary, "allInvocationsEqualARB"); diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenPacking.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenPacking.cs index e5167f93..ecb90c1e 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenPacking.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenPacking.cs @@ -7,6 +7,17 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions { static class InstGenPacking { + public static string PackDouble2x32(CodeGenContext context, AstOperation operation) + { + IAstNode src0 = operation.GetSource(0); + IAstNode src1 = operation.GetSource(1); + + string src0Expr = GetSoureExpr(context, src0, GetSrcVarType(operation.Inst, 0)); + string src1Expr = GetSoureExpr(context, src1, GetSrcVarType(operation.Inst, 1)); + + return $"packDouble2x32(uvec2({src0Expr}, {src1Expr}))"; + } + public static string PackHalf2x16(CodeGenContext context, AstOperation operation) { IAstNode src0 = operation.GetSource(0); @@ -18,6 +29,15 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions return $"packHalf2x16(vec2({src0Expr}, {src1Expr}))"; } + public static string UnpackDouble2x32(CodeGenContext context, AstOperation operation) + { + IAstNode src = operation.GetSource(0); + + string srcExpr = GetSoureExpr(context, src, GetSrcVarType(operation.Inst, 0)); + + return $"unpackDouble2x32({srcExpr}){GetMask(operation.Index)}"; + } + public static string UnpackHalf2x16(CodeGenContext context, AstOperation operation) { IAstNode src = operation.GetSource(0); |
