[Piglit] [PATCH 1/2] glew: add missing GetIntegeri_v for GL 3.0

Paul Berry stereotype441 at gmail.com
Tue Jan 3 13:27:48 PST 2012

OpenGL version 3.0 adds the function GetIntegeri_v (see OpenGL 3.0
spec, p315):

    void GetIntegeri_v( enum target, uint index, int *data );

However, glew.c was only setting up a function pointer for it when the
ARB_uniform_buffer_object extension was present.
ARB_uniform_buffer_object is *not* a required part of GL 3.0.  This
makes it impossible to test the behavior of GetIntegeri_v on
implementations that support GL 3.0 but do not support
ARB_uniform_buffer_object (for example Mesa, when using i965 Sandy
Bridge hardware and the environment variable MESA_GL_VERSION_OVERRIDE
is set to "3.0").

The last time I discovered a bug like this (see commit
ca1c1dd0253f04cd1596d74b0b6f8c25aaab8419), my bug report was rejected
by the glew maintainers.  Once Mesa supports OpenGL 3.0 on i965 Sandy
Bridge without requiring a special environment variable, I will try
again to convince the glew maintainers to fix both of these bugs.

In the meantime, this patch is a temporary band-aid to make glew.c set
up the function pointer properly, while we wait for an upstream fix.
 tests/util/glew.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tests/util/glew.c b/tests/util/glew.c
index 106cf3c..4130c53 100644
--- a/tests/util/glew.c
+++ b/tests/util/glew.c
@@ -3242,6 +3242,7 @@ static GLboolean _glewInit_GL_VERSION_3_0 (GLEW_CONTEXT_ARG_DEF_INIT)
   r = ((glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)glewGetProcAddress((const GLubyte*)"glEndTransformFeedback")) == NULL) || r;
   r = ((glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)glewGetProcAddress((const GLubyte*)"glGetBooleani_v")) == NULL) || r;
   r = ((glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)glewGetProcAddress((const GLubyte*)"glGetFragDataLocation")) == NULL) || r;
+  r = ((glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)glewGetProcAddress((const GLubyte*)"glGetIntegeri_v")) == NULL) || r;
   r = ((glGetStringi = (PFNGLGETSTRINGIPROC)glewGetProcAddress((const GLubyte*)"glGetStringi")) == NULL) || r;
   r = ((glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIiv")) == NULL) || r;
   r = ((glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)glewGetProcAddress((const GLubyte*)"glGetTexParameterIuiv")) == NULL) || r;

More information about the Piglit mailing list