panfrost: Fix clears with conditional rendering

batch can be invalidated by the render condition check.

Fixes nv_conditional_render-clear.

Fixes: 638b22354e ("panfrost: Clear with a quad to avoid flushing")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20689>
This commit is contained in:
Alyssa Rosenzweig 2023-01-12 20:56:23 -05:00 committed by Marge Bot
parent 7c7c38b126
commit 02f9cddb61

View file

@ -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);