diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs')
-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 01e34c777..8b9243b1e 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 | |||
340 | /// <returns>True if any used entries of the pool might have been modified, false otherwise</returns> | 340 | /// <returns>True if any used entries of the pool might have been modified, false otherwise</returns> |
341 | public bool SamplerPoolModified() | 341 | public bool SamplerPoolModified() |
342 | { | 342 | { |
343 | return SamplerPool.WasModified(ref _samplerPoolSequence); | 343 | return SamplerPool != null && SamplerPool.WasModified(ref _samplerPoolSequence); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | 346 | ||
@@ -516,12 +516,15 @@ namespace Ryujinx.Graphics.Gpu.Image | |||
516 | } | 516 | } |
517 | 517 | ||
518 | // Check if any of our cached samplers changed on the pool. | 518 | // Check if any of our cached samplers changed on the pool. |
519 | foreach ((int samplerId, (Sampler sampler, SamplerDescriptor descriptor)) in SamplerIds) | 519 | if (SamplerPool != null) |
520 | { | 520 | { |
521 | if (SamplerPool.GetCachedItem(samplerId) != sampler || | 521 | foreach ((int samplerId, (Sampler sampler, SamplerDescriptor descriptor)) in SamplerIds) |
522 | (sampler == null && SamplerPool.IsValidId(samplerId) && !SamplerPool.GetDescriptorRef(samplerId).Equals(descriptor))) | ||
523 | { | 522 | { |
524 | return true; | 523 | if (SamplerPool.GetCachedItem(samplerId) != sampler || |
524 | (sampler == null && SamplerPool.IsValidId(samplerId) && !SamplerPool.GetDescriptorRef(samplerId).Equals(descriptor))) | ||
525 | { | ||
526 | return true; | ||
527 | } | ||
525 | } | 528 | } |
526 | } | 529 | } |
527 | 530 | ||
@@ -899,13 +902,19 @@ namespace Ryujinx.Graphics.Gpu.Image | |||
899 | } | 902 | } |
900 | } | 903 | } |
901 | 904 | ||
902 | Sampler sampler = samplerPool?.Get(samplerId); | ||
903 | |||
904 | entry.TextureIds[textureId] = (texture, descriptor); | 905 | entry.TextureIds[textureId] = (texture, descriptor); |
905 | entry.SamplerIds[samplerId] = (sampler, samplerPool?.GetDescriptorRef(samplerId) ?? default); | ||
906 | 906 | ||
907 | ITexture hostTexture = texture?.GetTargetTexture(bindingInfo.Target); | 907 | ITexture hostTexture = texture?.GetTargetTexture(bindingInfo.Target); |
908 | ISampler hostSampler = sampler?.GetHostSampler(texture); | 908 | ISampler hostSampler = null; |
909 | |||
910 | if (!isImage && bindingInfo.Target != Target.TextureBuffer) | ||
911 | { | ||
912 | Sampler sampler = samplerPool?.Get(samplerId); | ||
913 | |||
914 | entry.SamplerIds[samplerId] = (sampler, samplerPool?.GetDescriptorRef(samplerId) ?? default); | ||
915 | |||
916 | hostSampler = sampler?.GetHostSampler(texture); | ||
917 | } | ||
909 | 918 | ||
910 | Format format = bindingInfo.Format; | 919 | Format format = bindingInfo.Format; |
911 | 920 | ||