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>
This commit is contained in:
Maarten Maathuis
2009-12-20 05:03:03 -08:00
committed by José Fonseca
parent b5ddc7821a
commit 8e8502bc63
+10 -6
View File
@@ -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;
}