diff options
| author | riperiperi <rhy3756547@hotmail.com> | 2021-05-19 19:05:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-19 20:05:43 +0200 |
| commit | 0129250c2e169c7386f7e2868cc055f8ec55c005 (patch) | |
| tree | d63a3239dc405de892edee7829905bc5e6b7038c /Ryujinx.Graphics.Shader/Translation | |
| parent | c805542b29975b0d9bf3ea324526f62cfe4331bf (diff) | |
Pass CbufSlot when getting info from the texture descriptor (#2291)
* Pass CbufSlot when getting info from the texture descriptor
Fixes some issues with bindless textures, when CbufSlot is not equal to the current TextureBufferIndex.
Specifically fixes a random chance of full screen colour flickering in Super Mario Party.
* Apply suggestions from code review
Oops
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Diffstat (limited to 'Ryujinx.Graphics.Shader/Translation')
3 files changed, 5 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs b/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs index f462cedb..f91a00eb 100644 --- a/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs +++ b/Ryujinx.Graphics.Shader/Translation/Optimizations/BindlessElimination.cs @@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations if (src0.Type == OperandType.ConstantBuffer) { texOp.SetHandle(src0.GetCbufOffset(), src0.GetCbufSlot()); - texOp.Format = config.GetTextureFormat(texOp.Handle); + texOp.Format = config.GetTextureFormat(texOp.Handle, texOp.CbufSlot); } } } diff --git a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs index a928f935..5427c013 100644 --- a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs +++ b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs @@ -142,7 +142,7 @@ namespace Ryujinx.Graphics.Shader.Translation bool hasInvalidOffset = (hasOffset || hasOffsets) && !config.GpuAccessor.QuerySupportsNonConstantTextureOffset(); - bool isRect = config.GpuAccessor.QueryIsTextureRectangle(texOp.Handle); + bool isRect = config.GpuAccessor.QueryIsTextureRectangle(texOp.Handle, texOp.CbufSlot); if (!(hasInvalidOffset || isRect)) { @@ -433,7 +433,7 @@ namespace Ryujinx.Graphics.Shader.Translation { TextureOperation texOp = (TextureOperation)node.Value; - TextureFormat format = config.GpuAccessor.QueryTextureFormat(texOp.Handle); + TextureFormat format = config.GpuAccessor.QueryTextureFormat(texOp.Handle, texOp.CbufSlot); int maxPositive = format switch { diff --git a/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs b/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs index c71a8398..077ce70d 100644 --- a/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs +++ b/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs @@ -91,7 +91,7 @@ namespace Ryujinx.Graphics.Shader.Translation return count + 1; } - public TextureFormat GetTextureFormat(int handle) + public TextureFormat GetTextureFormat(int handle, int cbufSlot = -1) { // When the formatted load extension is supported, we don't need to // specify a format, we can just declare it without a format and the GPU will handle it. @@ -100,7 +100,7 @@ namespace Ryujinx.Graphics.Shader.Translation return TextureFormat.Unknown; } - var format = GpuAccessor.QueryTextureFormat(handle); + var format = GpuAccessor.QueryTextureFormat(handle, cbufSlot); if (format == TextureFormat.Unknown) { |
