diff options
author | Jason Ekstrand <[email protected]> | 2017-11-20 12:05:20 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-02-08 16:35:31 -0800 |
commit | bea7373c9284556571fe9c54fd0bd1d0887da032 (patch) | |
tree | b1e293999e0d33cbeb52127671ac609ed5cfce39 /src/intel | |
parent | b09464db42f31be768cb79ef623ea2ed9398c6a9 (diff) |
anv/image: Support color aspects in layout_to_aux_usage
Reviewed-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 32ec24701da..583e085cf94 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -772,12 +772,6 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, /* Stencil has no aux */ assert(aspect != VK_IMAGE_ASPECT_STENCIL_BIT); - /* The following switch currently only handles depth stencil aspects. - * TODO: Handle the color aspect. - */ - if (image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) - return image->planes[plane].aux_usage; - switch (layout) { /* Invalid Layouts */ @@ -797,28 +791,38 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, /* Transfer Layouts - * - * 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. */ case VK_IMAGE_LAYOUT_GENERAL: case VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL: case VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL: - return ISL_AUX_USAGE_NONE; + 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_USAGE_NONE; + } else { + assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); + return image->planes[plane].aux_usage; + } /* Sampling Layouts */ case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL: + case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR: assert((image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0); /* Fall-through */ case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL: - case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR: - assert(aspect == VK_IMAGE_ASPECT_DEPTH_BIT); - if (anv_can_sample_with_hiz(devinfo, image)) - return ISL_AUX_USAGE_HIZ; - else - return ISL_AUX_USAGE_NONE; + if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT) { + if (anv_can_sample_with_hiz(devinfo, image)) + return ISL_AUX_USAGE_HIZ; + else + return ISL_AUX_USAGE_NONE; + } else { + return image->planes[plane].aux_usage; + } + case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR: assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT); @@ -843,8 +847,14 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo, /* Rendering Layouts */ case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL: - assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT); - unreachable("Color images are not yet supported."); + assert(aspect & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV); + if (image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE) { + assert(image->samples == 1); + return ISL_AUX_USAGE_CCS_D; + } else { + assert(image->planes[plane].aux_usage != ISL_AUX_USAGE_CCS_D); + return image->planes[plane].aux_usage; + } case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL: case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR: |