From 7d51a10cdadda5ae066872fc7382fd87d679a558 Mon Sep 17 00:00:00 2001 From: Jose Maria Casanova Crespo Date: Wed, 9 Jul 2025 18:47:26 +0200 Subject: [PATCH] v3d: Fix depth resource invalidation with separate_stencil If there is a separate stencil in use, the resource invalidation flag was not being removed for the depth buffer as rsc was assigned to the separate stencil. Fixes: 6ff509593ce ("v3d: Only apply TLB load invalidation on first job after FB state update") Reviewed-by: Iago Toral Quiroga Part-of: --- src/gallium/drivers/v3d/v3d_job.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/v3d/v3d_job.c b/src/gallium/drivers/v3d/v3d_job.c index 3adb3f73f46..336a2ae08e7 100644 --- a/src/gallium/drivers/v3d/v3d_job.c +++ b/src/gallium/drivers/v3d/v3d_job.c @@ -443,7 +443,7 @@ v3d_get_job_for_fbo(struct v3d_context *v3d) struct v3d_resource *rsc = v3d_resource(cbufs[i].texture); if (!rsc->writes) job->clear_tlb |= PIPE_CLEAR_COLOR0 << i; - /* Loads invalidations only applies to the first job + /* Load invalidation only applies to the first job * submitted after a framebuffer state update */ if (rsc->invalidated && @@ -456,13 +456,12 @@ v3d_get_job_for_fbo(struct v3d_context *v3d) if (zsbuf->texture) { struct v3d_resource *rsc = v3d_resource(zsbuf->texture); - if (!rsc->writes) + if (!rsc->writes) { job->clear_tlb |= PIPE_CLEAR_DEPTH; - - if (rsc->separate_stencil) - rsc = rsc->separate_stencil; - - if (!rsc->writes) + if (!rsc->separate_stencil) + job->clear_tlb |= PIPE_CLEAR_STENCIL; + } + if (rsc->separate_stencil && !rsc->separate_stencil->writes) job->clear_tlb |= PIPE_CLEAR_STENCIL; /* Loads invalidations only applies to the first job submitted * after a framebuffer state update