v3dv/descriptor: assert CrateDescriptorPool receives valid count values

Although I assume that this should be caught by the validation layers,
recently while triaging the following tests:
dEQP-VK.ycbcr.query.*r8g8b8a8_unorm*

We found that they were setting a descriptorCount of zero, because it
was not handling correctly the differences between Vulkan 1.0 and
Vulkan 1.1.

So let's just assert, just in case it happens again, as that would
make the bugfixing far easier.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8614>
This commit is contained in:
Alejandro Piñeiro 2021-01-12 12:09:46 +01:00 committed by Marge Bot
parent c57ef25342
commit 319153365b
1 changed files with 2 additions and 0 deletions

View File

@ -411,6 +411,7 @@ v3dv_CreateDescriptorPool(VkDevice _device,
uint32_t bo_size = 0;
uint32_t descriptor_count = 0;
assert(pCreateInfo->poolSizeCount > 0);
for (unsigned i = 0; i < pCreateInfo->poolSizeCount; ++i) {
/* Verify supported descriptor type */
switch(pCreateInfo->pPoolSizes[i].type) {
@ -431,6 +432,7 @@ v3dv_CreateDescriptorPool(VkDevice _device,
break;
}
assert(pCreateInfo->pPoolSizes[i].descriptorCount > 0);
descriptor_count += pCreateInfo->pPoolSizes[i].descriptorCount;
bo_size += descriptor_bo_size(pCreateInfo->pPoolSizes[i].type) *
pCreateInfo->pPoolSizes[i].descriptorCount;