nvk: Reserve a null image descriptor
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Tue, 31 Jan 2023 02:11:49 +0000 (20:11 -0600)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:31:54 +0000 (21:31 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/vulkan/nvk_device.c

index 4c65ffb..ec0a431 100644 (file)
@@ -190,6 +190,13 @@ nvk_CreateDevice(VkPhysicalDevice physicalDevice,
    if (result != VK_SUCCESS)
       goto fail_ctx;
 
+   /* Reserve the descriptor at offset 0 to be the null descriptor */
+   ASSERTED uint32_t null_image_index;
+   void *null_desc = nvk_descriptor_table_alloc(device, &device->images,
+                                                &null_image_index);
+   assert(null_desc != NULL && null_image_index == 0);
+   memset(null_desc, 0, 8 * 4);
+
    result = vk_queue_init(&device->queue.vk, &device->vk, &pCreateInfo->pQueueCreateInfos[0], 0);
    if (result != VK_SUCCESS)
       goto fail_images;