[Piglit] [PATCH 1/2] Modify EXT_transform_feedback tests to test GL 3.0 core.

Paul Berry stereotype441 at gmail.com
Wed Nov 2 15:10:11 PDT 2011


Nearly all of the functionality of the EXT_transform_feedback
extension is available in core OpenGL as of version 3.0 (only one
function was not promoted to OpenGL 3.0, the BindBufferOffsetEXT
function).  Therefore, it's possible for an implementation to support
transform feedback via core OpenGL 3.0 features, without advertising
support for the EXT_transform_feedback extension.  One such
implementation, surprisingly, is the nVidia proprietary Linux driver I
use as my reference platform.

To allow the transform feedback tests to run on these implementations,
I've created a function piglit_require_transform_feedback(), and the
following function pointers:

- piglit_BeginTransformFeedback
- piglit_BindBufferBase
- piglit_BindBufferRange
- piglit_EndTransformFeedback
- piglit_GetBooleani_v
- piglit_GetIntegeri_v
- piglit_GetTransformFeedbackVarying
- piglit_TransformFeedbackVaryings

piglit_require_transform_feedback() checks whether transform feedback
is provided via EXT_transform_feedback or via core GL 3.0, and sets up
the function pointers appropriately.  If transform feedback isn't
provided through either mechanism, then it causes the test to be
skipped.

This is similar to what we do with piglit_require_GLSL() (see
tests/util/piglit-shader-gl.c).

I've updated all of the EXT_transform_feedback tests to use these
function pointers.  This makes it possible to test transform feedback
on an implementation that supports GL 3.0 but not
EXT_transform_feedback.
---
 tests/spec/ext_transform_feedback/discard-api.c    |    2 +-
 tests/spec/ext_transform_feedback/discard-bitmap.c |    2 +-
 tests/spec/ext_transform_feedback/discard-clear.c  |    2 +-
 .../ext_transform_feedback/discard-copypixels.c    |    2 +-
 .../ext_transform_feedback/discard-drawarrays.c    |    2 +-
 .../ext_transform_feedback/discard-drawpixels.c    |    2 +-
 tests/spec/ext_transform_feedback/interleaved.c    |   12 ++--
 tests/spec/ext_transform_feedback/output-type.c    |   14 ++--
 tests/spec/ext_transform_feedback/position.c       |   16 ++--
 tests/spec/ext_transform_feedback/separate.c       |   12 ++--
 tests/util/CMakeLists.gl.txt                       |    2 +
 tests/util/piglit-transform-feedback.c             |   81 ++++++++++++++++++++
 tests/util/piglit-transform-feedback.h             |   70 +++++++++++++++++
 tests/util/piglit-util.h                           |    1 +
 14 files changed, 188 insertions(+), 32 deletions(-)
 create mode 100644 tests/util/piglit-transform-feedback.c
 create mode 100644 tests/util/piglit-transform-feedback.h

