diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-10-01 02:35:52 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-01 02:35:52 -0300 |
commit | 9c2500de5ffa76d74e1761be9e6a1e50b36af7c5 (patch) | |
tree | 5c7f443b4cf5d424df67c5e5abfaaa2a71fa28e7 /Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs | |
parent | dbe43c17199a96e86175c9dd39d6062ce58cefb4 (diff) |
Fix incorrect tessellation inputs/outputs (#3728)1.1.283
* Fix incorrect tessellation inputs/outputs
* Shader cache version bump
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs')
-rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs index dce5e48a..1a4decf5 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs @@ -403,7 +403,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv foreach (int attr in inputs) { - if (!AttributeInfo.Validate(context.Config, attr, isOutAttr: false)) + if (!AttributeInfo.Validate(context.Config, attr, isOutAttr: false, perPatch)) { continue; } @@ -459,7 +459,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv foreach (int attr in outputs) { - if (!AttributeInfo.Validate(context.Config, attr, isOutAttr: true)) + if (!AttributeInfo.Validate(context.Config, attr, isOutAttr: true, perPatch)) { continue; } @@ -519,7 +519,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv ? (isOutAttr ? context.OutputsPerPatch : context.InputsPerPatch) : (isOutAttr ? context.Outputs : context.Inputs); - var attrInfo = AttributeInfo.From(context.Config, attr, isOutAttr); + var attrInfo = perPatch + ? AttributeInfo.FromPatch(context.Config, attr, isOutAttr) + : AttributeInfo.From(context.Config, attr, isOutAttr); if (dict.ContainsKey(attrInfo.BaseValue)) { @@ -544,11 +546,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv var spvType = context.TypePointer(storageClass, attrType); var spvVar = context.Variable(spvType, storageClass); - if (perPatch) - { - context.Decorate(spvVar, Decoration.Patch); - } - if (builtInPassthrough) { context.Decorate(spvVar, Decoration.PassthroughNV); @@ -556,6 +553,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv if (attrInfo.IsBuiltin) { + if (perPatch) + { + context.Decorate(spvVar, Decoration.Patch); + } + context.Decorate(spvVar, Decoration.BuiltIn, (LiteralInteger)GetBuiltIn(context, attrInfo.BaseValue)); if (context.Config.TransformFeedbackEnabled && context.Config.LastInVertexPipeline && isOutAttr) @@ -569,6 +571,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv } } } + else if (perPatch) + { + context.Decorate(spvVar, Decoration.Patch); + + int location = context.Config.GetPerPatchAttributeLocation((attr - AttributeConsts.UserAttributePerPatchBase) / 16); + + context.Decorate(spvVar, Decoration.Location, (LiteralInteger)location); + } else if (isUserAttr) { int location = (attr - AttributeConsts.UserAttributeBase) / 16; |