asahi: Hide ctx->batch
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 17 Nov 2022 22:22:45 +0000 (17:22 -0500)
committerMarge Bot <emma+marge@anholt.net>
Sat, 19 Nov 2022 15:33:16 +0000 (15:33 +0000)
This will make it easier to support multiple batches.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19865>

src/gallium/drivers/asahi/agx_pipe.c

index 5d449bd..5b77b6d 100644 (file)
@@ -659,34 +659,35 @@ agx_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor
           const union pipe_color_union *color, double depth, unsigned stencil)
 {
    struct agx_context *ctx = agx_context(pctx);
+   struct agx_batch *batch = ctx->batch;
 
-   unsigned fastclear = buffers & ~(ctx->batch->draw | ctx->batch->load);
+   unsigned fastclear = buffers & ~(batch->draw | batch->load);
    unsigned slowclear = buffers & ~fastclear;
 
    assert(scissor_state == NULL && "we don't support PIPE_CAP_CLEAR_SCISSORED");
 
    /* Fast clears configure the batch */
    if (fastclear & PIPE_CLEAR_COLOR0)
-      memcpy(ctx->batch->clear_color, color->f, sizeof(color->f));
+      memcpy(batch->clear_color, color->f, sizeof(color->f));
 
    if (fastclear & PIPE_CLEAR_DEPTH)
-      ctx->batch->clear_depth = depth;
+      batch->clear_depth = depth;
 
    if (fastclear & PIPE_CLEAR_STENCIL)
-      ctx->batch->clear_stencil = stencil;
+      batch->clear_stencil = stencil;
 
    /* Slow clears draw a fullscreen rectangle */
    if (slowclear) {
       agx_blitter_save(ctx, ctx->blitter, false /* render cond */);
       util_blitter_clear(ctx->blitter, ctx->framebuffer.width,
-            ctx->framebuffer.height,
-            util_framebuffer_get_num_layers(&ctx->framebuffer),
-            slowclear, color, depth, stencil,
-            util_framebuffer_get_num_samples(&ctx->framebuffer) > 1);
+                         ctx->framebuffer.height,
+                         util_framebuffer_get_num_layers(&ctx->framebuffer),
+                         slowclear, color, depth, stencil,
+                         util_framebuffer_get_num_samples(&ctx->framebuffer) > 1);
    }
 
-   ctx->batch->clear |= fastclear;
-   assert((ctx->batch->draw & slowclear) == slowclear);
+   batch->clear |= fastclear;
+   assert((batch->draw & slowclear) == slowclear);
 }