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@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10008>
This commit is contained in:
Samuel Pitoiset 2021-04-02 18:11:28 +02:00 committed by Marge Bot
parent 8fa7aa16ce
commit 4b0fc025f3

View file

@ -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);
}