aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_save.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-11-10 09:47:37 -0700
committerBrian Paul <[email protected]>2011-11-11 07:10:56 -0700
commit97dedfda5fbb4078db28519e50adeeeb8e1a1dc1 (patch)
tree2620b2c03120e2e748d3798b1aa5f3ea6c909712 /src/mesa/vbo/vbo_save.h
parente6c4159372310110ec81273c5d15481c903fefed (diff)
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.
Diffstat (limited to 'src/mesa/vbo/vbo_save.h')
-rw-r--r--src/mesa/vbo/vbo_save.h3
1 files changed, 3 insertions, 0 deletions
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;