summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/v3d
diff options
context:
space:
mode:
authorAlejandro Piñeiro <[email protected]>2019-07-29 13:06:44 +0200
committerAlejandro Piñeiro <[email protected]>2019-07-30 12:05:23 +0200
commitcda4c628936ed85c2cace082efc848721a123246 (patch)
tree36cffa48f663e27277f62c15bbff751131f38b82 /src/gallium/drivers/v3d
parent45638e14fb9d4ca66de12fbbf2aba35c3665341e (diff)
v3d: take into account separate_stencil when checking if stencil should be cleared
In most cases this is not needed because the usual is that when a separate stencil is written, the parent resource is also written. This is needed if we have a separate stencil, no depth buffer, and the source and destination is the same, as in that case the stencil can be updated, but not the parent source (like if you are blitting only the stencil buffer). On that situation, the following access to the stencil buffer would clear the stencil buffer (so overwritting the previous blitting) cleared because the parent source has v3d_resource.writes to 0. As far as I see, that situation only happens with the GL_DEPTH32F_STENCIL8 format. Note that one alternative would consider that if the separate_stencil has been written, the parent should also be considered written (and update its "writes" field accordingly). But I found this patch more natural. Fixes the following piglit tests: spec/arb_depth_buffer_float/fbo-stencil-gl_depth32f_stencil8-blit spec/arb_depth_buffer_float/fbo-stencil-gl_depth32f_stencil8-copypixels the latter regressed when internally glCopyPixels implementation started to use blitting. So: Fixes: 131d40cfc91f ("st/mesa: accelerate glCopyPixels(STENCIL)") Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/gallium/drivers/v3d')
-rw-r--r--src/gallium/drivers/v3d/v3d_job.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gallium/drivers/v3d/v3d_job.c b/src/gallium/drivers/v3d/v3d_job.c
index 9b24f12e7e9..9892e0ecff2 100644
--- a/src/gallium/drivers/v3d/v3d_job.c
+++ b/src/gallium/drivers/v3d/v3d_job.c
@@ -384,7 +384,13 @@ v3d_get_job_for_fbo(struct v3d_context *v3d)
if (zsbuf) {
struct v3d_resource *rsc = v3d_resource(zsbuf->texture);
if (!rsc->writes)
- job->clear |= PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL;
+ job->clear |= PIPE_CLEAR_DEPTH;
+
+ if (rsc->separate_stencil)
+ rsc = rsc->separate_stencil;
+
+ if (!rsc->writes)
+ job->clear |= PIPE_CLEAR_STENCIL;
}
job->draw_tiles_x = DIV_ROUND_UP(v3d->framebuffer.width,