radv: only enable TC-compat HTILE for images readable by a shader
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 31 Mar 2020 08:35:00 +0000 (10:35 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 9 Apr 2020 11:55:59 +0000 (11:55 +0000)
If no texture fetches happen it's useless to enable TC-compat HTILE.

Because the driver currently doesn't support TC-compat HTILE for
storage images we don't have to check.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4497>

src/amd/vulkan/radv_image.c

index bdd62a9cbf49659a9d326ac9d50a13db12129157..cf35855dfee636d955f32f771a385463be2238e3 100644 (file)
@@ -81,6 +81,14 @@ radv_use_tc_compat_htile_for_image(struct radv_device *device,
        if (pCreateInfo->mipLevels > 1)
                return false;
 
+       /* Do not enable TC-compatible HTILE if the image isn't readable by a
+        * shader because no texture fetches will happen.
+        */
+       if (!(pCreateInfo->usage & (VK_IMAGE_USAGE_SAMPLED_BIT |
+                                   VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT |
+                                   VK_IMAGE_USAGE_TRANSFER_SRC_BIT)))
+               return false;
+
        /* FIXME: for some reason TC compat with 2/4/8 samples breaks some cts
         * tests - disable for now. On GFX10 D32_SFLOAT is affected as well.
         */