From 1b9377023a56c38b7116d2e0ad19e55d9cc0a055 Mon Sep 17 00:00:00 2001 From: Gabriel A Date: Sat, 27 Jul 2024 21:04:56 -0300 Subject: [PATCH] Fixes --- src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs | 5 ++--- src/Ryujinx.Graphics.Gpu/Shader/ShaderInfoBuilder.cs | 2 +- src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs | 4 ++-- .../Translation/TranslatorContext.cs | 6 +++--- src/Ryujinx.ShaderTools/Program.cs | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index 2ac705df6..4473e8cb3 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -428,15 +428,14 @@ namespace Ryujinx.Graphics.Gpu.Shader TranslatorContext lastInVertexPipeline = geometryToCompute ? translatorContexts[4] ?? currentStage : currentStage; - program = lastInVertexPipeline.GenerateVertexPassthroughForCompute(); + (program, ShaderProgramInfo vacInfo) = lastInVertexPipeline.GenerateVertexPassthroughForCompute(); + infoBuilder.AddStageInfoVac(vacInfo); } else { geometryAsCompute = CreateHostVertexAsComputeProgram(program, currentStage, tfEnabled); program = null; } - - infoBuilder.AddStageInfoVac(currentStage.GetVertexAsComputeInfo()); } if (program != null) diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderInfoBuilder.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderInfoBuilder.cs index 24c698392..e283d0832 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderInfoBuilder.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderInfoBuilder.cs @@ -444,8 +444,8 @@ namespace Ryujinx.Graphics.Gpu.Shader { ShaderInfoBuilder builder = new(context, tfEnabled, vertexAsCompute: true, computeLocalSize: ComputeSize.VtgAsCompute); - builder.AddStageInfo(info, vertexAsCompute: true); builder.AddStageInfoVac(info2); + builder.AddStageInfo(info, vertexAsCompute: true); return builder.Build(null, fromCache); } diff --git a/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs b/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs index 4f0fd4ceb..83e4dc0ac 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs @@ -573,7 +573,7 @@ namespace Ryujinx.Graphics.Shader.Translation return descriptors.ToArray(); } - public ShaderProgramInfo GetVertexAsComputeInfo() + public ShaderProgramInfo GetVertexAsComputeInfo(bool isVertex = false) { var cbDescriptors = new BufferDescriptor[_vacConstantBuffers.Count]; int cbDescriptorIndex = 0; @@ -630,7 +630,7 @@ namespace Ryujinx.Graphics.Shader.Translation sbDescriptors, tDescriptors, iDescriptors, - ShaderStage.Compute, + isVertex ? ShaderStage.Vertex : ShaderStage.Compute, 0, 0, 0, diff --git a/src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs b/src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs index 49116d8a3..5ca17690e 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/TranslatorContext.cs @@ -491,7 +491,7 @@ namespace Ryujinx.Graphics.Shader.Translation _vertexOutput = vertexContext._program.GetIoUsage(); } - public ShaderProgram GenerateVertexPassthroughForCompute() + public (ShaderProgram, ShaderProgramInfo) GenerateVertexPassthroughForCompute() { var attributeUsage = new AttributeUsage(GpuAccessor); var resourceManager = new ResourceManager(ShaderStage.Vertex, GpuAccessor); @@ -571,14 +571,14 @@ namespace Ryujinx.Graphics.Shader.Translation LastInVertexPipeline = true }; - return Generate( + return (Generate( new[] { function }, attributeUsage, definitions, definitions, resourceManager, FeatureFlags.None, - 0); + 0), resourceManager.GetVertexAsComputeInfo(isVertex: true)); } public ShaderProgram GenerateGeometryPassthrough() diff --git a/src/Ryujinx.ShaderTools/Program.cs b/src/Ryujinx.ShaderTools/Program.cs index a84d7b466..564960c6f 100644 --- a/src/Ryujinx.ShaderTools/Program.cs +++ b/src/Ryujinx.ShaderTools/Program.cs @@ -116,7 +116,7 @@ namespace Ryujinx.ShaderTools if (options.VertexPassthrough) { - program = translatorContext.GenerateVertexPassthroughForCompute(); + (program, _) = translatorContext.GenerateVertexPassthroughForCompute(); } else {