From 619ac86bd03fcafdcae19f8fc5ad7d90780c194b Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 10 Sep 2022 10:20:23 -0300 Subject: Do not output ViewportIndex on SPIR-V if GPU does not support it (#3644) * Do not output ViewportIndex on SPIR-V if GPU does not support it * Bump shader cache version --- Ryujinx.Graphics.Shader/IGpuAccessor.cs | 9 +++++++++ Ryujinx.Graphics.Shader/Translation/AttributeInfo.cs | 5 +++++ 2 files changed, 14 insertions(+) (limited to 'Ryujinx.Graphics.Shader') diff --git a/Ryujinx.Graphics.Shader/IGpuAccessor.cs b/Ryujinx.Graphics.Shader/IGpuAccessor.cs index 7951e71b..2cdc81fb 100644 --- a/Ryujinx.Graphics.Shader/IGpuAccessor.cs +++ b/Ryujinx.Graphics.Shader/IGpuAccessor.cs @@ -267,6 +267,15 @@ namespace Ryujinx.Graphics.Shader return true; } + /// + /// Queries host GPU shader viewport index output support. + /// + /// True if the GPU and driver supports shader viewport index output, false otherwise + bool QueryHostSupportsViewportIndex() + { + return true; + } + /// /// Queries the point size from the GPU state, used when it is not explicitly set on the shader. /// diff --git a/Ryujinx.Graphics.Shader/Translation/AttributeInfo.cs b/Ryujinx.Graphics.Shader/Translation/AttributeInfo.cs index 2a97ee52..6680a332 100644 --- a/Ryujinx.Graphics.Shader/Translation/AttributeInfo.cs +++ b/Ryujinx.Graphics.Shader/Translation/AttributeInfo.cs @@ -78,6 +78,11 @@ namespace Ryujinx.Graphics.Shader.Translation public static bool Validate(ShaderConfig config, int value, bool isOutAttr) { + if (value == AttributeConsts.ViewportIndex && !config.GpuAccessor.QueryHostSupportsViewportIndex()) + { + return false; + } + return From(config, value, isOutAttr).IsValid; } -- cgit v1.2.3