diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 492f0c24b93..dc1c3f69836 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -1767,8 +1767,12 @@ void VulkanDriver::bindDescriptorSet( backend::DescriptorSetHandle dsh, backend::descriptor_set_t setIndex, backend::DescriptorSetOffsetArray&& offsets) { - VulkanDescriptorSet* set = mResourceAllocator.handle_cast(dsh); - mDescriptorSetManager.bind(setIndex, set, std::move(offsets)); + if (dsh) { + VulkanDescriptorSet* set = mResourceAllocator.handle_cast(dsh); + mDescriptorSetManager.bind(setIndex, set, std::move(offsets)); + } else { + mDescriptorSetManager.unbind(setIndex); + } } void VulkanDriver::draw2(uint32_t indexOffset, uint32_t indexCount, uint32_t instanceCount) { diff --git a/filament/backend/src/vulkan/caching/VulkanDescriptorSetManager.cpp b/filament/backend/src/vulkan/caching/VulkanDescriptorSetManager.cpp index 28bf06dc2de..0533b58e0f4 100644 --- a/filament/backend/src/vulkan/caching/VulkanDescriptorSetManager.cpp +++ b/filament/backend/src/vulkan/caching/VulkanDescriptorSetManager.cpp @@ -369,6 +369,10 @@ void VulkanDescriptorSetManager::bind(uint8_t setIndex, VulkanDescriptorSet* set mStashedSets[setIndex] = set; } +void VulkanDescriptorSetManager::unbind(uint8_t setIndex) { + mStashedSets[setIndex] = nullptr; +} + void VulkanDescriptorSetManager::commit(VulkanCommandBuffer* commands, VkPipelineLayout pipelineLayout, DescriptorSetMask const& setMask) { // setMask indicates the set of descriptor sets the driver wants to bind, curMask is the diff --git a/filament/backend/src/vulkan/caching/VulkanDescriptorSetManager.h b/filament/backend/src/vulkan/caching/VulkanDescriptorSetManager.h index 75e8afda610..2735e5062b1 100644 --- a/filament/backend/src/vulkan/caching/VulkanDescriptorSetManager.h +++ b/filament/backend/src/vulkan/caching/VulkanDescriptorSetManager.h @@ -61,6 +61,8 @@ class VulkanDescriptorSetManager { void bind(uint8_t setIndex, VulkanDescriptorSet* set, backend::DescriptorSetOffsetArray&& offsets); + void unbind(uint8_t setIndex); + void commit(VulkanCommandBuffer* commands, VkPipelineLayout pipelineLayout, DescriptorSetMask const& setMask);