From 0129250c2e169c7386f7e2868cc055f8ec55c005 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Wed, 19 May 2021 19:05:43 +0100 Subject: 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 Co-authored-by: gdkchan --- Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs | 5 +++-- Ryujinx.Graphics.Gpu/Image/TextureManager.cs | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Image') diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs index 7fea7ebe..ae610a76 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs @@ -398,10 +398,11 @@ namespace Ryujinx.Graphics.Gpu.Image /// The current GPU state /// The stage number where the texture is bound /// The texture handle + /// The texture handle's constant buffer slot /// The texture descriptor for the specified texture - public TextureDescriptor GetTextureDescriptor(GpuState state, int stageIndex, int handle) + public TextureDescriptor GetTextureDescriptor(GpuState state, int stageIndex, int handle, int cbufSlot) { - int packedId = ReadPackedId(stageIndex, handle, state.Get(MethodOffset.TextureBufferIndex)); + int packedId = ReadPackedId(stageIndex, handle, cbufSlot < 0 ? state.Get(MethodOffset.TextureBufferIndex) : cbufSlot); int textureId = UnpackTextureId(packedId); var poolState = state.Get(MethodOffset.TexturePoolState); diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs index 17bb553f..e08e55ee 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs @@ -340,10 +340,11 @@ namespace Ryujinx.Graphics.Gpu.Image /// /// Current GPU state /// Shader "fake" handle of the texture + /// Shader constant buffer slot of the texture /// The texture descriptor - public TextureDescriptor GetComputeTextureDescriptor(GpuState state, int handle) + public TextureDescriptor GetComputeTextureDescriptor(GpuState state, int handle, int cbufSlot) { - return _cpBindingsManager.GetTextureDescriptor(state, 0, handle); + return _cpBindingsManager.GetTextureDescriptor(state, 0, handle, cbufSlot); } /// @@ -352,10 +353,11 @@ namespace Ryujinx.Graphics.Gpu.Image /// Current GPU state /// Index of the shader stage where the texture is bound /// Shader "fake" handle of the texture + /// Shader constant buffer slot of the texture /// The texture descriptor - public TextureDescriptor GetGraphicsTextureDescriptor(GpuState state, int stageIndex, int handle) + public TextureDescriptor GetGraphicsTextureDescriptor(GpuState state, int stageIndex, int handle, int cbufSlot) { - return _gpBindingsManager.GetTextureDescriptor(state, stageIndex, handle); + return _gpBindingsManager.GetTextureDescriptor(state, stageIndex, handle, cbufSlot); } /// @@ -1297,4 +1299,4 @@ namespace Ryujinx.Graphics.Gpu.Image } } } -} \ No newline at end of file +} -- cgit v1.2.3