From e93ca84b14cc325364f1ccc45a6e8622978e959d Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 2 Apr 2020 21:20:47 -0300 Subject: Better IPA shader instruction implementation (#1082) * Fix varying interpolation on fragment shader * Some nits * Alignment --- Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | 11 ++++++++--- Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'Ryujinx.Graphics.Shader/CodeGen') diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index fb58f84a..b1291906 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs @@ -365,11 +365,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl foreach (int attr in info.IAttributes.OrderBy(x => x)) { - string iq = info.InterpolationQualifiers[attr].ToGlslQualifier(); + string iq = string.Empty; - if (iq != string.Empty) + if (context.Config.Stage == ShaderStage.Fragment) { - iq += " "; + iq = context.Config.ImapTypes[attr].GetFirstUsedType() switch + { + PixelImap.Constant => "flat ", + PixelImap.ScreenLinear => "noperspective ", + _ => string.Empty + }; } context.AppendLine($"layout (location = {attr}) {iq}in vec4 {DefaultNames.IAttributePrefix}{attr}{suffix};"); diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs index 2de55b2d..8d092d4e 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs @@ -188,7 +188,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl case AttributeConsts.PositionX: return "gl_FragCoord.x"; case AttributeConsts.PositionY: return "gl_FragCoord.y"; case AttributeConsts.PositionZ: return "gl_FragCoord.z"; - case AttributeConsts.PositionW: return "1.0"; + case AttributeConsts.PositionW: return "gl_FragCoord.w"; } } -- cgit v1.2.3