radv: Unset vk_info in radv_image_create_layout.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 24 Sep 2019 11:42:31 +0000 (13:42 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 10 Oct 2019 17:02:34 +0000 (17:02 +0000)
For better test coverage of this corner case.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_image.c

index baf49c6b65adda8a5aceb64024be1c88d4d357b5..9df7dd4ae81e3a14b5fd70f96a63f115991a0ea9 100644 (file)
@@ -1348,14 +1348,18 @@ static void radv_image_disable_htile(struct radv_image *image)
 
 static VkResult
 radv_image_create_layout(struct radv_device *device,
-                         const struct radv_image_create_info *create_info,
+                         struct radv_image_create_info create_info,
                          struct radv_image *image)
 {
        /* Check that we did not initialize things earlier */
        assert(!image->planes[0].surface.surf_size);
 
+       /* Clear the pCreateInfo pointer so we catch issues in the delayed case when we test in the
+        * common internal case. */
+       create_info.vk_info = NULL;
+
        struct ac_surf_info image_info = image->info;
-       VkResult result = radv_patch_image_from_extra_info(device, image, create_info, &image_info);
+       VkResult result = radv_patch_image_from_extra_info(device, image, &create_info, &image_info);
        if (result != VK_SUCCESS)
                return result;
 
@@ -1382,7 +1386,7 @@ radv_image_create_layout(struct radv_device *device,
                image->planes[plane].format = vk_format_get_plane_format(image->vk_format, plane);
        }
 
-       if (!create_info->no_metadata_planes) {
+       if (!create_info.no_metadata_planes) {
                /* Try to enable DCC first. */
                if (radv_image_can_enable_dcc(device, image)) {
                        radv_image_alloc_dcc(image);
@@ -1488,7 +1492,7 @@ radv_image_create(VkDevice _device,
                radv_init_surface(device, image, &image->planes[plane].surface, plane, pCreateInfo);
        }
 
-       ASSERTED VkResult result = radv_image_create_layout(device, create_info, image);
+       ASSERTED VkResult result = radv_image_create_layout(device, *create_info, image);
        assert(result == VK_SUCCESS);
 
        if (image->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) {