freedreno/batch: replace lrz_clear with prologue
[mesa.git] / src / gallium / drivers / freedreno / a6xx / fd6_draw.c
index dd9c75051c9487264144815b7ee3036945540504..3e9ec98d5fca5d486e79c26a68b812be7c68f464 100644 (file)
@@ -178,10 +178,16 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
                .primitive_restart = info->primitive_restart && info->index_size,
        };
 
+       if (!(ctx->prog.vs && ctx->prog.fs))
+               return false;
+
        if (info->mode == PIPE_PRIM_PATCHES) {
                emit.key.hs = ctx->prog.hs;
                emit.key.ds = ctx->prog.ds;
 
+               if (!(ctx->prog.hs && ctx->prog.ds))
+                       return false;
+
                shader_info *ds_info = &emit.key.ds->nir->info;
                emit.key.key.tessellation = ir3_tess_mode(ds_info->tess.primitive_mode);
        }
@@ -204,6 +210,8 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
        if (!fd6_ctx->prog)
                return NULL;
 
+       fixup_draw_state(ctx, &emit);
+
        emit.dirty = ctx->dirty;      /* *after* fixup_shader_state() */
        emit.bs = fd6_emit_get_prog(&emit)->bs;
        emit.vs = fd6_emit_get_prog(&emit)->vs;
@@ -297,8 +305,6 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
                ctx->last.restart_index = restart_index;
        }
 
-       fixup_draw_state(ctx, &emit);
-
        fd6_emit_state(ring, &emit);
 
        /* for debug after a lock up, write a unique counter value
@@ -339,12 +345,7 @@ fd6_clear_lrz(struct fd_batch *batch, struct fd_resource *zsbuf, double depth)
        struct fd_ringbuffer *ring;
        struct fd6_context *fd6_ctx = fd6_context(batch->ctx);
 
-       if (batch->lrz_clear) {
-               fd_ringbuffer_del(batch->lrz_clear);
-       }
-
-       batch->lrz_clear = fd_submit_new_ringbuffer(batch->submit, 0x1000, 0);
-       ring = batch->lrz_clear;
+       ring = fd_batch_get_prologue(batch);
 
        emit_marker6(ring, 7);
        OUT_PKT7(ring, CP_SET_MARKER, 1);