aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2022-09-09 00:30:19 +0100
committerGitHub <noreply@github.com>2022-09-08 20:30:19 -0300
commitc6d82209abeacd2336cde99e5a02b4596e70da83 (patch)
tree8dc8e1055f402c07e6ed9e4ff247ca420729808c /Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs
parentee1825219b8ccca13df7198d4e9ffb966e44c883 (diff)
Restride vertex buffer when stride causes attributes to misalign in Vulkan. (#3679)1.1.254
* Vertex Buffer Alignment part 1 * Update CacheByRange * Add Stride Change compute shader, fix storage buffers in helpers * An AMD exclusive * Reword * Change rules - stride conversion when attrs misalign * Fix stupid mistake * Fix background pipeline compile * Improve a few things. * Fix some feedback * Address Feedback (the shader binary didn't change when i changed the source to use the subgroup size) * Fix bug where rewritten buffer would be disposed instantly.
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs')
-rw-r--r--Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs37
1 files changed, 36 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs b/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs
index f708f794..9e372311 100644
--- a/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs
+++ b/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs
@@ -185,6 +185,34 @@ namespace Ryujinx.Graphics.Vulkan
SignalDirty(DirtyFlags.Storage);
}
+ public void SetStorageBuffers(CommandBuffer commandBuffer, int first, ReadOnlySpan<Auto<DisposableBuffer>> buffers)
+ {
+ for (int i = 0; i < buffers.Length; i++)
+ {
+ var vkBuffer = buffers[i];
+ int index = first + i;
+
+ ref Auto<DisposableBuffer> currentVkBuffer = ref _storageBufferRefs[index];
+
+ DescriptorBufferInfo info = new DescriptorBufferInfo()
+ {
+ Offset = 0,
+ Range = Vk.WholeSize
+ };
+ ref DescriptorBufferInfo currentInfo = ref _storageBuffers[index];
+
+ if (vkBuffer != currentVkBuffer || currentInfo.Offset != info.Offset || currentInfo.Range != info.Range)
+ {
+ _storageSet[index] = false;
+
+ currentInfo = info;
+ currentVkBuffer = vkBuffer;
+ }
+ }
+
+ SignalDirty(DirtyFlags.Storage);
+ }
+
public void SetTextureAndSampler(CommandBufferScoped cbs, ShaderStage stage, int binding, ITexture texture, ISampler sampler)
{
if (texture == null)
@@ -388,7 +416,14 @@ namespace Ryujinx.Graphics.Vulkan
}
ReadOnlySpan<DescriptorBufferInfo> storageBuffers = _storageBuffers;
- dsc.UpdateStorageBuffers(0, binding, storageBuffers.Slice(binding, count));
+ if (program.HasMinimalLayout)
+ {
+ dsc.UpdateBuffers(0, binding, storageBuffers.Slice(binding, count), DescriptorType.StorageBuffer);
+ }
+ else
+ {
+ dsc.UpdateStorageBuffers(0, binding, storageBuffers.Slice(binding, count));
+ }
}
else if (setIndex == PipelineBase.TextureSetIndex)
{