diff options
author | Jason Ekstrand <[email protected]> | 2020-02-05 10:12:26 -0600 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-05 18:56:45 +0000 |
commit | 83b641a038704d7fe834d13dad39b0a9f841baca (patch) | |
tree | 9695babe27d96749ad9d25c8e0c16dad19197be8 /src/intel/vulkan | |
parent | 6cec618e82aa233eee4e412a211a7bec0c40b090 (diff) |
anv: Enable HiZ for VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL
Reviewed-by: Nanley Chery <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3717>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index fbb14cc996b..39f61a99467 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -1123,22 +1123,33 @@ anv_layout_to_aux_state(const struct gen_device_info * const devinfo, case VK_IMAGE_LAYOUT_PREINITIALIZED: return ISL_AUX_STATE_AUX_INVALID; - /* Transfer layouts */ + /* General layout */ case VK_IMAGE_LAYOUT_GENERAL: - case VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL: if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT) { - /* This buffer could be a depth buffer used in a transfer operation. - * BLORP currently doesn't use HiZ for transfer operations so we must - * use the main buffer for this layout. TODO: Enable HiZ in BLORP. - */ - assert(image->planes[plane].aux_usage == ISL_AUX_USAGE_HIZ); - return ISL_AUX_STATE_AUX_INVALID; + if (image->usage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) { + /* This buffer could be used as both a depth and input attachment + * at the same time in which case compression could cause issues. + */ + return ISL_AUX_STATE_AUX_INVALID; + } else if (anv_can_sample_with_hiz(devinfo, image)) { + return ISL_AUX_STATE_COMPRESSED_CLEAR; + } else { + return ISL_AUX_STATE_AUX_INVALID; + } } else if (image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_D) { return ISL_AUX_STATE_PASS_THROUGH; } else { return ISL_AUX_STATE_COMPRESSED_CLEAR; } + /* Transfer layouts */ + case VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL: + if (image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_D) { + return ISL_AUX_STATE_PASS_THROUGH; + } else { + return ISL_AUX_STATE_COMPRESSED_CLEAR; + } + /* Sampling layouts */ case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR: case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL: |