From 86511ecbd030bc49aef275056604567a0e320c64 Mon Sep 17 00:00:00 2001 From: Gabriel A Date: Sat, 6 Jul 2024 15:08:15 -0300 Subject: [PATCH] No need to do it for images --- .../DescriptorSetUpdater.cs | 102 +----------------- .../ShaderCollection.cs | 6 +- 2 files changed, 2 insertions(+), 106 deletions(-) diff --git a/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs b/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs index 29b0e2d4af..b220e920fb 100644 --- a/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs +++ b/src/Ryujinx.Graphics.Vulkan/DescriptorSetUpdater.cs @@ -696,14 +696,7 @@ namespace Ryujinx.Graphics.Vulkan if (_dirty.HasFlag(DirtyFlags.Image)) { - if (program.UpdateImagesWithoutTemplate) - { - UpdateAndBindImagesWithoutTemplate(cbs, program, pbp); - } - else - { - UpdateAndBind(cbs, program, PipelineBase.ImageSetIndex, pbp); - } + UpdateAndBind(cbs, program, PipelineBase.ImageSetIndex, pbp); } if (program.BindingSegments.Length > PipelineBase.DescriptorSetLayouts) @@ -1012,99 +1005,6 @@ namespace Ryujinx.Graphics.Vulkan _gd.Api.CmdBindDescriptorSets(cbs.CommandBuffer, pbp, _program.PipelineLayout, (uint)setIndex, 1, sets, 0, ReadOnlySpan.Empty); } - private void UpdateAndBindImagesWithoutTemplate(CommandBufferScoped cbs, ShaderCollection program, PipelineBindPoint pbp) - { - int setIndex = PipelineBase.ImageSetIndex; - var bindingSegments = program.BindingSegments[setIndex]; - - if (bindingSegments.Length == 0) - { - return; - } - - if (_updateDescriptorCacheCbIndex) - { - _updateDescriptorCacheCbIndex = false; - program.UpdateDescriptorCacheCommandBufferIndex(cbs.CommandBufferIndex); - } - - var dsc = program.GetNewDescriptorSetCollection(setIndex, out _).Get(cbs); - - foreach (ResourceBindingSegment segment in bindingSegments) - { - int binding = segment.Binding; - int count = segment.Count; - - if (!segment.IsArray) - { - if (segment.Type != ResourceType.BufferImage) - { - Span images = _images; - - for (int i = 0; i < count; i++) - { - images[i].ImageView = _imageRefs[binding + i].View?.Get(cbs).Value ?? default; - } - - dsc.UpdateImages(0, binding, images[..count], DescriptorType.StorageImage); - } - else - { - Span bufferImages = _bufferImages; - - for (int i = 0; i < count; i++) - { - bufferImages[i] = _bufferImageRefs[binding + i]?.GetBufferView(cbs, _bufferImageFormats[binding + i], true) ?? default; - } - - dsc.UpdateBufferImages(0, binding, bufferImages[..count], DescriptorType.StorageTexelBuffer); - } - } - else - { - if (segment.Type != ResourceType.BufferTexture) - { - dsc.UpdateImages(0, binding, _imageArrayRefs[binding].Array.GetImageInfos(_gd, cbs, _dummyTexture), DescriptorType.StorageImage); - } - else - { - dsc.UpdateBufferImages(0, binding, _imageArrayRefs[binding].Array.GetBufferViews(cbs), DescriptorType.StorageTexelBuffer); - } - } - } - - var sets = dsc.GetSets(); - - _gd.Api.CmdBindDescriptorSets(cbs.CommandBuffer, pbp, _program.PipelineLayout, (uint)setIndex, 1, sets, 0, ReadOnlySpan.Empty); - } - - private unsafe void UpdateBuffers( - CommandBufferScoped cbs, - PipelineBindPoint pbp, - int baseBinding, - ReadOnlySpan bufferInfo, - DescriptorType type) - { - if (bufferInfo.Length == 0) - { - return; - } - - fixed (DescriptorBufferInfo* pBufferInfo = bufferInfo) - { - var writeDescriptorSet = new WriteDescriptorSet - { - SType = StructureType.WriteDescriptorSet, - DstBinding = (uint)baseBinding, - DescriptorType = type, - DescriptorCount = (uint)bufferInfo.Length, - PBufferInfo = pBufferInfo, - }; - - _gd.PushDescriptorApi.CmdPushDescriptorSet(cbs.CommandBuffer, pbp, _program.PipelineLayout, 0, 1, &writeDescriptorSet); - } - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] private void UpdateAndBindUniformBufferPd(CommandBufferScoped cbs) { diff --git a/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs b/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs index 3e287e1ac6..c5220185c8 100644 --- a/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs +++ b/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs @@ -24,7 +24,6 @@ namespace Ryujinx.Graphics.Vulkan public bool HasTessellationControlShader => (Stages & (1u << 3)) != 0; public bool UpdateTexturesWithoutTemplate { get; } - public bool UpdateImagesWithoutTemplate { get; } public uint Stages { get; } @@ -144,10 +143,7 @@ namespace Ryujinx.Graphics.Vulkan if (bindingSegment.Type == ResourceType.BufferTexture) { UpdateTexturesWithoutTemplate = true; - } - else if (bindingSegment.Type == ResourceType.BufferImage) - { - UpdateImagesWithoutTemplate = true; + break; } } }