diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 60187048b46..38626fe677f 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -392,6 +392,12 @@ agx_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor if (buffers & PIPE_CLEAR_COLOR0) memcpy(ctx->batch->clear_color, color->f, sizeof(color->f)); + + if (buffers & PIPE_CLEAR_DEPTH) + ctx->batch->clear_depth = depth; + + if (buffers & PIPE_CLEAR_STENCIL) + ctx->batch->clear_stencil = stencil; } @@ -544,7 +550,9 @@ agx_flush(struct pipe_context *pctx, pipeline_null.gpu, pipeline_clear, pipeline_store, - clear_pipeline_textures); + clear_pipeline_textures, + ctx->batch->clear_depth, + ctx->batch->clear_stencil); /* Generate the mapping table from the BO list */ demo_mem_map(dev->memmap.ptr.cpu, dev->memmap.size, handles, handle_count, diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index cc0a187250a..2de160bc329 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -103,6 +103,8 @@ struct agx_batch { uint32_t clear, draw; float clear_color[4]; + double clear_depth; + unsigned clear_stencil; /* Resource list requirements, represented as a bit set indexed by BO * handles (GEM handles on Linux, or IOGPU's equivalent on macOS) */ diff --git a/src/gallium/drivers/asahi/magic.c b/src/gallium/drivers/asahi/magic.c index 049d2b3e7e1..c05c9a0ff3d 100644 --- a/src/gallium/drivers/asahi/magic.c +++ b/src/gallium/drivers/asahi/magic.c @@ -165,7 +165,9 @@ demo_cmdbuf(uint64_t *buf, size_t size, uint32_t pipeline_null, uint32_t pipeline_clear, uint32_t pipeline_store, - bool clear_pipeline_textures) + bool clear_pipeline_textures, + double clear_depth, + unsigned clear_stencil) { uint32_t *map = (uint32_t *) buf; memset(map, 0, 518 * 4); @@ -233,8 +235,8 @@ demo_cmdbuf(uint64_t *buf, size_t size, } agx_pack(map + 292, IOGPU_CLEAR_Z_S, cfg) { - cfg.depth_clear_value = fui(1.0); // TODO - cfg.stencil_clear_value = 0; + cfg.depth_clear_value = fui(clear_depth); + cfg.stencil_clear_value = clear_stencil; } map[312] = 0xffff8212; diff --git a/src/gallium/drivers/asahi/magic.h b/src/gallium/drivers/asahi/magic.h index 506784b8e1b..c405cbe51e5 100644 --- a/src/gallium/drivers/asahi/magic.h +++ b/src/gallium/drivers/asahi/magic.h @@ -34,7 +34,9 @@ demo_cmdbuf(uint64_t *buf, size_t size, uint32_t pipeline_null, uint32_t pipeline_clear, uint32_t pipeline_store, - bool clear_pipeline_textures); + bool clear_pipeline_textures, + double clear_depth, + unsigned clear_stencil); void demo_mem_map(void *map, size_t size, unsigned *handles,