Mesa (master): v3dv/descriptor: assert CrateDescriptorPool receives valid count values

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 21 17:16:18 UTC 2021


Module: Mesa
Branch: master
Commit: 319153365b9ff212b120d168dd11689907ec4cb9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=319153365b9ff212b120d168dd11689907ec4cb9

Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date:   Tue Jan 12 12:09:46 2021 +0100

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 at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8614>

---

 src/broadcom/vulkan/v3dv_descriptor_set.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/broadcom/vulkan/v3dv_descriptor_set.c b/src/broadcom/vulkan/v3dv_descriptor_set.c
index 8b6b4453799..54787c99abe 100644
--- a/src/broadcom/vulkan/v3dv_descriptor_set.c
+++ b/src/broadcom/vulkan/v3dv_descriptor_set.c
@@ -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;



More information about the mesa-commit mailing list