diff --git a/tests/spec/ext_transform_feedback/discard-api.c b/tests/spec/ext_transform_feedback/discard-api.c
index e21b28c..849f5fb 100644
--- a/tests/spec/ext_transform_feedback/discard-api.c
+++ b/tests/spec/ext_transform_feedback/discard-api.c
@@ -53,7 +53,7 @@ piglit_init(int argc, char **argv)
 {
 	GLint enabled;
 
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 
 	glEnable(GL_RASTERIZER_DISCARD);
 	if (!glIsEnabled(GL_RASTERIZER_DISCARD))
diff --git a/tests/spec/ext_transform_feedback/discard-bitmap.c b/tests/spec/ext_transform_feedback/discard-bitmap.c
index c524b84..1b889f5 100644
--- a/tests/spec/ext_transform_feedback/discard-bitmap.c
+++ b/tests/spec/ext_transform_feedback/discard-bitmap.c
@@ -84,5 +84,5 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 }
diff --git a/tests/spec/ext_transform_feedback/discard-clear.c b/tests/spec/ext_transform_feedback/discard-clear.c
index bfc50e3..7586775 100644
--- a/tests/spec/ext_transform_feedback/discard-clear.c
+++ b/tests/spec/ext_transform_feedback/discard-clear.c
@@ -68,5 +68,5 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 }
diff --git a/tests/spec/ext_transform_feedback/discard-copypixels.c b/tests/spec/ext_transform_feedback/discard-copypixels.c
index 7c5cf78..0c9954f 100644
--- a/tests/spec/ext_transform_feedback/discard-copypixels.c
+++ b/tests/spec/ext_transform_feedback/discard-copypixels.c
@@ -79,5 +79,5 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 }
diff --git a/tests/spec/ext_transform_feedback/discard-drawarrays.c b/tests/spec/ext_transform_feedback/discard-drawarrays.c
index 7ee03da..a9ffa39 100644
--- a/tests/spec/ext_transform_feedback/discard-drawarrays.c
+++ b/tests/spec/ext_transform_feedback/discard-drawarrays.c
@@ -69,5 +69,5 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 }
diff --git a/tests/spec/ext_transform_feedback/discard-drawpixels.c b/tests/spec/ext_transform_feedback/discard-drawpixels.c
index 69c4010..a4408c8 100644
--- a/tests/spec/ext_transform_feedback/discard-drawpixels.c
+++ b/tests/spec/ext_transform_feedback/discard-drawpixels.c
@@ -88,5 +88,5 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 }
diff --git a/tests/spec/ext_transform_feedback/interleaved.c b/tests/spec/ext_transform_feedback/interleaved.c
index 4478f91..0975943 100644
--- a/tests/spec/ext_transform_feedback/interleaved.c
+++ b/tests/spec/ext_transform_feedback/interleaved.c
@@ -66,7 +66,7 @@ void piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_SKIP);
 	}
 	piglit_require_GLSL();
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 
 	glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT, &maxcomps);
 	if (maxcomps < 17) {
@@ -78,8 +78,8 @@ void piglit_init(int argc, char **argv)
 	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
 	prog = piglit_CreateProgram();
 	piglit_AttachShader(prog, vs);
-	glTransformFeedbackVaryingsEXT(prog, sizeof(varyings)/sizeof(varyings[0]),
-				       varyings, GL_INTERLEAVED_ATTRIBS_EXT);
+	piglit_TransformFeedbackVaryings(prog, sizeof(varyings)/sizeof(varyings[0]),
+					 varyings, GL_INTERLEAVED_ATTRIBS_EXT);
 	piglit_LinkProgram(prog);
 	if (!piglit_link_check_status(prog)) {
 		piglit_DeleteProgram(prog);
@@ -96,7 +96,7 @@ void piglit_init(int argc, char **argv)
 		ptr[i] = 0.123456;
 	}
 	glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT);
-	glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf);
+	piglit_BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf);
 
 	assert(glGetError() == 0);
 
@@ -159,10 +159,10 @@ enum piglit_result piglit_display(void)
 	glLoadIdentity();
 	piglit_UseProgram(prog);
 	glEnable(GL_RASTERIZER_DISCARD);
-	glBeginTransformFeedbackEXT(GL_TRIANGLES);
+	piglit_BeginTransformFeedback(GL_TRIANGLES);
 	glVertexPointer(2, GL_FLOAT, 0, verts);
 	glDrawArrays(GL_QUADS, 0, 4);
-	glEndTransformFeedbackEXT();
+	piglit_EndTransformFeedback();
 	glDisable(GL_RASTERIZER_DISCARD);
 
 	assert(glGetError() == 0);
diff --git a/tests/spec/ext_transform_feedback/output-type.c b/tests/spec/ext_transform_feedback/output-type.c
index 19fe07f..d9b4484 100644
--- a/tests/spec/ext_transform_feedback/output-type.c
+++ b/tests/spec/ext_transform_feedback/output-type.c
@@ -543,7 +543,7 @@ test_ready:
 		piglit_report_result(PIGLIT_SKIP);
 	}
 	piglit_require_GLSL();
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 
 	glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, &maxcomps);
 	if (maxcomps < test->num_elements) {
@@ -554,9 +554,9 @@ test_ready:
 	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, test->vs);
 	prog = piglit_CreateProgram();
 	piglit_AttachShader(prog, vs);
-	glTransformFeedbackVaryingsEXT(prog, test->num_varyings,
-				       test->varyings,
-				       GL_INTERLEAVED_ATTRIBS_EXT);
+	piglit_TransformFeedbackVaryings(prog, test->num_varyings,
+					 test->varyings,
+					 GL_INTERLEAVED_ATTRIBS_EXT);
 	piglit_LinkProgram(prog);
 	if (!piglit_link_check_status(prog)) {
 		piglit_DeleteProgram(prog);
@@ -577,7 +577,7 @@ test_ready:
 
 	assert(glGetError() == 0);
 
-	glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf);
+	piglit_BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf);
 
 	assert(glGetError() == 0);
 
@@ -603,11 +603,11 @@ enum piglit_result piglit_display(void)
 	/* Render into TFBO. */
 	glLoadIdentity();
 	piglit_UseProgram(prog);
