diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2024-08-20 20:49:17 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-21 00:49:17 +0100 |
| commit | 460f9faf4e3ccb5a21b1c6f149815dfda095a16e (patch) | |
| tree | 8f1be7d93c534aa7a34597061716ca5d1695ac35 /src/Ryujinx.Graphics.Gpu | |
| parent | 552c15739c10e9443e7e7a2acc775bfbc08faa0c (diff) | |
Fix NRE when using buffer image array (#7159)
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu')
| -rw-r--r-- | src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs index 01e34c77..8b9243b1 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs @@ -340,7 +340,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// <returns>True if any used entries of the pool might have been modified, false otherwise</returns> public bool SamplerPoolModified() { - return SamplerPool.WasModified(ref _samplerPoolSequence); + return SamplerPool != null && SamplerPool.WasModified(ref _samplerPoolSequence); } } @@ -516,12 +516,15 @@ namespace Ryujinx.Graphics.Gpu.Image } // Check if any of our cached samplers changed on the pool. - foreach ((int samplerId, (Sampler sampler, SamplerDescriptor descriptor)) in SamplerIds) + if (SamplerPool != null) { - if (SamplerPool.GetCachedItem(samplerId) != sampler || - (sampler == null && SamplerPool.IsValidId(samplerId) && !SamplerPool.GetDescriptorRef(samplerId).Equals(descriptor))) + foreach ((int samplerId, (Sampler sampler, SamplerDescriptor descriptor)) in SamplerIds) { - return true; + if (SamplerPool.GetCachedItem(samplerId) != sampler || + (sampler == null && SamplerPool.IsValidId(samplerId) && !SamplerPool.GetDescriptorRef(samplerId).Equals(descriptor))) + { + return true; + } } } @@ -899,13 +902,19 @@ namespace Ryujinx.Graphics.Gpu.Image } } - Sampler sampler = samplerPool?.Get(samplerId); - entry.TextureIds[textureId] = (texture, descriptor); - entry.SamplerIds[samplerId] = (sampler, samplerPool?.GetDescriptorRef(samplerId) ?? default); ITexture hostTexture = texture?.GetTargetTexture(bindingInfo.Target); - ISampler hostSampler = sampler?.GetHostSampler(texture); + ISampler hostSampler = null; + + if (!isImage && bindingInfo.Target != Target.TextureBuffer) + { + Sampler sampler = samplerPool?.Get(samplerId); + + entry.SamplerIds[samplerId] = (sampler, samplerPool?.GetDescriptorRef(samplerId) ?? default); + + hostSampler = sampler?.GetHostSampler(texture); + } Format format = bindingInfo.Format; |
