Mesa (main): dzn: Skip binding entries with zero descriptors
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 14 14:11:54 UTC 2022
Module: Mesa
Branch: main
Commit: 3becb2729a54273cbe9e59eb11e07a217c037315
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3becb2729a54273cbe9e59eb11e07a217c037315
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Mon Apr 11 04:46:31 2022 -0700
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 <erik.faye-lund at collabora.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15884>
---
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 557e454db2c..b98d51373d2 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;
More information about the mesa-commit
mailing list