-	glBeginTransformFeedbackEXT(GL_TRIANGLES);
+	piglit_BeginTransformFeedback(GL_TRIANGLES);
 	glBindBuffer(GL_ARRAY_BUFFER, 0);
 	glVertexPointer(2, GL_FLOAT, 0, verts);
 	glDrawArrays(GL_TRIANGLES, 0, NUM_VERTICES);
-	glEndTransformFeedbackEXT();
+	piglit_EndTransformFeedback();
 
 	assert(glGetError() == 0);
 
diff --git a/tests/spec/ext_transform_feedback/position.c b/tests/spec/ext_transform_feedback/position.c
index e952dcd..2fbd88f 100644
--- a/tests/spec/ext_transform_feedback/position.c
+++ b/tests/spec/ext_transform_feedback/position.c
@@ -81,6 +81,8 @@ void piglit_init(int argc, char **argv)
 		if (!strcmp(argv[i], "discard")) {
 			discard = GL_TRUE;
 		} else if (!strcmp(argv[i], "offset")) {
+			/* BindBufferOffset only exists in the EXT specification */
+			piglit_require_extension("GL_EXT_transform_feedback");
 			offset = OFFSET;
 		} else if (!strcmp(argv[i], "range")) {
 			offset = OFFSET;
@@ -102,13 +104,13 @@ void piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_SKIP);
 	}
 	piglit_require_GLSL();
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 
 	/* Create shaders. */
 	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
 	prog = piglit_CreateProgram();
 	piglit_AttachShader(prog, vs);
-	glTransformFeedbackVaryingsEXT(prog, 1, varyings, GL_INTERLEAVED_ATTRIBS_EXT);
+	piglit_TransformFeedbackVaryings(prog, 1, varyings, GL_INTERLEAVED_ATTRIBS_EXT);
 	piglit_LinkProgram(prog);
 	if (!piglit_link_check_status(prog)) {
 		piglit_DeleteProgram(prog);
@@ -118,7 +120,7 @@ void piglit_init(int argc, char **argv)
 	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vspassthrough);
 	prog_passthrough = piglit_CreateProgram();
 	piglit_AttachShader(prog_passthrough, vs);
-	glTransformFeedbackVaryingsEXT(prog_passthrough, 1, varyings, GL_INTERLEAVED_ATTRIBS_EXT);
+	piglit_TransformFeedbackVaryings(prog_passthrough, 1, varyings, GL_INTERLEAVED_ATTRIBS_EXT);
 	piglit_LinkProgram(prog_passthrough);
 	if (!piglit_link_check_status(prog_passthrough)) {
 		piglit_DeleteProgram(prog_passthrough);
@@ -135,7 +137,7 @@ void piglit_init(int argc, char **argv)
 
 	if (range) {
 		puts("Testing BindBufferRange.");
-		glBindBufferRangeEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT,
+		piglit_BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER_EXT,
 				     0, buf, offset*sizeof(float), range*sizeof(float));
 	} else if (offset) {
 		puts("Testing BindBufferOffset.");
@@ -143,7 +145,7 @@ void piglit_init(int argc, char **argv)
 				      0, buf, offset*sizeof(float));
 	} else {
 		puts("Testing BindBufferBase.");
-		glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf);
+		piglit_BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, buf);
 	}
 
 	if (!range) {
@@ -201,11 +203,11 @@ enum piglit_result piglit_display(void)
 	piglit_UseProgram(prog);
 	if (discard)
 		glEnable(GL_RASTERIZER_DISCARD_EXT);
-	glBeginTransformFeedbackEXT(GL_TRIANGLES);
+	piglit_BeginTransformFeedback(GL_TRIANGLES);
 	glBindBuffer(GL_ARRAY_BUFFER, 0);
 	glVertexPointer(2, GL_FLOAT, 0, verts);
 	glDrawArrays(GL_QUADS, 0, 4);
-	glEndTransformFeedbackEXT();
+	piglit_EndTransformFeedback();
 	if (discard)
 		glDisable(GL_RASTERIZER_DISCARD_EXT);
 
diff --git a/tests/spec/ext_transform_feedback/separate.c b/tests/spec/ext_transform_feedback/separate.c
index e57c4e1..666e9be 100644
--- a/tests/spec/ext_transform_feedback/separate.c
+++ b/tests/spec/ext_transform_feedback/separate.c
@@ -66,7 +66,7 @@ void piglit_init(int argc, char **argv)
 		piglit_report_result(PIGLIT_SKIP);
 	}
 	piglit_require_GLSL();
