Module: Mesa Branch: master Commit: 4357f8b4dcaaef4843d4b34923383a2b045638b1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4357f8b4dcaaef4843d4b34923383a2b045638b1
Author: Paul Berry <stereotype...@gmail.com> Date: Tue Jan 3 13:59:13 2012 -0800 mesa: Avoid segfault when getting an unbound transform feedback buffer name. Previously we were using gl_transform_feedback_object::Buffers[i]->Name to service an indexed get request for GL_TRANSFORM_FEEDBACK_BUFFER_BINDING. However, if no buffer has been bound, gl_transform_feedback_object::Buffers[i] is NULL, so this was causing a segfault. This patch switches to using gl_transform_feedback_object::BufferNames[i], which is equal to gl_transform_feedback_object::Buffers[i]->Name if gl_transform_feedback_object::Buffers[i] is not NULL, and 0 if it is NULL. Fixes piglit test "EXT_transform_feedback/get-buffer-state indexed_binding". Reviewed-by: Eric Anholt <e...@anholt.net> Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> --- src/mesa/main/get.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 0c9d6b3..5ad6012 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -2498,7 +2498,7 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v) goto invalid_value; if (!ctx->Extensions.EXT_transform_feedback) goto invalid_enum; - v->value_int = ctx->TransformFeedback.CurrentObject->Buffers[index]->Name; + v->value_int = ctx->TransformFeedback.CurrentObject->BufferNames[index]; return TYPE_INT; } _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit