v3dv: handle empty set layouts
Fixes: dEQP-VK.api.object_management.max_concurrent.descriptor_set_layout_empty dEQP-VK.api.object_management.single_alloc_callbacks.descriptor_set_layout_empty Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
parent
9833a5ae70
commit
4b9e3bbf48
|
@ -552,7 +552,7 @@ v3dv_CreateDescriptorSetLayout(VkDevice _device,
|
||||||
|
|
||||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO);
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO);
|
||||||
|
|
||||||
uint32_t max_binding = 0;
|
int32_t max_binding = pCreateInfo->bindingCount > 0 ? 0 : -1;
|
||||||
uint32_t immutable_sampler_count = 0;
|
uint32_t immutable_sampler_count = 0;
|
||||||
for (uint32_t j = 0; j < pCreateInfo->bindingCount; j++) {
|
for (uint32_t j = 0; j < pCreateInfo->bindingCount; j++) {
|
||||||
max_binding = MAX2(max_binding, pCreateInfo->pBindings[j].binding);
|
max_binding = MAX2(max_binding, pCreateInfo->pBindings[j].binding);
|
||||||
|
@ -590,13 +590,16 @@ v3dv_CreateDescriptorSetLayout(VkDevice _device,
|
||||||
/* We just allocate all the immutable samplers at the end of the struct */
|
/* We just allocate all the immutable samplers at the end of the struct */
|
||||||
struct v3dv_sampler *samplers = (void*) &set_layout->binding[max_binding + 1];
|
struct v3dv_sampler *samplers = (void*) &set_layout->binding[max_binding + 1];
|
||||||
|
|
||||||
VkDescriptorSetLayoutBinding *bindings =
|
VkDescriptorSetLayoutBinding *bindings = NULL;
|
||||||
create_sorted_bindings(pCreateInfo->pBindings, pCreateInfo->bindingCount,
|
if (pCreateInfo->bindingCount > 0) {
|
||||||
device, pAllocator);
|
assert(max_binding >= 0);
|
||||||
|
bindings = create_sorted_bindings(pCreateInfo->pBindings,
|
||||||
if (!bindings) {
|
pCreateInfo->bindingCount,
|
||||||
vk_free2(&device->alloc, pAllocator, set_layout);
|
device, pAllocator);
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
if (!bindings) {
|
||||||
|
vk_free2(&device->alloc, pAllocator, set_layout);
|
||||||
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(set_layout->binding, 0,
|
memset(set_layout->binding, 0,
|
||||||
|
@ -667,7 +670,8 @@ v3dv_CreateDescriptorSetLayout(VkDevice _device,
|
||||||
binding->descriptorCount;
|
binding->descriptorCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, bindings);
|
if (bindings)
|
||||||
|
vk_free2(&device->alloc, pAllocator, bindings);
|
||||||
|
|
||||||
set_layout->descriptor_count = descriptor_count;
|
set_layout->descriptor_count = descriptor_count;
|
||||||
set_layout->dynamic_offset_count = dynamic_offset_count;
|
set_layout->dynamic_offset_count = dynamic_offset_count;
|
||||||
|
|
Loading…
Reference in New Issue