Module: Mesa
Branch: main
Commit: f6bd494cfac760384807fb558a511db3ff9d495d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6bd494cfac760384807fb558a511db3ff9d495d

Author: Emma Anholt <[email protected]>
Date:   Thu Aug  4 20:28:40 2022 -0700

tu: Treat viewFormatCount==0 as no format list.

"If viewFormatCount is zero, pViewFormats is ignored and the image is
 created as if the VkImageFormatListCreateInfo structure were not included
 in the pNext chain of VkImageCreateInfo."

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17900>

---

 src/freedreno/vulkan/tu_image.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 6630c812321..887119e1692 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -352,7 +352,7 @@ format_list_reinterprets_r8g8_r16(enum pipe_format format, 
const VkImageFormatLi
    /* If there's no format list, then the app may reinterpret to any compatible
     * format.
     */
-   if (!fmt_list)
+   if (!fmt_list || !fmt_list->viewFormatCount)
       return true;
 
    bool has_r8g8 = false;
@@ -374,7 +374,7 @@ format_list_has_swaps(const VkImageFormatListCreateInfo 
*fmt_list)
    /* If there's no format list, then the app may reinterpret to any compatible
     * format, and presumably one would have the swap set.
     */
-   if (!fmt_list)
+   if (!fmt_list || !fmt_list->viewFormatCount)
       return true;
 
    for (uint32_t i = 0; i < fmt_list->viewFormatCount; i++) {

Reply via email to