u_blitter+d3d12: Move stencil fallback clear to caller

The other callers were already doing the prepatory stencil clear before
calling util_blitter_stencil_fallback().  Doing the clear in the driver
avoids recursively entering u_blitter if the driver uses
util_blitter_clear_depth_stencil() to implement ->clear_depth_stencil().

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30064>
This commit is contained in:
Rob Clark
2024-07-14 08:38:46 -07:00
committed by Marge Bot
parent 9372875222
commit 5056f5b69c
2 changed files with 12 additions and 11 deletions
-11
View File
@@ -2937,18 +2937,7 @@ util_blitter_stencil_fallback(struct blitter_context *blitter,
blitter_set_dst_dimensions(ctx, dst_view->width, dst_view->height);
if (scissor) {
pipe->clear_depth_stencil(pipe, dst_view, PIPE_CLEAR_STENCIL, 0.0, 0,
MAX2(dstbox->x, scissor->minx),
MAX2(dstbox->y, scissor->miny),
MIN2(dstbox->x + dstbox->width, scissor->maxx) - dstbox->x,
MIN2(dstbox->y + dstbox->height, scissor->maxy) - dstbox->y,
true);
pipe->set_scissor_states(pipe, 0, 1, scissor);
} else {
pipe->clear_depth_stencil(pipe, dst_view, PIPE_CLEAR_STENCIL, 0.0, 0,
dstbox->x, dstbox->y,
dstbox->width, dstbox->height,
true);
}
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, false, &src_view);
+12
View File
@@ -599,6 +599,7 @@ static void
blit_replicate_stencil(struct d3d12_context *ctx,
const struct pipe_blit_info *info)
{
struct pipe_context *pctx = &ctx->base;
assert(info->mask & PIPE_MASK_S);
if (D3D12_DEBUG_BLIT & d3d12_debug)
@@ -611,6 +612,15 @@ blit_replicate_stencil(struct d3d12_context *ctx,
util_blit(ctx, &new_info);
}
struct pipe_surface *dst_view, dst_templ;
util_blitter_default_dst_texture(&dst_templ, info->dst.resource,
info->dst.level, info->dst.box.z);
dst_view = pctx->create_surface(pctx, info->dst.resource, &dst_templ);
util_blit_save_state(ctx);
util_blitter_clear_depth_stencil(ctx->blitter, dst_view, PIPE_CLEAR_STENCIL,
0, 0, info->dst.box.x, info->dst.box.y,
info->dst.box.width, info->dst.box.height);
util_blit_save_state(ctx);
util_blitter_stencil_fallback(ctx->blitter, info->dst.resource,
info->dst.level,
@@ -619,6 +629,8 @@ blit_replicate_stencil(struct d3d12_context *ctx,
info->src.level,
&info->src.box,
info->scissor_enable ? &info->scissor : NULL);
pipe_surface_release(pctx, &dst_view);
}
void