anv: Replace anv_image_has_hiz() with ISL_AUX_USAGE_HIZ
The helper doesn't provide additional functionality over the current infrastructure. v2: Add comment to anv_image::aux_usage (Jason Ekstrand) v3: Clarify comment for aux_usage (Jason Ekstrand) Signed-off-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
@@ -858,7 +858,7 @@ void anv_CmdClearDepthStencilImage(
|
|||||||
struct blorp_surf depth, stencil;
|
struct blorp_surf depth, stencil;
|
||||||
if (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
if (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||||
get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_DEPTH_BIT,
|
get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_DEPTH_BIT,
|
||||||
image->aux_usage, &depth);
|
ISL_AUX_USAGE_NONE, &depth);
|
||||||
} else {
|
} else {
|
||||||
memset(&depth, 0, sizeof(depth));
|
memset(&depth, 0, sizeof(depth));
|
||||||
}
|
}
|
||||||
|
@@ -195,6 +195,7 @@ make_surface(const struct anv_device *dev,
|
|||||||
isl_surf_get_hiz_surf(&dev->isl_dev, &image->depth_surface.isl,
|
isl_surf_get_hiz_surf(&dev->isl_dev, &image->depth_surface.isl,
|
||||||
&image->aux_surface.isl);
|
&image->aux_surface.isl);
|
||||||
add_surface(image, &image->aux_surface);
|
add_surface(image, &image->aux_surface);
|
||||||
|
image->aux_usage = ISL_AUX_USAGE_HIZ;
|
||||||
}
|
}
|
||||||
} else if (aspect == VK_IMAGE_ASPECT_COLOR_BIT && vk_info->samples == 1) {
|
} else if (aspect == VK_IMAGE_ASPECT_COLOR_BIT && vk_info->samples == 1) {
|
||||||
if (!unlikely(INTEL_DEBUG & DEBUG_NO_RBC)) {
|
if (!unlikely(INTEL_DEBUG & DEBUG_NO_RBC)) {
|
||||||
@@ -523,6 +524,11 @@ anv_CreateImageView(VkDevice _device,
|
|||||||
iview->isl.usage = 0;
|
iview->isl.usage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sampling from HiZ is not yet enabled */
|
||||||
|
enum isl_aux_usage surf_usage = image->aux_usage;
|
||||||
|
if (surf_usage == ISL_AUX_USAGE_HIZ)
|
||||||
|
surf_usage = ISL_AUX_USAGE_NONE;
|
||||||
|
|
||||||
/* Input attachment surfaces for color or depth are allocated and filled
|
/* Input attachment surfaces for color or depth are allocated and filled
|
||||||
* out at BeginRenderPass time because they need compression information.
|
* out at BeginRenderPass time because they need compression information.
|
||||||
* Stencil image do not support compression so we just use the texture
|
* Stencil image do not support compression so we just use the texture
|
||||||
@@ -540,7 +546,7 @@ anv_CreateImageView(VkDevice _device,
|
|||||||
.surf = &surface->isl,
|
.surf = &surface->isl,
|
||||||
.view = &view,
|
.view = &view,
|
||||||
.aux_surf = &image->aux_surface.isl,
|
.aux_surf = &image->aux_surface.isl,
|
||||||
.aux_usage = image->aux_usage,
|
.aux_usage = surf_usage,
|
||||||
.mocs = device->default_mocs);
|
.mocs = device->default_mocs);
|
||||||
|
|
||||||
if (!device->info.has_llc)
|
if (!device->info.has_llc)
|
||||||
@@ -564,7 +570,7 @@ anv_CreateImageView(VkDevice _device,
|
|||||||
.surf = &surface->isl,
|
.surf = &surface->isl,
|
||||||
.view = &view,
|
.view = &view,
|
||||||
.aux_surf = &image->aux_surface.isl,
|
.aux_surf = &image->aux_surface.isl,
|
||||||
.aux_usage = image->aux_usage,
|
.aux_usage = surf_usage,
|
||||||
.mocs = device->default_mocs);
|
.mocs = device->default_mocs);
|
||||||
} else {
|
} else {
|
||||||
anv_fill_buffer_surface_state(device, iview->storage_surface_state,
|
anv_fill_buffer_surface_state(device, iview->storage_surface_state,
|
||||||
|
@@ -1581,7 +1581,13 @@ struct anv_image {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The aux usage for this surface when outside a render pass */
|
/**
|
||||||
|
* For color images, this is the aux usage for this image when not used as a
|
||||||
|
* color attachment.
|
||||||
|
*
|
||||||
|
* For depth/stencil images, this is set to ISL_AUX_USAGE_HIZ if the image
|
||||||
|
* has a HiZ buffer.
|
||||||
|
*/
|
||||||
enum isl_aux_usage aux_usage;
|
enum isl_aux_usage aux_usage;
|
||||||
|
|
||||||
struct anv_surface aux_surface;
|
struct anv_surface aux_surface;
|
||||||
@@ -1642,16 +1648,6 @@ const struct anv_surface *
|
|||||||
anv_image_get_surface_for_aspect_mask(const struct anv_image *image,
|
anv_image_get_surface_for_aspect_mask(const struct anv_image *image,
|
||||||
VkImageAspectFlags aspect_mask);
|
VkImageAspectFlags aspect_mask);
|
||||||
|
|
||||||
static inline bool
|
|
||||||
anv_image_has_hiz(const struct anv_image *image)
|
|
||||||
{
|
|
||||||
/* We must check the aspect because anv_image::aux_surface may be used for
|
|
||||||
* any type of auxiliary surface, not just HiZ.
|
|
||||||
*/
|
|
||||||
return (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&
|
|
||||||
image->aux_surface.isl.size > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct anv_buffer_view {
|
struct anv_buffer_view {
|
||||||
enum isl_format format; /**< VkBufferViewCreateInfo::format */
|
enum isl_format format; /**< VkBufferViewCreateInfo::format */
|
||||||
struct anv_bo *bo;
|
struct anv_bo *bo;
|
||||||
|
@@ -337,7 +337,7 @@ genX(cmd_buffer_emit_hz_op)(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
const struct anv_image_view *iview =
|
const struct anv_image_view *iview =
|
||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
|
|
||||||
if (iview == NULL || !anv_image_has_hiz(iview->image))
|
if (iview == NULL || iview->image->aux_usage != ISL_AUX_USAGE_HIZ)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* FINISHME: Implement multi-subpass HiZ */
|
/* FINISHME: Implement multi-subpass HiZ */
|
||||||
|
@@ -2087,7 +2087,7 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
const struct anv_image *image = iview ? iview->image : NULL;
|
const struct anv_image *image = iview ? iview->image : NULL;
|
||||||
const bool has_depth = image && (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT);
|
const bool has_depth = image && (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT);
|
||||||
const bool has_hiz = image != NULL && anv_image_has_hiz(image);
|
const bool has_hiz = image != NULL && image->aux_usage == ISL_AUX_USAGE_HIZ;
|
||||||
const bool has_stencil =
|
const bool has_stencil =
|
||||||
image && (image->aspects & VK_IMAGE_ASPECT_STENCIL_BIT);
|
image && (image->aspects & VK_IMAGE_ASPECT_STENCIL_BIT);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user