aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/lima/lima_resource.c
diff options
context:
space:
mode:
authorIcenowy Zheng <[email protected]>2020-02-07 00:53:46 +0800
committerMarge Bot <[email protected]>2020-03-18 08:36:17 +0000
commit9205762caece0c4b9ecea3d56f72c6980935633a (patch)
tree24781439690e97cf0c07e6547efe74a996d48c80 /src/gallium/drivers/lima/lima_resource.c
parentdbceabed72977ffd49d84f926c59ff97554f349d (diff)
lima: implement zsbuf reload
Fragment shader can write depth and stencil if we set necessary flags in RSW. In addition to that we need to use special format for Z24S8. Original format is apparently Z24X8 since we can't sample stencil in GLES2. This new format also seems to use several components for storing depth since we saw r != g != b when sampling with this format. [vasily: - initialize clear->depth to 0xffffff if we reload depth, just like blob does. Reloading doesn't work otherwise - use single bitmap for reload type] Reviewed-by: Vasily Khoruzhick <[email protected]> Reviewed-by: Andreas Baierl <[email protected]> Signed-off-by: Icenowy Zheng <[email protected]> Signed-off-by: Vasily Khoruzhick <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4197>
Diffstat (limited to 'src/gallium/drivers/lima/lima_resource.c')
-rw-r--r--src/gallium/drivers/lima/lima_resource.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c
index 9f429f8c32a..e60a46b7ae8 100644
--- a/src/gallium/drivers/lima/lima_resource.c
+++ b/src/gallium/drivers/lima/lima_resource.c
@@ -508,7 +508,13 @@ lima_surface_create(struct pipe_context *pctx,
surf->tiled_w = align(psurf->width, 16) >> 4;
surf->tiled_h = align(psurf->height, 16) >> 4;
- surf->reload = true;
+ surf->reload = 0;
+ if (util_format_has_stencil(util_format_description(psurf->format)))
+ surf->reload |= PIPE_CLEAR_STENCIL;
+ if (util_format_has_depth(util_format_description(psurf->format)))
+ surf->reload |= PIPE_CLEAR_DEPTH;
+ if (!util_format_is_depth_or_stencil(psurf->format))
+ surf->reload |= PIPE_CLEAR_COLOR0;
return &surf->base;
}