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.Gpu/Shader/TextureDescriptorCapableGpuAccessor.cs | |
| 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.Gpu/Shader/TextureDescriptorCapableGpuAccessor.cs')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Shader/TextureDescriptorCapableGpuAccessor.cs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/TextureDescriptorCapableGpuAccessor.cs b/Ryujinx.Graphics.Gpu/Shader/TextureDescriptorCapableGpuAccessor.cs index dc0e392b..904a0fd4 100644 --- a/Ryujinx.Graphics.Gpu/Shader/TextureDescriptorCapableGpuAccessor.cs +++ b/Ryujinx.Graphics.Gpu/Shader/TextureDescriptorCapableGpuAccessor.cs @@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Shader { public abstract T MemoryRead<T>(ulong address) where T : unmanaged; - public abstract ITextureDescriptor GetTextureDescriptor(int handle); + public abstract ITextureDescriptor GetTextureDescriptor(int handle, int cbufSlot); /// <summary> /// Queries texture format information, for shaders using image load or store. @@ -18,10 +18,11 @@ namespace Ryujinx.Graphics.Gpu.Shader /// If the format of the texture is a compressed, depth or unsupported format, then a default value is returned. /// </remarks> /// <param name="handle">Texture handle</param> + /// <param name="cbufSlot">Constant buffer slot for the texture handle</param> /// <returns>Color format of the non-compressed texture</returns> - public TextureFormat QueryTextureFormat(int handle) + public TextureFormat QueryTextureFormat(int handle, int cbufSlot = -1) { - var descriptor = GetTextureDescriptor(handle); + var descriptor = GetTextureDescriptor(handle, cbufSlot); if (!FormatTable.TryGetTextureFormat(descriptor.UnpackFormat(), descriptor.UnpackSrgb(), out FormatInfo formatInfo)) { @@ -78,20 +79,22 @@ namespace Ryujinx.Graphics.Gpu.Shader /// Queries texture target information. /// </summary> /// <param name="handle">Texture handle</param> + /// <param name="cbufSlot">Constant buffer slot for the texture handle</param> /// <returns>True if the texture is a buffer texture, false otherwise</returns> - public bool QueryIsTextureBuffer(int handle) + public bool QueryIsTextureBuffer(int handle, int cbufSlot = -1) { - return GetTextureDescriptor(handle).UnpackTextureTarget() == TextureTarget.TextureBuffer; + return GetTextureDescriptor(handle, cbufSlot).UnpackTextureTarget() == TextureTarget.TextureBuffer; } /// <summary> /// Queries texture target information. /// </summary> /// <param name="handle">Texture handle</param> + /// <param name="cbufSlot">Constant buffer slot for the texture handle</param> /// <returns>True if the texture is a rectangle texture, false otherwise</returns> - public bool QueryIsTextureRectangle(int handle) + public bool QueryIsTextureRectangle(int handle, int cbufSlot = -1) { - var descriptor = GetTextureDescriptor(handle); + var descriptor = GetTextureDescriptor(handle, cbufSlot); TextureTarget target = descriptor.UnpackTextureTarget(); |
