radv: Fix VK_KHR_image_format_list.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 25 Sep 2017 04:45:37 +0000 (06:45 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 25 Sep 2017 13:36:19 +0000 (15:36 +0200)
Spec adding corner cases ...

Fixes: 969537d9358 "radv: Add support for more DCC compression with VK_KHR_image_format_list."
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_image.c

index c96e9e66e14159dd4c8cb16535e6f493f5532735..c0578ff5d3e330a1035a6f22ded7afd52c4ba8d5 100644 (file)
@@ -122,7 +122,9 @@ radv_init_surface(struct radv_device *device,
                          (const struct  VkImageFormatListCreateInfoKHR *)
                                vk_find_struct_const(pCreateInfo->pNext,
                                                     IMAGE_FORMAT_LIST_CREATE_INFO_KHR);
-               if (format_list) {
+
+               /* We have to ignore the existence of the list if viewFormatCount = 0 */
+               if (format_list && format_list->viewFormatCount) {
                        /* compatibility is transitive, so we only need to check
                         * one format with everything else. */
                        for (unsigned i = 0; i < format_list->viewFormatCount; ++i) {