summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2009-12-20 05:03:03 -0800
committerJosé Fonseca <jfonseca@vmware.com>2009-12-23 16:33:54 +0000
commit8e8502bc6352227afda370cfeeb1a49b128df752 (patch)
treebf6b90d4123d8c2e13c5de5e3c1e232a62dba942 /src/mesa/state_tracker
parentb5ddc7821a334177ff3f6c0ea3a5c24245ad194c (diff)
gallium: only create pipe buffer when size is nonzero
- This fixes a crash upon starting spring (a rts engine/game). Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 63196afba9..494a3a99c8 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -170,15 +170,19 @@ st_bufferobj_data(GLcontext *ctx,
pipe_buffer_reference( &st_obj->buffer, NULL );
- st_obj->buffer = pipe_buffer_create( pipe->screen, 32, buffer_usage, size );
+ if (size != 0) {
+ st_obj->buffer = pipe_buffer_create(pipe->screen, 32, buffer_usage, size);
- if (!st_obj->buffer) {
- return GL_FALSE;
+ if (!st_obj->buffer) {
+ return GL_FALSE;
+ }
+
+ if (data)
+ st_no_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, 0,
+ size, data);
+ return GL_TRUE;
}
- if (data)
- st_no_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, 0,
- size, data);
return GL_TRUE;
}