mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
anv: Allow more fast clear colors for layouts
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9983 Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31743>
This commit is contained in:
parent
4e17452387
commit
334b368fc9
1 changed files with 12 additions and 40 deletions
|
|
@ -3403,7 +3403,7 @@ anv_layout_to_fast_clear_type(const struct intel_device_info * const devinfo,
|
|||
anv_layout_to_aux_state(devinfo, image, aspect, layout, queue_flags);
|
||||
|
||||
const VkImageUsageFlags layout_usage =
|
||||
vk_image_layout_to_usage_flags(layout, aspect);
|
||||
vk_image_layout_to_usage_flags(layout, aspect) & image->vk.usage;
|
||||
|
||||
switch (aux_state) {
|
||||
case ISL_AUX_STATE_CLEAR:
|
||||
|
|
@ -3411,50 +3411,22 @@ anv_layout_to_fast_clear_type(const struct intel_device_info * const devinfo,
|
|||
|
||||
case ISL_AUX_STATE_PARTIAL_CLEAR:
|
||||
case ISL_AUX_STATE_COMPRESSED_CLEAR:
|
||||
if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||
return ANV_FAST_CLEAR_DEFAULT_VALUE;
|
||||
} else if (layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL ||
|
||||
layout == VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL) {
|
||||
/* The image might not support non zero fast clears when mutable. */
|
||||
if (!image->planes[plane].can_non_zero_fast_clear)
|
||||
return ANV_FAST_CLEAR_DEFAULT_VALUE;
|
||||
|
||||
/* When we're in a render pass we have the clear color data from the
|
||||
* VkRenderPassBeginInfo and we can use arbitrary clear colors. They
|
||||
* must get partially resolved before we leave the render pass.
|
||||
*/
|
||||
return ANV_FAST_CLEAR_ANY;
|
||||
} else if (layout_usage & (VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
|
||||
VK_IMAGE_USAGE_TRANSFER_DST_BIT)) {
|
||||
/* Fast clear with non zero color is not supported during transfer
|
||||
* operations since transfer may do format reinterpretation.
|
||||
*/
|
||||
if (!image->planes[plane].can_non_zero_fast_clear)
|
||||
return ANV_FAST_CLEAR_DEFAULT_VALUE;
|
||||
} else if (image->planes[plane].aux_usage == ISL_AUX_USAGE_MCS ||
|
||||
image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_E ||
|
||||
image->planes[plane].aux_usage == ISL_AUX_USAGE_FCV_CCS_E) {
|
||||
if (devinfo->ver >= 11) {
|
||||
/* The image might not support non zero fast clears when mutable. */
|
||||
if (!image->planes[plane].can_non_zero_fast_clear)
|
||||
return ANV_FAST_CLEAR_DEFAULT_VALUE;
|
||||
|
||||
/* On ICL and later, the sampler hardware uses a copy of the clear
|
||||
* value that is encoded as a pixel value. Therefore, we can use
|
||||
* any clear color we like for sampling.
|
||||
*/
|
||||
return ANV_FAST_CLEAR_ANY;
|
||||
} else {
|
||||
/* If the image has MCS or CCS_E enabled all the time then we can
|
||||
* use fast-clear as long as the clear color is the default value
|
||||
* of zero since this is the default value we program into every
|
||||
* surface state used for texturing.
|
||||
*/
|
||||
return ANV_FAST_CLEAR_DEFAULT_VALUE;
|
||||
}
|
||||
} else {
|
||||
return ANV_FAST_CLEAR_NONE;
|
||||
/* On gfx9, we only load clear colors for attachments and for BLORP
|
||||
* surfaces. Outside of those surfaces, we can only support the default
|
||||
* clear value of zero.
|
||||
*/
|
||||
if (devinfo->ver == 9 &&
|
||||
(layout_usage & (VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT))) {
|
||||
return ANV_FAST_CLEAR_DEFAULT_VALUE;
|
||||
}
|
||||
|
||||
return ANV_FAST_CLEAR_ANY;
|
||||
|
||||
case ISL_AUX_STATE_COMPRESSED_NO_CLEAR:
|
||||
case ISL_AUX_STATE_RESOLVED:
|
||||
case ISL_AUX_STATE_PASS_THROUGH:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue