From 97dedfda5fbb4078db28519e50adeeeb8e1a1dc1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 10 Nov 2011 09:47:37 -0700 Subject: vbo: better handling of VBO allocation failures Previously, if we failed to allocate a VBO (either for display list compilation or immediate mode rendering) we'd eventually segfault when trying to map the non-existant buffer or in a glVertex/Color/etc call when we hit a null pointer. Now we don't try to map non-existant buffers and if we do fail to allocate a VBO we plug in no-op functions for glVertex/Color/etc so we don't segfault. --- src/mesa/vbo/vbo_save.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mesa/vbo/vbo_save.h') diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index a85a7cbf631..4d4a5bf1710 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -122,6 +122,7 @@ struct vbo_save_primitive_store { struct vbo_save_context { struct gl_context *ctx; GLvertexformat vtxfmt; + GLvertexformat vtxfmt_noop; /**< Used if out_of_memory is true */ struct gl_client_array arrays[VBO_ATTRIB_MAX]; const struct gl_client_array *inputs[VBO_ATTRIB_MAX]; @@ -129,6 +130,8 @@ struct vbo_save_context { GLubyte active_sz[VBO_ATTRIB_MAX]; GLuint vertex_size; + GLboolean out_of_memory; /**< True if last VBO allocation failed */ + GLfloat *buffer; GLuint count; GLuint wrap_count; -- cgit v1.2.3