freedreno/ir3: fix crash in fail path
authorRob Clark <robclark@freedesktop.org>
Fri, 26 Jun 2015 17:38:03 +0000 (13:38 -0400)
committerRob Clark <robclark@freedesktop.org>
Tue, 30 Jun 2015 16:13:44 +0000 (12:13 -0400)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/a3xx/fd3_draw.c
src/gallium/drivers/freedreno/a4xx/fd4_draw.c
src/gallium/drivers/freedreno/ir3/ir3_shader.c

index b5838b58eb24308d6812b4158c0d1dec4a38b127..29f4bae93fa9fbfb7d9329c8cccb67be9de23e1c 100644 (file)
@@ -60,6 +60,9 @@ draw_impl(struct fd_context *ctx, struct fd_ringbuffer *ring,
        const struct pipe_draw_info *info = emit->info;
        enum pc_di_primtype primtype = ctx->primtypes[info->mode];
 
+       if (!(fd3_emit_get_vp(emit) && fd3_emit_get_fp(emit)))
+               return;
+
        fd3_emit_state(ctx, ring, emit);
 
        if (emit->dirty & (FD_DIRTY_VTXBUF | FD_DIRTY_VTXSTATE))
index de5a306af609ac517bdc6d08e8161cfb9651afa7..d070f5fd6b7c8ff50c9ffa5c6c582f5305e98c20 100644 (file)
@@ -48,6 +48,9 @@ draw_impl(struct fd_context *ctx, struct fd_ringbuffer *ring,
 {
        const struct pipe_draw_info *info = emit->info;
 
+       if (!(fd4_emit_get_vp(emit) && fd4_emit_get_fp(emit)))
+               return;
+
        fd4_emit_state(ctx, ring, emit);
 
        if (emit->dirty & (FD_DIRTY_VTXBUF | FD_DIRTY_VTXSTATE))
index b5b038100cce8c9a3f02ac5b0ad95d1ff2f6736b..c22b7f8d16902e032135815f8dd19af2acc6357f 100644 (file)
@@ -46,7 +46,8 @@ delete_variant(struct ir3_shader_variant *v)
 {
        if (v->ir)
                ir3_destroy(v->ir);
-       fd_bo_del(v->bo);
+       if (v->bo)
+               fd_bo_del(v->bo);
        free(v);
 }
 
@@ -228,8 +229,10 @@ ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key)
 
        /* compile new variant if it doesn't exist already: */
        v = create_variant(shader, key);
-       v->next = shader->variants;
-       shader->variants = v;
+       if (v) {
+               v->next = shader->variants;
+               shader->variants = v;
+       }
 
        return v;
 }