mesa: Avoid segfault when getting an unbound transform feedback buffer name.
authorPaul Berry <stereotype441@gmail.com>
Tue, 3 Jan 2012 21:59:13 +0000 (13:59 -0800)
committerPaul Berry <stereotype441@gmail.com>
Thu, 5 Jan 2012 21:27:12 +0000 (13:27 -0800)
commit4357f8b4dcaaef4843d4b34923383a2b045638b1
tree87f8627171732a1af8b499e67d859f55ce73f4c8
parent456279bb33e09679de61d560aeafa74bb902fe43
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 <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/get.c