From 52ad1712ed62edbc1a6f530b892bce4e9c1f10b7 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 4 Dec 2019 15:51:34 -0600 Subject: [PATCH] anv: Allow HiZ in TRANSFER_SRC_OPTIMAL on Gen8-9 Reviewed-by: Kenneth Graunke --- src/intel/vulkan/anv_blorp.c | 27 +++++++++++++++++---------- src/intel/vulkan/anv_image.c | 2 +- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 59ad344d911..adbe405e282 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -238,16 +238,23 @@ get_blorp_surf_for_anv_image(const struct anv_device *device, const struct anv_address clear_color_addr = anv_image_get_clear_color_addr(device, image, aspect); blorp_surf->clear_color_addr = anv_to_blorp_address(clear_color_addr); - } else if (aspect & VK_IMAGE_ASPECT_DEPTH_BIT - && device->info.gen >= 10) { - /* Vulkan always clears to 1.0. On gen < 10, we set that directly in - * the state packet. For gen >= 10, must provide the clear value in a - * buffer. We have a single global buffer that stores the 1.0 value. - */ - const struct anv_address clear_color_addr = (struct anv_address) { - .bo = device->hiz_clear_bo, - }; - blorp_surf->clear_color_addr = anv_to_blorp_address(clear_color_addr); + } else if (aspect & VK_IMAGE_ASPECT_DEPTH_BIT) { + if (device->info.gen >= 10) { + /* Vulkan always clears to 1.0. On gen < 10, we set that directly + * in the state packet. For gen >= 10, must provide the clear + * value in a buffer. We have a single global buffer that stores + * the 1.0 value. + */ + const struct anv_address clear_color_addr = (struct anv_address) { + .bo = device->hiz_clear_bo, + }; + blorp_surf->clear_color_addr = + anv_to_blorp_address(clear_color_addr); + } else { + blorp_surf->clear_color = (union isl_color_value) { + .f32 = { ANV_HZ_FC_VAL }, + }; + } } } } diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index f2f89a012b6..2e3be531325 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -1131,7 +1131,6 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, */ case VK_IMAGE_LAYOUT_GENERAL: case VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL: - case VK_IMAGE_LAYOUT_TRANSFER_SRC_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 @@ -1151,6 +1150,7 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL: assert((image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0); /* Fall-through */ + case VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL: case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL: if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT) { if (anv_can_sample_with_hiz(devinfo, image)) -- 2.30.2