summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-06-06 09:15:03 -0700
committerEmil Velikov <[email protected]>2016-06-14 15:48:40 +0100
commitb1f217b5a93abf273aaf8724428eea59d3005432 (patch)
tree008bf6955417008901dc9703f5e05d50135bb88a
parenta0be8d3d0826b8da7d49689eefd9bb8401ac9077 (diff)
anv/descriptor_set: Ensure that bindings are always in increasing order
Since applications are allowed to specify some set of bindings which need not be dense they also need not be in order. For most things, this doesn't matter, but it could result getting the wrong dynamic offsets. This adds a quick-and-dirty sort to ensure that everything is always in increasing order of binding index. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]> (cherry picked from commit c13c5ac561f6475d08c35d2a88a829e6ce36e98c)
-rw-r--r--src/intel/vulkan/anv_descriptor_set.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index c977318a058..448ae0e2f31 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -89,6 +89,19 @@ VkResult anv_CreateDescriptorSetLayout(
for (uint32_t j = 0; j < pCreateInfo->bindingCount; j++) {
const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[j];
uint32_t b = binding->binding;
+ /* We temporarily store the pointer to the binding in the
+ * immutable_samplers pointer. This provides us with a quick-and-dirty
+ * way to sort the bindings by binding number.
+ */
+ set_layout->binding[b].immutable_samplers = (void *)binding;
+ }
+
+ for (uint32_t b = 0; b <= max_binding; b++) {
+ const VkDescriptorSetLayoutBinding *binding =
+ (void *)set_layout->binding[b].immutable_samplers;
+
+ if (binding == NULL)
+ continue;
assert(binding->descriptorCount > 0);
#ifndef NDEBUG