Mesa (main): anv: Rework depth/stencil early return in anv_get_format_plane

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 9 16:19:12 UTC 2021


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

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Fri Jul 30 06:42:33 2021 -0500

anv: Rework depth/stencil early return in anv_get_format_plane

The comment about modifiers is bogus because we check the modifier
before this check and return early.  Also, there's no reason why we need
to check the requested aspect when we could check the format itself.
anv_image_aspect_to_plane will ensure that the requested aspect is one
that actually exists.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12141>

---

 src/intel/vulkan/anv_formats.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index b77871b9b4e..911460d2313 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -488,15 +488,8 @@ anv_get_format_aspect(const struct intel_device_info *devinfo,
    if (tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
       return plane_format;
 
-   if (aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
-      assert(vk_format_aspects(vk_format) &
-             (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT));
-
-      /* There's no reason why we strictly can't support depth or stencil with
-       * modifiers but there's also no reason why we should.
-       */
+   if (vk_format_is_depth_or_stencil(vk_format))
       return plane_format;
-   }
 
    assert((aspect & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0);
 



More information about the mesa-commit mailing list