From 3becb2729a54273cbe9e59eb11e07a217c037315 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 11 Apr 2022 04:46:31 -0700 Subject: [PATCH] dzn: Skip binding entries with zero descriptors D3D12 doesn't like empty descriptor ranges, so let's skip those at set layout creation time. Acked-by: Erik Faye-Lund Reviewed-by: Jesse Natalie Part-of: --- src/microsoft/vulkan/dzn_descriptor_set.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/microsoft/vulkan/dzn_descriptor_set.cpp b/src/microsoft/vulkan/dzn_descriptor_set.cpp index 557e454..b98d513 100644 --- a/src/microsoft/vulkan/dzn_descriptor_set.cpp +++ b/src/microsoft/vulkan/dzn_descriptor_set.cpp @@ -134,6 +134,11 @@ dzn_descriptor_set_layout_create(dzn_device *device, uint32_t range_count[MAX_SHADER_VISIBILITIES][NUM_POOL_TYPES] = {}; for (uint32_t i = 0; i < pCreateInfo->bindingCount; i++) { + binding_count = MAX2(binding_count, bindings[i].binding + 1); + + if (!bindings[i].descriptorCount) + continue; + D3D12_SHADER_VISIBILITY visibility = translate_desc_visibility(bindings[i].stageFlags); VkDescriptorType desc_type = bindings[i].descriptorType; @@ -189,8 +194,6 @@ dzn_descriptor_set_layout_create(dzn_device *device, dynamic_ranges_offset += bindings[i].descriptorCount * factor; } } - - binding_count = MAX2(binding_count, bindings[i].binding + 1); } /* We need to allocate decriptor set layouts off the device allocator @@ -321,6 +324,9 @@ dzn_descriptor_set_layout_create(dzn_device *device, assert(dynamic_buffer_idx <= MAX_DYNAMIC_BUFFERS); } + if (!ordered_bindings[i].descriptorCount) + continue; + unsigned num_descs = num_descs_for_type(desc_type, has_static_sampler); if (!num_descs) continue; -- 2.7.4