From 88df636c870528a24695a23ffeb3768399bcf0af Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 16 Sep 2023 13:49:13 -0300 Subject: [PATCH] Replace ShaderOutputLayer with equivalent ShaderViewportIndexLayerEXT capability (#5683) --- .../CodeGen/Spirv/SpirvGenerator.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs index 44d3e985..0e9e32bb 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs @@ -89,6 +89,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv context.AddCapability(Capability.DrawParameters); } + if (context.Definitions.Stage != ShaderStage.Fragment && + context.Definitions.Stage != ShaderStage.Geometry && + context.Definitions.Stage != ShaderStage.Compute && + (context.Info.IoDefinitions.Contains(new IoDefinition(StorageKind.Output, IoVariable.Layer)) || + context.Info.IoDefinitions.Contains(new IoDefinition(StorageKind.Output, IoVariable.ViewportIndex)))) + { + context.AddExtension("SPV_EXT_shader_viewport_index_layer"); + context.AddCapability(Capability.ShaderViewportIndexLayerEXT); + } + if (context.Info.IoDefinitions.Contains(new IoDefinition(StorageKind.Output, IoVariable.ViewportMask))) { context.AddExtension("SPV_NV_viewport_array2"); @@ -277,14 +287,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv localSizeZ); } - if (context.Definitions.Stage != ShaderStage.Fragment && - context.Definitions.Stage != ShaderStage.Geometry && - context.Definitions.Stage != ShaderStage.Compute && - context.Info.IoDefinitions.Contains(new IoDefinition(StorageKind.Output, IoVariable.Layer))) - { - context.AddCapability(Capability.ShaderLayer); - } - if (context.Definitions.TransformFeedbackEnabled && context.Definitions.LastInVertexPipeline) { context.AddExecutionMode(spvFunc, ExecutionMode.Xfb);