v3dv: clean up get_internal_type_bpp_for_image_aspects
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 13 Jul 2022 06:15:59 +0000 (08:15 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 13 Jul 2022 10:09:34 +0000 (10:09 +0000)
Also, remove the FIXME to pre-compute this in images. We only use
this helper from copy/clear operations where we may be working
with a compatible framebuffer format instead of the original image.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17509>

src/broadcom/vulkan/v3dvx_formats.c

index 62eaefe..61ecc77 100644 (file)
@@ -459,23 +459,17 @@ v3dX(get_internal_type_bpp_for_image_aspects)(VkFormat vk_format,
                                               uint32_t *internal_type,
                                               uint32_t *internal_bpp)
 {
-   const VkImageAspectFlags ds_aspects = VK_IMAGE_ASPECT_DEPTH_BIT |
-                                         VK_IMAGE_ASPECT_STENCIL_BIT;
-
    /* We can't store depth/stencil pixel formats to a raster format, so
-    * so instead we load our depth/stencil aspects to a compatible color
-    * format.
+    * instead we load our depth/stencil aspects to a compatible color format.
     */
-   /* FIXME: pre-compute this at image creation time? */
-   if (aspect_mask & ds_aspects) {
+   if (aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
+      *internal_bpp = V3D_INTERNAL_BPP_32;
       switch (vk_format) {
       case VK_FORMAT_D16_UNORM:
          *internal_type = V3D_INTERNAL_TYPE_16UI;
-         *internal_bpp = V3D_INTERNAL_BPP_32;
          break;
       case VK_FORMAT_D32_SFLOAT:
          *internal_type = V3D_INTERNAL_TYPE_32F;
-         *internal_bpp = V3D_INTERNAL_BPP_32;
          break;
       case VK_FORMAT_X8_D24_UNORM_PACK32:
       case VK_FORMAT_D24_UNORM_S8_UINT:
@@ -484,7 +478,6 @@ v3dX(get_internal_type_bpp_for_image_aspects)(VkFormat vk_format,
           * load command for more details.
           */
          *internal_type = V3D_INTERNAL_TYPE_8UI;
-         *internal_bpp = V3D_INTERNAL_BPP_32;
          break;
       default:
          assert(!"unsupported format");