-	piglit_require_extension("GL_EXT_transform_feedback");
+	piglit_require_transform_feedback();
 
 	glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT, &maxattrs);
 	if (maxattrs < 4) {
@@ -83,8 +83,8 @@ void piglit_init(int argc, char **argv)
 	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext);
 	prog = piglit_CreateProgram();
 	piglit_AttachShader(prog, vs);
-	glTransformFeedbackVaryingsEXT(prog, sizeof(varyings)/sizeof(varyings[0]),
-				       varyings, GL_SEPARATE_ATTRIBS_EXT);
+	piglit_TransformFeedbackVaryings(prog, sizeof(varyings)/sizeof(varyings[0]),
+					 varyings, GL_SEPARATE_ATTRIBS_EXT);
 	piglit_LinkProgram(prog);
 	if (!piglit_link_check_status(prog)) {
 		piglit_DeleteProgram(prog);
@@ -104,7 +104,7 @@ void piglit_init(int argc, char **argv)
 			ptr[j] = 0.123456;
 		}
 		glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT);
-		glBindBufferBaseEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, i, buf[i]);
+		piglit_BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, i, buf[i]);
 	}
 
 	assert(glGetError() == 0);
@@ -154,10 +154,10 @@ enum piglit_result piglit_display(void)
 	glLoadIdentity();
 	piglit_UseProgram(prog);
 	glEnable(GL_RASTERIZER_DISCARD);
-	glBeginTransformFeedbackEXT(GL_TRIANGLES);
+	piglit_BeginTransformFeedback(GL_TRIANGLES);
 	glVertexPointer(2, GL_FLOAT, 0, verts);
 	glDrawArrays(GL_QUADS, 0, 4);
-	glEndTransformFeedbackEXT();
+	piglit_EndTransformFeedback();
 	glDisable(GL_RASTERIZER_DISCARD);
 
 	assert(glGetError() == 0);
diff --git a/tests/util/CMakeLists.gl.txt b/tests/util/CMakeLists.gl.txt
index df1bfb9..d8591ec 100644
--- a/tests/util/CMakeLists.gl.txt
+++ b/tests/util/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ set(UTIL_SOURCES
 	glew.c
 	piglit-shader.c
 	piglit-shader-gl.c
+	piglit-transform-feedback.c
 	piglit-util-gl.c
 	piglit-vbo.cpp
 	)
