From 02f9cddb6174f50bb01a12bf926da3fca1fa7b17 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 12 Jan 2023 20:56:23 -0500 Subject: [PATCH] panfrost: Fix clears with conditional rendering batch can be invalidated by the render condition check. Fixes nv_conditional_render-clear. Fixes: 638b22354e7 ("panfrost: Clear with a quad to avoid flushing") Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 14a244443df..db9b619f193 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -60,12 +60,15 @@ panfrost_clear(struct pipe_context *pipe, unsigned buffers, const union pipe_color_union *color, double depth, unsigned stencil) { + if (!panfrost_render_condition_check(pan_context(pipe))) + return; + + /* Only get batch after checking the render condition, since the check can + * cause the batch to be flushed. + */ struct panfrost_context *ctx = pan_context(pipe); struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); - if (!panfrost_render_condition_check(ctx)) - return; - /* At the start of the batch, we can clear for free */ if (!batch->scoreboard.first_job) { panfrost_batch_clear(batch, buffers, color, depth, stencil);