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>
(cherry picked from commit 02f9cddb61)
This commit is contained in:
Alyssa Rosenzweig 2023-01-12 20:56:23 -05:00 committed by Eric Engestrom
parent bc198e8005
commit ff6a911fd4
2 changed files with 7 additions and 4 deletions

View file

@ -4711,7 +4711,7 @@
"description": "panfrost: Fix clears with conditional rendering",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "638b22354e75fa31551f776a2cd2bbf752db1ad5"
},

View file

@ -61,12 +61,15 @@ panfrost_clear(
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);