Mesa (master): radv: try to keep HTILE compressed with DEPTH_STENCIL_READ_ONLY_OPTIMAL

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 5 07:34:43 UTC 2021


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Fri Apr  2 18:11:28 2021 +0200

radv: try to keep HTILE compressed with DEPTH_STENCIL_READ_ONLY_OPTIMAL

>From the Vulkan spec:
    "VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL specifies a
     layout for both the depth and stencil aspects of a depth/stencil
     format image allowing read only access as a depth/stencil
     attachment or in shaders as a sampled image, combined
     image/sampler, or input attachment. It is equivalent to
     VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL and
     VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL."

So, it should be safe to keep HTILE compressed if the depth/stencil
image isn't going to be sampled. We could probably extend this
to separate depth/stencil layout but that seems a bit more
complicated.

This gives a huge boost to the deferredmultisampling Vulkan demo.

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

---

 src/amd/vulkan/radv_image.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 5077a3fb552..4b30ae85d7d 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -2086,6 +2086,19 @@ bool radv_layout_is_htile_compressed(const struct radv_device *device,
 		} else {
 			return false;
 		}
+	case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL:
+		if (radv_image_is_tc_compat_htile(image) ||
+		    (radv_image_has_htile(image) &&
+		     !(image->usage & (VK_IMAGE_USAGE_SAMPLED_BIT |
+				       VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)))) {
+			/* Keep HTILE compressed if the image is only going to
+			 * be used as a depth/stencil read-only attachment.
+			 */
+			return true;
+		} else {
+			return false;
+		}
+		break;
 	default:
 	    return radv_image_is_tc_compat_htile(image);
 	}



More information about the mesa-commit mailing list