diff options
author | Brian Paul <[email protected]> | 2011-11-10 09:51:11 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-11-11 07:10:56 -0700 |
commit | 7288bfb2a480a06605e671485ea9887f502e5e1a (patch) | |
tree | 627c1e6464c6edc6fca0dd59c04a0f16d2619fb4 /src/gallium/auxiliary/util/u_blit.c | |
parent | 2551ff5900ca02249002bf683089dc9468c49895 (diff) |
util: check for null vertex buffer object in blit code
Don't crash if we fail to allocate a vertex buffer.
Diffstat (limited to 'src/gallium/auxiliary/util/u_blit.c')
-rw-r--r-- | src/gallium/auxiliary/util/u_blit.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 6a4324bc217..3a0d7d42406 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -286,8 +286,10 @@ setup_vertex_data_tex(struct blit_state *ctx, offset = get_next_slot( ctx ); - pipe_buffer_write_nooverlap(ctx->pipe, ctx->vbuf, - offset, sizeof(ctx->vertices), ctx->vertices); + if (ctx->vbuf) { + pipe_buffer_write_nooverlap(ctx->pipe, ctx->vbuf, + offset, sizeof(ctx->vertices), ctx->vertices); + } return offset; } @@ -599,10 +601,12 @@ util_blit_pixels_writemask(struct blit_state *ctx, s1, t1, z); - util_draw_vertex_buffer(ctx->pipe, ctx->cso, ctx->vbuf, offset, - PIPE_PRIM_TRIANGLE_FAN, - 4, /* verts */ - 2); /* attribs/vert */ + if (ctx->vbuf) { + util_draw_vertex_buffer(ctx->pipe, ctx->cso, ctx->vbuf, offset, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 2); /* attribs/vert */ + } /* restore state we changed */ cso_restore_blend(ctx->cso); |