@@ -1607,6 +1607,14 @@ Error RenderingDeviceDriverVulkan::initialize(uint32_t p_device_index, uint32_t
16071607 const uint32_t reset_descriptor_pool_fixed_driver_begin = VK_MAKE_VERSION (512u , 671u , 0u );
16081608 linear_descriptor_pools_enabled = physical_device_properties.driverVersion < reset_descriptor_pool_broken_driver_begin || physical_device_properties.driverVersion > reset_descriptor_pool_fixed_driver_begin;
16091609 }
1610+
1611+ // Workaround a driver bug on Adreno 5XX GPUs that causes a crash when
1612+ // there are empty descriptor set layouts placed between non-empty ones.
1613+ adreno_5xx_empty_descriptor_set_layout_workaround =
1614+ physical_device_properties.vendorID == RenderingContextDriver::Vendor::VENDOR_QUALCOMM &&
1615+ physical_device_properties.deviceID >= 0x5000000 &&
1616+ physical_device_properties.deviceID < 0x6000000 ;
1617+
16101618 frame_count = p_frame_count;
16111619
16121620 // Copy the queue family properties the context already retrieved.
@@ -3973,13 +3981,26 @@ RDD::ShaderID RenderingDeviceDriverVulkan::shader_create_from_container(const Re
39733981
39743982 // Descriptor sets.
39753983 if (error_text.is_empty ()) {
3984+ // For Adreno 5XX driver bug.
3985+ VkDescriptorSetLayoutBinding placeholder_binding = {};
3986+ placeholder_binding.binding = 0 ;
3987+ placeholder_binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
3988+ placeholder_binding.descriptorCount = 1 ;
3989+ placeholder_binding.stageFlags = VK_SHADER_STAGE_ALL;
3990+
39763991 for (uint32_t i = 0 ; i < shader_refl.uniform_sets .size (); i++) {
39773992 // Empty ones are fine if they were not used according to spec (binding count will be 0).
39783993 VkDescriptorSetLayoutCreateInfo layout_create_info = {};
39793994 layout_create_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
39803995 layout_create_info.bindingCount = vk_set_bindings[i].size ();
39813996 layout_create_info.pBindings = vk_set_bindings[i].ptr ();
39823997
3998+ // ...not so fine on Adreno 5XX.
3999+ if (adreno_5xx_empty_descriptor_set_layout_workaround && layout_create_info.bindingCount == 0 ) {
4000+ layout_create_info.bindingCount = 1 ;
4001+ layout_create_info.pBindings = &placeholder_binding;
4002+ }
4003+
39834004 VkDescriptorSetLayout layout = VK_NULL_HANDLE;
39844005 res = vkCreateDescriptorSetLayout (vk_device, &layout_create_info, VKC::get_allocation_callbacks (VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT), &layout);
39854006 if (res) {
0 commit comments