@@ -18,6 +19,7 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 	add_library (piglitglxutil
 		    piglit-shader.c
 		    piglit-shader-gl.c
+		    piglit-transform-feedback.c
 		    piglit-util.c
 		    piglit-util-gl.c
 		    piglit-glx-framework.c
diff --git a/tests/util/piglit-transform-feedback.c b/tests/util/piglit-transform-feedback.c
new file mode 100644
index 0000000..a200d49
--- /dev/null
+++ b/tests/util/piglit-transform-feedback.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef USE_OPENGL
+#	error USE_OPENGL is undefined
+#endif
+
+#if defined(_MSC_VER)
+#include <windows.h>
+#endif
+
+#include "piglit-util.h"
+
+PFNGLBEGINTRANSFORMFEEDBACKPROC piglit_BeginTransformFeedback = NULL;
+PFNGLBINDBUFFERBASEPROC piglit_BindBufferBase = NULL;
+PFNGLBINDBUFFERRANGEPROC piglit_BindBufferRange = NULL;
+PFNGLENDTRANSFORMFEEDBACKPROC piglit_EndTransformFeedback = NULL;
+PFNGLGETBOOLEANI_VPROC piglit_GetBooleani_v = NULL;
+PFNGLGETINTEGERI_VPROC piglit_GetIntegeri_v = NULL;
+PFNGLGETTRANSFORMFEEDBACKVARYINGPROC piglit_GetTransformFeedbackVarying = NULL;
+PFNGLTRANSFORMFEEDBACKVARYINGSPROC piglit_TransformFeedbackVaryings = NULL;
+
+static void
+init_functions_from_core(void)
+{
+	piglit_BeginTransformFeedback = glBeginTransformFeedback;
+	piglit_BindBufferBase = glBindBufferBase;
+	piglit_BindBufferRange = glBindBufferRange;
+	piglit_EndTransformFeedback = glEndTransformFeedback;
+	piglit_GetBooleani_v = glGetBooleani_v;
+	piglit_GetIntegeri_v = glGetIntegeri_v;
+	piglit_GetTransformFeedbackVarying = glGetTransformFeedbackVarying;
+	piglit_TransformFeedbackVaryings = glTransformFeedbackVaryings;
+}
+
+static void
+init_functions_from_ext(void)
+{
+	piglit_BeginTransformFeedback = glBeginTransformFeedbackEXT;
+	piglit_BindBufferBase = glBindBufferBaseEXT;
+	piglit_BindBufferRange = glBindBufferRangeEXT;
+	piglit_EndTransformFeedback = glEndTransformFeedbackEXT;
+	piglit_GetBooleani_v = glGetBooleanIndexedvEXT;
+	piglit_GetIntegeri_v = glGetIntegerIndexedvEXT;
+	piglit_GetTransformFeedbackVarying = glGetTransformFeedbackVaryingEXT;
+	piglit_TransformFeedbackVaryings = glTransformFeedbackVaryingsEXT;
+}
+
+void
+piglit_require_transform_feedback(void)
+{
+	if (GLEW_VERSION_3_0) {
+		init_functions_from_core();
+	} else if (GLEW_EXT_transform_feedback) {
+		init_functions_from_ext();
+	} else {
+		printf("Transform feedback not supported.\n");
+		piglit_report_result(PIGLIT_SKIP);
+		exit(1);
+	}
+}
diff --git a/tests/util/piglit-transform-feedback.h b/tests/util/piglit-transform-feedback.h
new file mode 100644
index 0000000..fa7c7a9
--- /dev/null
+++ b/tests/util/piglit-transform-feedback.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright © 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+/**
+ * \name Portable wrappers for transform feedback functions
+ *
+ * \note
+ * \c piglit_require_transform_feedback must be called before using
+ * these wrappers.
+ */
+/*@{*/
+#if defined(USE_OPENGL_ES1)
+#define piglit_BeginTransformFeedback assert(!"glBeginTransformFeedback does not exist in ES1")
+#define piglit_BindBufferBase assert(!"glBindBufferBase does not exist in ES1")
+#define piglit_BindBufferRange assert(!"glBindBufferRange does not exist in ES1")
+#define piglit_EndTransformFeedback assert(!"glEndTransformFeedback does not exist in ES1")
+#define piglit_GetBooleani_v assert(!"glGetBooleani_v does not exist in ES1")
+#define piglit_GetIntegeri_v assert(!"glGetIntegeri_v does not exist in ES1")
+#define piglit_GetTransformFeedbackVarying assert(!"glGetTransformFeedbackVarying does not exist in ES1")
+#define piglit_TransformFeedbackVaryings assert(!"glTransformFeedbackVaryings does not exist in ES1")
+#elif defined(USE_OPENGL_ES2)
+#define piglit_BeginTransformFeedback assert(!"glBeginTransformFeedback does not exist in ES2")
+#define piglit_BindBufferBase assert(!"glBindBufferBase does not exist in ES2")
+#define piglit_BindBufferRange assert(!"glBindBufferRange does not exist in ES2")
+#define piglit_EndTransformFeedback assert(!"glEndTransformFeedback does not exist in ES2")
+#define piglit_GetBooleani_v assert(!"glGetBooleani_v does not exist in ES2")
+#define piglit_GetIntegeri_v assert(!"glGetIntegeri_v does not exist in ES2")
+#define piglit_GetTransformFeedbackVarying assert(!"glGetTransformFeedbackVarying does not exist in ES2")
+#define piglit_TransformFeedbackVaryings assert(!"glTransformFeedbackVaryings does not exist in ES2")
+#else
+extern PFNGLBEGINTRANSFORMFEEDBACKPROC piglit_BeginTransformFeedback;
+extern PFNGLBINDBUFFERBASEPROC piglit_BindBufferBase;
+extern PFNGLBINDBUFFERRANGEPROC piglit_BindBufferRange;
+extern PFNGLENDTRANSFORMFEEDBACKPROC piglit_EndTransformFeedback;
+extern PFNGLGETBOOLEANI_VPROC piglit_GetBooleani_v;
+extern PFNGLGETINTEGERI_VPROC piglit_GetIntegeri_v;
+extern PFNGLGETTRANSFORMFEEDBACKVARYINGPROC piglit_GetTransformFeedbackVarying;
+extern PFNGLTRANSFORMFEEDBACKVARYINGSPROC piglit_TransformFeedbackVaryings;
+#endif
+/*@}*/
+
+/**
+ * Require transform feedback.
+ *
+ * Transform feedback may either be provided by GL 3.0 or
+ * EXT_transform_feedback.
+ */
+extern void piglit_require_transform_feedback(void);
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index b2f1659..e89092b 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -96,6 +96,7 @@ enum piglit_result {
 
 #include "piglit-framework.h"
 #include "piglit-shader.h"
+#include "piglit-transform-feedback.h"
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 
-- 
1.7.6.4



More information about the Piglit mailing list