Mesa (master): turnip: divide cube map depth by 6

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 24 10:36:22 UTC 2020


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

Author: Jonathan Marek <jonathan at marek.ca>
Date:   Thu Apr 23 12:10:07 2020 -0400

turnip: divide cube map depth by 6

This matches the GL driver and fixes these tests:

dEQP-VK.glsl.texture_functions.query.texturesize.samplercubearray*

Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4709>

---

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

diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index c4ac2f8c830..280263b0f36 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -274,8 +274,18 @@ tu_image_view_init(struct tu_image_view *iview,
 
    uint32_t width = u_minify(image->extent.width, range->baseMipLevel);
    uint32_t height = u_minify(image->extent.height, range->baseMipLevel);
-   uint32_t depth = pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_3D ?
-      u_minify(image->extent.depth, range->baseMipLevel) : tu_get_layerCount(image, range);
+   uint32_t depth = tu_get_layerCount(image, range);
+   switch (pCreateInfo->viewType) {
+   case VK_IMAGE_VIEW_TYPE_3D:
+      depth = u_minify(image->extent.depth, range->baseMipLevel);
+      break;
+   case VK_IMAGE_VIEW_TYPE_CUBE:
+   case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
+      depth /= 6;
+      break;
+   default:
+      break;
+  }
 
    uint64_t base_addr = image->bo->iova + image->bo_offset +
       fdl_surface_offset(layout, range->baseMipLevel, range->baseArrayLayer);



More information about the mesa-commit mailing list