[Mesa-dev] [PATCH 18/29] intel/blorp: Add a blorp_hiz_clear_depth_stencil helper
Pohjolainen, Topi
topi.pohjolainen at gmail.com
Mon Dec 18 18:23:43 UTC 2017
On Mon, Nov 27, 2017 at 07:06:08PM -0800, Jason Ekstrand wrote:
> This is similar to blorp_gen8_hiz_clear_attachments except that it takes
> actual images instead of trusting in the already set depth state.
> ---
> src/intel/blorp/blorp.h | 11 ++++++++++
> src/intel/blorp/blorp_clear.c | 50 +++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 61 insertions(+)
>
> diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
> index a1dd571..208b2db 100644
> --- a/src/intel/blorp/blorp.h
> +++ b/src/intel/blorp/blorp.h
> @@ -170,6 +170,17 @@ blorp_can_hiz_clear_depth(uint8_t gen, enum isl_format format,
> uint32_t num_samples,
> uint32_t x0, uint32_t y0,
> uint32_t x1, uint32_t y1);
> +void
> +blorp_hiz_clear_depth_stencil(struct blorp_batch *batch,
> + const struct blorp_surf *depth,
> + const struct blorp_surf *stencil,
> + uint32_t level,
> + uint32_t start_layer, uint32_t num_layers,
> + uint32_t x0, uint32_t y0,
> + uint32_t x1, uint32_t y1,
> + bool clear_depth, float depth_value,
> + bool clear_stencil, uint8_t stencil_value);
> +
>
> void
> blorp_gen8_hiz_clear_attachments(struct blorp_batch *batch,
> diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
> index 8e7bc9f..ec859c2 100644
> --- a/src/intel/blorp/blorp_clear.c
> +++ b/src/intel/blorp/blorp_clear.c
> @@ -612,6 +612,56 @@ blorp_can_hiz_clear_depth(uint8_t gen, enum isl_format format,
> return true;
> }
>
> +void
> +blorp_hiz_clear_depth_stencil(struct blorp_batch *batch,
> + const struct blorp_surf *depth,
> + const struct blorp_surf *stencil,
> + uint32_t level,
> + uint32_t start_layer, uint32_t num_layers,
> + uint32_t x0, uint32_t y0,
> + uint32_t x1, uint32_t y1,
> + bool clear_depth, float depth_value,
> + bool clear_stencil, uint8_t stencil_value)
> +{
> + struct blorp_params params;
> + blorp_params_init(¶ms);
> +
> + /* This requires WM_HZ_OP which only exists on gen8+ */
> + assert(ISL_DEV_GEN(batch->blorp->isl_dev) >= 8);
> +
> + params.hiz_op = BLORP_HIZ_OP_DEPTH_CLEAR;
> + params.num_layers = 1;
> +
> + params.x0 = x0;
> + params.y0 = y0;
> + params.x1 = x1;
> + params.y1 = y1;
> +
> + for (uint32_t l = 0; l < num_layers; l++) {
> + const uint32_t layer = start_layer + l;
> + if (clear_stencil) {
> + brw_blorp_surface_info_init(batch->blorp, ¶ms.stencil, stencil,
> + level, layer,
> + ISL_FORMAT_UNSUPPORTED, true);
> + params.stencil_mask = 0xff;
In blorp_gen8_hiz_clear_attachments() this isn't actually set. Did we possibly
have a bug there?
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> + params.stencil_ref = stencil_value;
> + params.num_samples = params.stencil.surf.samples;
> + }
> +
> + if (clear_depth) {
> + brw_blorp_surface_info_init(batch->blorp, ¶ms.depth, depth,
> + level, layer,
> + ISL_FORMAT_UNSUPPORTED, true);
> + params.depth.clear_color.f32[0] = depth_value;
> + params.depth_format =
> + isl_format_get_depth_format(depth->surf->format, false);
> + params.num_samples = params.depth.surf.samples;
> + }
> +
> + batch->blorp->exec(batch, ¶ms);
> + }
> +}
> +
> /* Given a depth stencil attachment, this function performs a fast depth clear
> * on a depth portion and a regular clear on the stencil portion. When
> * performing a fast depth clear on the depth portion, the HiZ buffer is simply
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list