diff options
author | Brian Paul <[email protected]> | 2011-11-10 09:50:42 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-11-11 07:10:56 -0700 |
commit | 2551ff5900ca02249002bf683089dc9468c49895 (patch) | |
tree | 4e12559641a88d09dcf5b65339aaed54254ff8d1 /src | |
parent | 97dedfda5fbb4078db28519e50adeeeb8e1a1dc1 (diff) |
st/mesa: fix OOM failure in bitmap code
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_cb_bitmap.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 1a8854b9bce..fa37be0b66f 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -376,6 +376,10 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized, PIPE_USAGE_STREAM, max_slots * sizeof(st->bitmap.vertices)); + if (!st->bitmap.vbuf) { + /* out of memory */ + return 0; + } } /* Positions are in clip coords since we need to do clipping in case @@ -547,11 +551,12 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, sv->texture->target != PIPE_TEXTURE_RECT, x, y, width, height, z, color); - util_draw_vertex_buffer(pipe, st->cso_context, st->bitmap.vbuf, offset, - PIPE_PRIM_TRIANGLE_FAN, - 4, /* verts */ - 3); /* attribs/vert */ - + if (st->bitmap.vbuf) { + util_draw_vertex_buffer(pipe, st->cso_context, st->bitmap.vbuf, offset, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 3); /* attribs/vert */ + } /* restore state */ cso_restore_rasterizer(cso); |