const PipelineState &self = *static_cast<const PipelineState *>(this);
const VulkanFunctions &vk = device.get_functions();
+ unsigned first_changed_desc_set = 0;
if(!last)
unapplied = ~0U;
else if(last!=this)
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)
if((unapplied&PipelineState::UNIFORMS) && !descriptor_set_slots.empty())
{
vector<VkDescriptorSet> descriptor_set_handles;
- descriptor_set_handles.reserve(self.descriptor_set_slots.size());
- for(unsigned i=0; i<self.descriptor_set_slots.size(); ++i)
- descriptor_set_handles.push_back(device.get_descriptor_pool().get_descriptor_set(self.descriptor_set_slots[i], self, i, frame));
+ descriptor_set_handles.reserve(descriptor_set_slots.size()-first_changed_desc_set);
+ for(unsigned i=first_changed_desc_set; i<descriptor_set_slots.size(); ++i)
+ descriptor_set_handles.push_back(device.get_descriptor_pool().get_descriptor_set(
+ self.descriptor_set_slots[i], self, i, frame));
vk.CmdBindDescriptorSets(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, self.shprog->layout_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))