summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-08-01 12:50:03 -0400
committerJonathan Marek <[email protected]>2019-08-02 15:58:22 +0000
commit2e029acbe28903fc91e5411a8239d261b3783644 (patch)
tree08ba162f0571142aa7f678935113a9eaf71c390c /src/gallium
parente25388c97b67f626aa8135e84282312128d90f78 (diff)
freedreno: a2xx: fix fast clear not being used for Z24X8 buffers
Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/freedreno/a2xx/fd2_draw.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c
index ecc0798679d..6969ed90fcd 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c
@@ -428,17 +428,21 @@ fd2_clear_fast(struct fd_context *ctx, unsigned buffers,
if (buffers & PIPE_CLEAR_COLOR)
color_size = util_format_get_blocksizebits(format) == 32;
- if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))
+ if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) {
+ /* no fast clear when clearing only one component of depth+stencil buffer */
+ if (!(buffers & PIPE_CLEAR_DEPTH))
+ return false;
+
+ if ((pfb->zsbuf->format == PIPE_FORMAT_Z24_UNORM_S8_UINT ||
+ pfb->zsbuf->format == PIPE_FORMAT_S8_UINT_Z24_UNORM) &&
+ !(buffers & PIPE_CLEAR_STENCIL))
+ return false;
+
depth_size = fd_pipe2depth(pfb->zsbuf->format) == DEPTHX_24_8;
+ }
assert(color_size >= 0 || depth_size >= 0);
- /* when clearing 24_8, depth/stencil must be both cleared
- * TODO: if buffer isn't attached we can clear it anyway
- */
- if (depth_size == 1 && !(buffers & PIPE_CLEAR_STENCIL) != !(buffers & PIPE_CLEAR_DEPTH))
- return false;
-
if (color_size == 0) {
color_clear = pack_rgba(format, color->f);
color_clear = (color_clear << 16) | (color_clear & 0xffff);