mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
panfrost: fix an incorrect stencil clear optimization
We track stencil clears and writes to optimize them. Unfortunately, the code for doing this tracks the whole resource, not individual layers or levels within the resource, which can result in incorrect output when different levels or layers are accessed. Modified to optimize only the first layer/level; this will handle the common case of a single stencil texture while allowing arrays or mipmaps to still work (albeit slightly slower). The original optimization was introduced ina2463ec271("panfrost: Constant stencil buffer tracking") but the code has been reformatted since then, so this change won't apply as-is that far back (although it's fairly obvious how to apply it by hand). Fixes:a2463ec271("panfrost: Constant stencil value tracking") Signed-off-by: Eric R. Smith <eric.smith@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28832>
This commit is contained in:
parent
e89123ec73
commit
dae6b6a23d
1 changed files with 12 additions and 9 deletions
|
|
@ -640,16 +640,19 @@ panfrost_batch_submit(struct panfrost_context *ctx,
|
|||
struct pipe_surface *surf = batch->key.zsbuf;
|
||||
struct panfrost_resource *z_rsrc = pan_resource(surf->texture);
|
||||
|
||||
/* Shared depth/stencil resources are not supported, and would
|
||||
* break this optimisation. */
|
||||
assert(!(z_rsrc->base.bind & PAN_BIND_SHARED_MASK));
|
||||
/* if there are multiple levels or layers, we optimize only the first */
|
||||
if (surf->u.tex.level == 0 && surf->u.tex.first_layer == 0) {
|
||||
/* Shared depth/stencil resources are not supported, and would
|
||||
* break this optimisation. */
|
||||
assert(!(z_rsrc->base.bind & PAN_BIND_SHARED_MASK));
|
||||
|
||||
if (batch->clear & PIPE_CLEAR_STENCIL) {
|
||||
z_rsrc->stencil_value = batch->clear_stencil;
|
||||
z_rsrc->constant_stencil = true;
|
||||
} else if (z_rsrc->constant_stencil) {
|
||||
batch->clear_stencil = z_rsrc->stencil_value;
|
||||
batch->clear |= PIPE_CLEAR_STENCIL;
|
||||
if (batch->clear & PIPE_CLEAR_STENCIL) {
|
||||
z_rsrc->stencil_value = batch->clear_stencil;
|
||||
z_rsrc->constant_stencil = true;
|
||||
} else if (z_rsrc->constant_stencil) {
|
||||
batch->clear_stencil = z_rsrc->stencil_value;
|
||||
batch->clear |= PIPE_CLEAR_STENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (batch->draws & PIPE_CLEAR_STENCIL)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue