[Piglit] [PATCH 1/3] util: Add wrappers for missing glUniformMatrix functions

Ian Romanick idr at freedesktop.org
Thu Apr 28 14:55:43 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

---
 tests/util/piglit-shader-gl.c |   22 ++++++++++++++++++++++
 tests/util/piglit-util.h      |   16 ++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/tests/util/piglit-shader-gl.c b/tests/util/piglit-shader-gl.c
index 64e08a7..d2551f5 100644
--- a/tests/util/piglit-shader-gl.c
+++ b/tests/util/piglit-shader-gl.c
@@ -51,12 +51,21 @@ PFNGLUNIFORM2FVPROC piglit_Uniform2fv = NULL;
 PFNGLUNIFORM3FVPROC piglit_Uniform3fv = NULL;
 PFNGLUNIFORM4FVPROC piglit_Uniform4fv = NULL;
 PFNGLUNIFORM1IPROC piglit_Uniform1i = NULL;
+PFNGLUNIFORMMATRIX2FVPROC piglit_UniformMatrix2fv = NULL;
+PFNGLUNIFORMMATRIX3FVPROC piglit_UniformMatrix3fv = NULL;
 PFNGLUNIFORMMATRIX4FVPROC piglit_UniformMatrix4fv = NULL;
 PFNGLGETUNIFORMFVPROC piglit_GetUniformfv = NULL;
 PFNGLVERTEXATTRIBPOINTERPROC piglit_VertexAttribPointer = NULL;
 PFNGLENABLEVERTEXATTRIBARRAYPROC piglit_EnableVertexAttribArray = NULL;
 PFNGLDISABLEVERTEXATTRIBARRAYPROC piglit_DisableVertexAttribArray = NULL;
 
+PFNGLUNIFORMMATRIX2X3FVPROC piglit_UniformMatrix2x3fv = NULL;
+PFNGLUNIFORMMATRIX2X4FVPROC piglit_UniformMatrix2x4fv = NULL;
+PFNGLUNIFORMMATRIX3X2FVPROC piglit_UniformMatrix3x2fv = NULL;
+PFNGLUNIFORMMATRIX3X4FVPROC piglit_UniformMatrix3x4fv = NULL;
+PFNGLUNIFORMMATRIX4X2FVPROC piglit_UniformMatrix4x2fv = NULL;
+PFNGLUNIFORMMATRIX4X3FVPROC piglit_UniformMatrix4x3fv = NULL;
+
 static void
 init_functions_from_core(void)
 {
@@ -80,11 +89,22 @@ init_functions_from_core(void)
 	piglit_Uniform3fv = glUniform3fv;
 	piglit_Uniform4fv = glUniform4fv;
 	piglit_Uniform1i = glUniform1i;
+	piglit_UniformMatrix2fv = glUniformMatrix2fv;
+	piglit_UniformMatrix3fv = glUniformMatrix3fv;
 	piglit_UniformMatrix4fv = glUniformMatrix4fv;
 	piglit_GetUniformfv = glGetUniformfv;
 	piglit_VertexAttribPointer = glVertexAttribPointer;
 	piglit_EnableVertexAttribArray = glEnableVertexAttribArray;
 	piglit_DisableVertexAttribArray = glDisableVertexAttribArray;
+
+	/* These are part of OpenGL 2.1.
+	 */
+	piglit_UniformMatrix2x3fv = glUniformMatrix2x3fv;
+	piglit_UniformMatrix2x4fv = glUniformMatrix2x4fv;
+	piglit_UniformMatrix3x2fv = glUniformMatrix3x2fv;
+	piglit_UniformMatrix3x4fv = glUniformMatrix3x4fv;
+	piglit_UniformMatrix4x2fv = glUniformMatrix4x2fv;
+	piglit_UniformMatrix4x3fv = glUniformMatrix4x3fv;
 }
 
 static void
@@ -110,6 +130,8 @@ init_functions_from_extension(void)
 	piglit_Uniform3fv = glUniform3fvARB;
 	piglit_Uniform4fv = glUniform4fvARB;
 	piglit_Uniform1i = glUniform1iARB;
+	piglit_UniformMatrix2fv = glUniformMatrix2fvARB;
+	piglit_UniformMatrix3fv = glUniformMatrix3fvARB;
 	piglit_UniformMatrix4fv = glUniformMatrix4fvARB;
 	piglit_GetUniformfv = glGetUniformfvARB;
 	piglit_VertexAttribPointer = glVertexAttribPointerARB;
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index b691041..183f4fa 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -214,11 +214,19 @@ extern GLint piglit_ARBfp_pass_through;
 #define piglit_Uniform3fv glUniform3fv
 #define piglit_Uniform4fv glUniform4fv
 #define piglit_Uniform1i glUniform1i
+#define piglit_UniformMatrix2fv glUniformMatrix2fv
+#define piglit_UniformMatrix3fv glUniformMatrix3fv
 #define piglit_UniformMatrix4fv glUniformMatrix4fv
 #define piglit_GetUniformfv glGetUniformfv
 #define piglit_VertexAttribPointer glVertexAttribPointer
 #define piglit_EnableVertexAttribArray glEnableVertexAttribArray
 #define piglit_DisableVertexAttribArray glDisableVertexAttribArray
+#define piglit_UniformMatrix2x3fv assert(!"glUniformMatrix2x3fv does not exist in ES")
+#define piglit_UniformMatrix2x4fv assert(!"glUniformMatrix2x4fv does not exist in ES")
+#define piglit_UniformMatrix3x2fv assert(!"glUniformMatrix3x2fv does not exist in ES")
+#define piglit_UniformMatrix3x4fv assert(!"glUniformMatrix3x4fv does not exist in ES")
+#define piglit_UniformMatrix4x2fv assert(!"glUniformMatrix4x2fv does not exist in ES")
+#define piglit_UniformMatrix4x3fv assert(!"glUniformMatrix4x3fv does not exist in ES")
 #else
 extern PFNGLATTACHSHADERPROC piglit_AttachShader;
 extern PFNGLBINDATTRIBLOCATIONPROC piglit_BindAttribLocation;
@@ -240,11 +248,19 @@ extern PFNGLUNIFORM2FVPROC piglit_Uniform2fv;
 extern PFNGLUNIFORM3FVPROC piglit_Uniform3fv;
 extern PFNGLUNIFORM4FVPROC piglit_Uniform4fv;
 extern PFNGLUNIFORM1IPROC piglit_Uniform1i;
+extern PFNGLUNIFORMMATRIX2FVPROC piglit_UniformMatrix2fv;
+extern PFNGLUNIFORMMATRIX3FVPROC piglit_UniformMatrix3fv;
 extern PFNGLUNIFORMMATRIX4FVPROC piglit_UniformMatrix4fv;
 extern PFNGLGETUNIFORMFVPROC piglit_GetUniformfv;
 extern PFNGLVERTEXATTRIBPOINTERPROC piglit_VertexAttribPointer;
 extern PFNGLENABLEVERTEXATTRIBARRAYPROC piglit_EnableVertexAttribArray;
 extern PFNGLDISABLEVERTEXATTRIBARRAYPROC piglit_DisableVertexAttribArray;
+extern PFNGLUNIFORMMATRIX2X3FVPROC piglit_UniformMatrix2x3fv;
+extern PFNGLUNIFORMMATRIX2X4FVPROC piglit_UniformMatrix2x4fv;
+extern PFNGLUNIFORMMATRIX3X2FVPROC piglit_UniformMatrix3x2fv;
+extern PFNGLUNIFORMMATRIX3X4FVPROC piglit_UniformMatrix3x4fv;
+extern PFNGLUNIFORMMATRIX4X2FVPROC piglit_UniformMatrix4x2fv;
+extern PFNGLUNIFORMMATRIX4X3FVPROC piglit_UniformMatrix4x3fv;
 #endif
 /*@}*/
 
-- 
1.7.4



More information about the Piglit mailing list