diff --git a/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp b/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp index 401edb8be..d5e8124df 100644 --- a/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp +++ b/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp @@ -973,7 +973,6 @@ void RenderExecutor::CommitBindings(CommandBuffer& buffer, std::span prepared_bindings) { KYTY_PROFILER_FUNCTION(); auto vk_buffer = buffer.Handle(); - size_t descriptor_count = 0; size_t image_descriptor_count = 0; size_t write_count = 0; ShaderRecompiler::IR::PushData push_data; @@ -992,7 +991,6 @@ void RenderExecutor::CommitBindings(CommandBuffer& buffer, for (auto mask = program.bindings.descriptor_mask; mask != 0; mask &= mask - 1) { const auto index = std::countr_zero(mask); const auto count = program.bindings.descriptor_counts[index]; - descriptor_count += count; if (index >= ShaderRecompiler::IR::FirstImageBinding && index <= static_cast(BindingKind::Samplers)) { image_descriptor_count += count; @@ -1039,12 +1037,11 @@ void RenderExecutor::CommitBindings(CommandBuffer& buffer, } } } - m_descriptor_buffers.clear(); m_descriptor_images.resize(image_descriptor_count); m_descriptor_writes.clear(); - m_descriptor_buffers.reserve(descriptor_count); m_descriptor_writes.reserve(write_count); size_t image_cursor = 0; + std::array address_buffers; for (auto* prepared: prepared_bindings) { const auto& program = *prepared->runtime->program; @@ -1117,7 +1114,6 @@ void RenderExecutor::CommitBindings(CommandBuffer& buffer, write.dstBinding = ShaderRecompiler::IR::NativeBinding(program.stage, kind); write.descriptorType = NativeDescriptorType(kind); write.descriptorCount = program.bindings.descriptor_counts[index]; - const auto buffer_start = m_descriptor_buffers.size(); const auto image_start = image_cursor; if (ShaderRecompiler::IR::ImageBindingResourceClass(kind) != ShaderRecompiler::IR::ImageResourceClass::None) { @@ -1129,8 +1125,8 @@ void RenderExecutor::CommitBindings(CommandBuffer& buffer, EXIT_IF(descriptors.buffers.size() != write.descriptorCount); for (const auto& view: descriptors.buffers) { EXIT_IF(view.buffer == nullptr); - m_descriptor_buffers.push_back(view); } + write.pBufferInfo = descriptors.buffers.data(); break; case BindingKind::BdaPagetable: case BindingKind::FaultBuffer: { @@ -1138,7 +1134,9 @@ void RenderExecutor::CommitBindings(CommandBuffer& buffer, const auto* bda_buffer = kind == BindingKind::BdaPagetable ? cache.GetBdaPageTableBuffer() : cache.GetFaultBuffer(); - m_descriptor_buffers.emplace_back(bda_buffer->Handle(), 0, bda_buffer->Size()); + auto& view = address_buffers[kind == BindingKind::FaultBuffer]; + view = {bda_buffer->Handle(), 0, bda_buffer->Size()}; + write.pBufferInfo = &view; break; } case BindingKind::FlattenedSrt: @@ -1154,7 +1152,7 @@ void RenderExecutor::CommitBindings(CommandBuffer& buffer, view = &descriptors.shared_memory; } EXIT_IF(view->buffer == nullptr); - m_descriptor_buffers.push_back(*view); + write.pBufferInfo = view; break; } case BindingKind::Samplers: @@ -1166,9 +1164,6 @@ void RenderExecutor::CommitBindings(CommandBuffer& buffer, case BindingKind::Count: EXIT("invalid descriptor binding kind"); } } - if (m_descriptor_buffers.size() != buffer_start) { - write.pBufferInfo = m_descriptor_buffers.data() + buffer_start; - } if (image_cursor != image_start) { write.pImageInfo = m_descriptor_images.data() + image_start; } diff --git a/src/graphics/host_gpu/renderer/render.h b/src/graphics/host_gpu/renderer/render.h index af56471c3..4b6055309 100644 --- a/src/graphics/host_gpu/renderer/render.h +++ b/src/graphics/host_gpu/renderer/render.h @@ -213,7 +213,6 @@ private: GraphicsBindings m_graphics_bindings; PreparedBindings m_compute_bindings; std::vector m_bound_images; - std::vector m_descriptor_buffers; std::vector m_descriptor_images; std::vector m_descriptor_writes;