@@ -220,7 +220,7 @@ namespace ZEngine::Rendering::Shaders
220220 * Unsized arrays require descriptor update-after-bind support
221221 * If device doesn't support it, we fall back to a reasonable maximum
222222 */
223- if (m_device->PhysicalDeviceSupportDescriptorUpdateAfterBind )
223+ if (m_device->PhysicalDeviceSupportSampledImageBindless )
224224 {
225225 count = m_device->PhysicalDeviceDescriptorIndexingProperties .maxPerStageDescriptorUpdateAfterBindSamplers - 1 ;
226226 }
@@ -319,14 +319,15 @@ namespace ZEngine::Rendering::Shaders
319319 binding_flags_collection.init (&LocalArena, layout_binding_collection.size (), layout_binding_collection.size ());
320320 for (uint32_t i = 0 ; i < layout_binding_collection.size (); ++i)
321321 {
322- if (m_device->PhysicalDeviceSupportDescriptorUpdateAfterBind )
322+ if (m_device->PhysicalDeviceSupportSampledImageBindless
323+ && ((layout_binding_collection[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ) || (layout_binding_collection[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE )))
323324 {
324- if ((layout_binding_collection[i].descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ) || (layout_binding_collection[i].descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE ))
325- {
326325 binding_flags_collection[i] = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT | VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT ;
327326 continue ;
328- }
329- binding_flags_collection[i] = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT | VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT ;
327+ }
328+ else if (m_device->PhysicalDeviceSupportStorageBufferBindless && (layout_binding_collection[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ))
329+ {
330+ binding_flags_collection[i] = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT ;
330331 }
331332 else
332333 {
@@ -346,8 +347,12 @@ namespace ZEngine::Rendering::Shaders
346347 descriptor_set_layout_create_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO ;
347348 descriptor_set_layout_create_info.bindingCount = layout_binding_collection.size ();
348349 descriptor_set_layout_create_info.pBindings = layout_binding_collection.data ();
349- descriptor_set_layout_create_info.flags = m_device->PhysicalDeviceSupportDescriptorUpdateAfterBind ? VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT : 0 ;
350- descriptor_set_layout_create_info.pNext = &binding_flags_create_info;
350+
351+ if (m_device->PhysicalDeviceSupportSampledImageBindless )
352+ {
353+ descriptor_set_layout_create_info.flags = VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT ;
354+ descriptor_set_layout_create_info.pNext = &binding_flags_create_info;
355+ }
351356
352357 VkDescriptorSetLayout descriptor_set_layout = VK_NULL_HANDLE ;
353358 ZENGINE_VALIDATE_ASSERT (vkCreateDescriptorSetLayout (m_device->LogicalDevice , &descriptor_set_layout_create_info, nullptr , &descriptor_set_layout) == VK_SUCCESS , " Failed to create DescriptorSetLayout" )
@@ -386,7 +391,7 @@ namespace ZEngine::Rendering::Shaders
386391
387392 VkDescriptorPoolCreateInfo pool_info = {};
388393 pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO ;
389- pool_info.flags = m_device->PhysicalDeviceSupportDescriptorUpdateAfterBind ? VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT : 0 ;
394+ pool_info.flags = m_device->PhysicalDeviceSupportSampledImageBindless ? VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT : 0 ;
390395 pool_info.maxSets = m_device->SwapchainImageCount * pool_size_collection.size () * m_specification.OverloadMaxSet ;
391396 pool_info.poolSizeCount = pool_size_collection.size ();
392397 pool_info.pPoolSizes = pool_size_collection.data ();
0 commit comments