summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2011-11-10 09:51:57 -0700
committerBrian Paul <brianp@vmware.com>2011-11-11 07:10:56 -0700
commitaa661306828b8c76c1511f05e0fae577f06477b8 (patch)
tree01a332915cf90866759f6863ee626d3c268e0804 /src
parent7288bfb2a480a06605e671485ea9887f502e5e1a (diff)
draw: handle out of memory conditions
If the vbuf backend fails to allocate a vertex buffer, don't crash or assert.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_vbuf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index a9b0f22c488..578433c2006 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -130,7 +130,7 @@ static INLINE ushort
emit_vertex( struct vbuf_stage *vbuf,
struct vertex_header *vertex )
{
- if(vertex->vertex_id == UNDEFINED_VERTEX_ID) {
+ if (vertex->vertex_id == UNDEFINED_VERTEX_ID && vbuf->vertex_ptr) {
/* Hmm - vertices are emitted one at a time - better make sure
* set_buffer is efficient. Consider a special one-shot mode for
* translate.
@@ -357,8 +357,10 @@ vbuf_flush_vertices( struct vbuf_stage *vbuf )
static void
vbuf_alloc_vertices( struct vbuf_stage *vbuf )
{
- assert(!vbuf->nr_indices);
- assert(!vbuf->vertices);
+ if (vbuf->vertex_ptr) {
+ assert(!vbuf->nr_indices);
+ assert(!vbuf->vertices);
+ }
/* Allocate a new vertex buffer */
vbuf->max_vertices = vbuf->render->max_vertex_buffer_bytes / vbuf->vertex_size;