summaryrefslogtreecommitdiff
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2017-04-06 22:43:40 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2017-04-07 19:24:14 -0700
commit415633a7227ba479cf8daa56787649a46e01909e (patch)
tree34228024cb0d0ac3e972fd2004a372ce9b7aabd5 /src/intel
parente5c29b8c2713f622a66cae9ad35f85469cda2a46 (diff)
anv/descriptor_set: Use anv_multialloc for descriptor set layouts
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_descriptor_set.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 56a08ce76a..4797c1e19f 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -42,7 +42,6 @@ VkResult anv_CreateDescriptorSetLayout(
VkDescriptorSetLayout* pSetLayout)
{
ANV_FROM_HANDLE(anv_device, device, _device);
- struct anv_descriptor_set_layout *set_layout;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO);
@@ -54,18 +53,18 @@ VkResult anv_CreateDescriptorSetLayout(
immutable_sampler_count += pCreateInfo->pBindings[j].descriptorCount;
}
- size_t size = sizeof(struct anv_descriptor_set_layout) +
- (max_binding + 1) * sizeof(set_layout->binding[0]) +
- immutable_sampler_count * sizeof(struct anv_sampler *);
+ struct anv_descriptor_set_layout *set_layout;
+ struct anv_descriptor_set_binding_layout *bindings;
+ struct anv_sampler **samplers;
- set_layout = vk_alloc2(&device->alloc, pAllocator, size, 8,
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
- if (!set_layout)
- return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ ANV_MULTIALLOC(ma);
+ anv_multialloc_add(&ma, &set_layout, 1);
+ anv_multialloc_add(&ma, &bindings, max_binding + 1);
+ anv_multialloc_add(&ma, &samplers, immutable_sampler_count);
- /* We just allocate all the samplers at the end of the struct */
- struct anv_sampler **samplers =
- (struct anv_sampler **)&set_layout->binding[max_binding + 1];
+ if (!anv_multialloc_alloc2(&ma, &device->alloc, pAllocator,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT))
+ return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
memset(set_layout, 0, sizeof(*set_layout));
set_layout->binding_count = max_binding + 1;