From 45b1bbe80197f646e72362502fa047df372bdd4e Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 6 Nov 2015 12:07:36 -0800 Subject: [PATCH] anv: Add a descriptor_index to anv_descriptor_set_binding_layout --- src/vulkan/anv_device.c | 1 + src/vulkan/anv_pipeline.c | 4 +--- src/vulkan/anv_private.h | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index 156a9d2b1b6..e3c3bdeaa7c 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1529,6 +1529,7 @@ VkResult anv_CreateDescriptorSetLayout( for (uint32_t b = 0; b < pCreateInfo->count; b++) { uint32_t array_size = MAX2(1, pCreateInfo->pBinding[b].arraySize); set_layout->binding[b].array_size = array_size; + set_layout->binding[b].descriptor_index = set_layout->size; set_layout->size += array_size; switch (pCreateInfo->pBinding[b].descriptorType) { diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c index 9fb5ddba20b..1555b23fc69 100644 --- a/src/vulkan/anv_pipeline.c +++ b/src/vulkan/anv_pipeline.c @@ -1230,9 +1230,9 @@ VkResult anv_CreatePipelineLayout( for (uint32_t set = 0; set < pCreateInfo->descriptorSetCount; set++) { struct anv_descriptor_set_layout *set_layout = l.set[set].layout; - unsigned set_offset = 0; for (uint32_t b = 0; b < set_layout->binding_count; b++) { unsigned array_size = set_layout->binding[b].array_size; + unsigned set_offset = set_layout->binding[b].descriptor_index; if (set_layout->binding[b].stage[s].surface_index >= 0) { assert(surface == l.set[set].stage[s].surface_start + @@ -1253,8 +1253,6 @@ VkResult anv_CreatePipelineLayout( } sampler += array_size; } - - set_offset += array_size; } } } diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index a208162bbb6..8000e9f5396 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -689,6 +689,9 @@ struct anv_descriptor_set_binding_layout { /* Number of array elements in this binding */ uint16_t array_size; + /* Index into the flattend descriptor set */ + uint16_t descriptor_index; + /* Index into the dynamic state array for a dynamic buffer */ int16_t dynamic_offset_index; -- 2.30.2