From b34c0a47b4d5d9cc4b3a6b51fbc76fe2b493b07d Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 20 May 2021 15:12:15 -0300 Subject: Fix constant buffer array size when indexing is used and other buffer descriptor and resolution scale regressions (#2298) * Fix constant buffer array size when indexing is used * Change default QueryConstantBufferUse value * Fix more regressions * Ensure proper order --- Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs') diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs index 6e67b682..cb17f18d 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs @@ -262,10 +262,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl string blockName = $"{ubName}_{DefaultNames.BlockSuffix}"; - context.AppendLine($"layout (binding = {descriptors[0].Binding}, std140) uniform {blockName}"); + context.AppendLine($"layout (binding = {context.Config.FirstConstantBufferBinding}, std140) uniform {blockName}"); context.EnterScope(); context.AppendLine("vec4 " + DefaultNames.DataName + ubSize + ";"); - context.LeaveScope($" {ubName}[{NumberFormatter.FormatInt(descriptors.Length)}];"); + context.LeaveScope($" {ubName}[{NumberFormatter.FormatInt(descriptors.Max(x => x.Slot) + 1)}];"); } else { @@ -291,10 +291,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl string blockName = $"{sbName}_{DefaultNames.BlockSuffix}"; - context.AppendLine($"layout (binding = {descriptors[0].Binding}, std430) buffer {blockName}"); + context.AppendLine($"layout (binding = {context.Config.FirstStorageBufferBinding}, std430) buffer {blockName}"); context.EnterScope(); context.AppendLine("uint " + DefaultNames.DataName + "[];"); - context.LeaveScope($" {sbName}[{NumberFormatter.FormatInt(descriptors.Length)}];"); + context.LeaveScope($" {sbName}[{NumberFormatter.FormatInt(descriptors.Max(x => x.Slot) + 1)}];"); } private static void DeclareSamplers(CodeGenContext context, TextureDescriptor[] descriptors) -- cgit v1.2.3