From 17a1cab5d29787f3b41f40a69b530dae4e3cb25f Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 4 Dec 2022 15:36:03 -0300 Subject: Allow SNorm buffer texture formats on Vulkan (#3957) * Allow SNorm buffer texture formats on Vulkan * Shader cache version bump --- Ryujinx.Graphics.Shader/IGpuAccessor.cs | 9 +++++++++ Ryujinx.Graphics.Shader/Translation/Rewriter.cs | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'Ryujinx.Graphics.Shader') diff --git a/Ryujinx.Graphics.Shader/IGpuAccessor.cs b/Ryujinx.Graphics.Shader/IGpuAccessor.cs index cc690eed..337bd314 100644 --- a/Ryujinx.Graphics.Shader/IGpuAccessor.cs +++ b/Ryujinx.Graphics.Shader/IGpuAccessor.cs @@ -285,6 +285,15 @@ namespace Ryujinx.Graphics.Shader return true; } + /// + /// Queries host GPU support for signed normalized buffer texture formats. + /// + /// True if the GPU and driver supports the formats, false otherwise + bool QueryHostSupportsSnormBufferTextureFormat() + { + return true; + } + /// /// Queries host GPU texture shadow LOD support. /// diff --git a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs index 640717f9..bdd9b791 100644 --- a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs +++ b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs @@ -14,6 +14,7 @@ namespace Ryujinx.Graphics.Shader.Translation { bool isVertexShader = config.Stage == ShaderStage.Vertex; bool hasConstantBufferDrawParameters = config.GpuAccessor.QueryHasConstantBufferDrawParameters(); + bool supportsSnormBufferTextureFormat = config.GpuAccessor.QueryHostSupportsSnormBufferTextureFormat(); for (int blkIndex = 0; blkIndex < blocks.Length; blkIndex++) { @@ -52,7 +53,7 @@ namespace Ryujinx.Graphics.Shader.Translation { node = RewriteTextureSample(node, config); - if (texOp.Type == SamplerType.TextureBuffer) + if (texOp.Type == SamplerType.TextureBuffer && !supportsSnormBufferTextureFormat) { node = InsertSnormNormalization(node, config); } -- cgit v1.2.3