From cb171f6ebfa7e1aa5721503d1c1115719957932d Mon Sep 17 00:00:00 2001 From: gdkchan Date: Fri, 6 Dec 2019 19:37:00 -0300 Subject: Support shared color mask, implement more shader instructions Support shared color masks (used by Nouveau and maybe the NVIDIA driver). Support draw buffers (also required by OpenGL). Support viewport transform disable (disabled for now as it breaks some games). Fix instanced rendering draw being ignored for multi draw. Fix IADD and IADD3 immediate shader encodings, that was not matching some ops. Implement FFMA32I shader instruction. Implement IMAD shader instruction. --- Ryujinx.Graphics.Shader/Translation/Translator.cs | 34 ++++++++++------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'Ryujinx.Graphics.Shader/Translation/Translator.cs') diff --git a/Ryujinx.Graphics.Shader/Translation/Translator.cs b/Ryujinx.Graphics.Shader/Translation/Translator.cs index b129be93..69e63ae1 100644 --- a/Ryujinx.Graphics.Shader/Translation/Translator.cs +++ b/Ryujinx.Graphics.Shader/Translation/Translator.cs @@ -49,15 +49,9 @@ namespace Ryujinx.Graphics.Shader.Translation public static ShaderProgram Translate(Span code, ShaderCapabilities capabilities, TranslationFlags flags) { - bool compute = (flags & TranslationFlags.Compute) != 0; - bool debugMode = (flags & TranslationFlags.DebugMode) != 0; + bool compute = (flags & TranslationFlags.Compute) != 0; - Operation[] ops = DecodeShader( - code, - compute, - debugMode, - out ShaderHeader header, - out int size); + Operation[] ops = DecodeShader(code, capabilities, flags, out ShaderHeader header, out int size); ShaderStage stage; @@ -94,8 +88,8 @@ namespace Ryujinx.Graphics.Shader.Translation { bool debugMode = (flags & TranslationFlags.DebugMode) != 0; - Operation[] vpAOps = DecodeShader(vpACode, compute: false, debugMode, out _, out _); - Operation[] vpBOps = DecodeShader(vpBCode, compute: false, debugMode, out ShaderHeader header, out int sizeB); + Operation[] vpAOps = DecodeShader(vpACode, capabilities, flags, out _, out _); + Operation[] vpBOps = DecodeShader(vpBCode, capabilities, flags, out ShaderHeader header, out int sizeB); ShaderConfig config = new ShaderConfig( header.Stage, @@ -142,23 +136,23 @@ namespace Ryujinx.Graphics.Shader.Translation } private static Operation[] DecodeShader( - Span code, - bool compute, - bool debugMode, - out ShaderHeader header, - out int size) + Span code, + ShaderCapabilities capabilities, + TranslationFlags flags, + out ShaderHeader header, + out int size) { Block[] cfg; EmitterContext context; - if (compute) + if ((flags & TranslationFlags.Compute) != 0) { header = null; cfg = Decoder.Decode(code, 0); - context = new EmitterContext(ShaderStage.Compute, header); + context = new EmitterContext(ShaderStage.Compute, header, capabilities, flags); } else { @@ -166,7 +160,7 @@ namespace Ryujinx.Graphics.Shader.Translation cfg = Decoder.Decode(code, HeaderSize); - context = new EmitterContext(header.Stage, header); + context = new EmitterContext(header.Stage, header, capabilities, flags); } if (cfg == null) @@ -197,7 +191,7 @@ namespace Ryujinx.Graphics.Shader.Translation { OpCode op = block.OpCodes[opIndex]; - if (debugMode) + if ((flags & TranslationFlags.DebugMode) != 0) { string instName; @@ -274,7 +268,7 @@ namespace Ryujinx.Graphics.Shader.Translation } } - size = (int)maxEndAddress + (compute ? 0 : HeaderSize); + size = (int)maxEndAddress + (((flags & TranslationFlags.Compute) != 0) ? 0 : HeaderSize); return context.GetOperations(); } -- cgit v1.2.3