From: Mikko Rasa Date: Wed, 16 Mar 2022 11:29:09 +0000 (+0200) Subject: Skip binding of low-numbered descriptor sets if they haven't changed X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b4afa01e74375446c12e4bd7472412df7f0d6e48;p=libs%2Fgl.git Skip binding of low-numbered descriptor sets if they haven't changed --- diff --git a/source/backends/vulkan/pipelinestate_backend.cpp b/source/backends/vulkan/pipelinestate_backend.cpp index a6a548af..02e7993c 100644 --- a/source/backends/vulkan/pipelinestate_backend.cpp +++ b/source/backends/vulkan/pipelinestate_backend.cpp @@ -374,6 +374,7 @@ void VulkanPipelineState::apply(VkCommandBuffer command_buffer, const VulkanPipe const PipelineState &self = *static_cast(this); const VulkanFunctions &vk = device.get_functions(); + unsigned first_changed_desc_set = 0; if(!last) unapplied = ~0U; else if(last!=this) @@ -387,6 +388,7 @@ void VulkanPipelineState::apply(VkCommandBuffer command_buffer, const VulkanPipe if(descriptor_set_slots[i]!=last->descriptor_set_slots[i]) { unapplied |= PipelineState::UNIFORMS; + first_changed_desc_set = i; break; } if(self.viewport!=last_ps.viewport) @@ -420,12 +422,13 @@ void VulkanPipelineState::apply(VkCommandBuffer command_buffer, const VulkanPipe if((unapplied&PipelineState::UNIFORMS) && !descriptor_set_slots.empty()) { vector descriptor_set_handles; - descriptor_set_handles.reserve(self.descriptor_set_slots.size()); - for(unsigned i=0; ilayout_handle, - 0, descriptor_set_handles.size(), descriptor_set_handles.data(), 0, 0); + first_changed_desc_set, descriptor_set_handles.size(), descriptor_set_handles.data(), 0, 0); } if(unapplied&(PipelineState::VIEWPORT|PipelineState::SCISSOR))