From 3ab99ad14bdc2a08846a5e227d98c646268752a0 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 18 Mar 2021 10:48:26 -0400 Subject: [PATCH] zink: improve surface viewtype clamping a cube array can still work with a nonzero first layer Reviewed-by: Adam Jackson Part-of: --- src/gallium/drivers/zink/zink_surface.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/zink/zink_surface.h b/src/gallium/drivers/zink/zink_surface.h index e3261e8..5610ca0 100644 --- a/src/gallium/drivers/zink/zink_surface.h +++ b/src/gallium/drivers/zink/zink_surface.h @@ -65,9 +65,10 @@ zink_surface_clamp_viewtype(VkImageViewType viewType, unsigned first_layer, unsi if (viewType == VK_IMAGE_VIEW_TYPE_CUBE || viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) { if (first_layer == last_layer) return VK_IMAGE_VIEW_TYPE_2D; - if (viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY && first_layer % 6 == 0 && layerCount % 6 == 0) - return VK_IMAGE_VIEW_TYPE_CUBE; - if (first_layer || layerCount != array_size) + if (layerCount % 6 == 0) { + if (viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY && layerCount == 6) + return VK_IMAGE_VIEW_TYPE_CUBE; + } else if (first_layer || layerCount != array_size) return VK_IMAGE_VIEW_TYPE_2D_ARRAY; } else if (viewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY) { if (first_layer == last_layer) -- 2.7.4