diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-11-18 23:27:54 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-18 23:27:54 -0300 |
commit | 2e43d01d3658d82f98c9eeea8280d8ec122c0c6b (patch) | |
tree | 9d9e33db173a6dfc9e3fa0c05b3421a74f621d14 /Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs | |
parent | 7373ec579226e198d3d7825811eb592489acee1c (diff) |
Move gl_Layer from vertex to geometry if GPU does not support it on vertex (#3866)1.1.364
* Move gl_Layer from vertex to geometry if GPU does not support it on vertex
* Shader cache version bump
* PR feedback
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs')
-rw-r--r-- | Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs index 2f75d248..9f9ac141 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitAttribute.cs @@ -278,13 +278,21 @@ namespace Ryujinx.Graphics.Shader.Instructions private static int FixedFuncToUserAttribute(ShaderConfig config, int attr, bool isOutput) { - if (attr >= AttributeConsts.FrontColorDiffuseR && attr < AttributeConsts.ClipDistance0) + bool supportsLayerFromVertexOrTess = config.GpuAccessor.QueryHostSupportsLayerVertexTessellation(); + int fixedStartAttr = supportsLayerFromVertexOrTess ? 0 : 1; + + if (attr == AttributeConsts.Layer && config.Stage != ShaderStage.Geometry && !supportsLayerFromVertexOrTess) + { + attr = FixedFuncToUserAttribute(config, attr, AttributeConsts.Layer, 0, isOutput); + config.SetLayerOutputAttribute(attr); + } + else if (attr >= AttributeConsts.FrontColorDiffuseR && attr < AttributeConsts.ClipDistance0) { - attr = FixedFuncToUserAttribute(config, attr, AttributeConsts.FrontColorDiffuseR, 0, isOutput); + attr = FixedFuncToUserAttribute(config, attr, AttributeConsts.FrontColorDiffuseR, fixedStartAttr, isOutput); } else if (attr >= AttributeConsts.TexCoordBase && attr < AttributeConsts.TexCoordEnd) { - attr = FixedFuncToUserAttribute(config, attr, AttributeConsts.TexCoordBase, 4, isOutput); + attr = FixedFuncToUserAttribute(config, attr, AttributeConsts.TexCoordBase, fixedStartAttr + 4, isOutput); } return attr; |