zink: only consider format-desc if checking details
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 10 Jul 2019 12:59:58 +0000 (14:59 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:46 +0000 (08:51 +0000)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/zink_screen.c

index 260d4bf90db3551bd75463e47b9125fb048619d6..86fa16fdba4be54d8d85f08200d21c9b955628ab 100644 (file)
@@ -588,9 +588,9 @@ zink_is_format_supported(struct pipe_screen *pscreen,
    if (vkformat == VK_FORMAT_UNDEFINED)
       return FALSE;
 
-   const struct util_format_description *desc = util_format_description(format);
    if (sample_count >= 1) {
       VkSampleCountFlagBits sample_mask = vk_sample_count_flags(sample_count);
+      const struct util_format_description *desc = util_format_description(format);
       if (util_format_is_depth_or_stencil(format)) {
          if (util_format_has_depth(desc)) {
             if (bind & PIPE_BIND_DEPTH_STENCIL &&
@@ -651,9 +651,12 @@ zink_is_format_supported(struct pipe_screen *pscreen,
          return FALSE;
    }
 
-   if (desc->layout == UTIL_FORMAT_LAYOUT_BPTC &&
-       !screen->feats.textureCompressionBC)
-      return FALSE;
+   if (util_format_is_compressed(format)) {
+      const struct util_format_description *desc = util_format_description(format);
+      if (desc->layout == UTIL_FORMAT_LAYOUT_BPTC &&
+          !screen->feats.textureCompressionBC)
+         return FALSE;
+   }
 
    return TRUE;
 }