[Piglit] [PATCH 1/2] Add a piglit_require_GLSL_version(int version) helper function.
Kenneth Graunke
kenneth at whitecape.org
Mon Aug 22 16:27:41 PDT 2011
Many tests want to check for a specific GLSL version. This helper
function makes that really easy: piglit_require_GLSL_version(130);
---
tests/util/piglit-shader-gl.c | 18 ++++++++++++++++++
tests/util/piglit-util.h | 7 +++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/tests/util/piglit-shader-gl.c b/tests/util/piglit-shader-gl.c
index 496e8dc..352ac8f 100644
--- a/tests/util/piglit-shader-gl.c
+++ b/tests/util/piglit-shader-gl.c
@@ -205,6 +205,24 @@ piglit_require_GLSL(void)
}
void
+piglit_require_GLSL_version(int version)
+{
+ bool es;
+ int major, minor;
+
+ piglit_require_GLSL();
+
+ piglit_get_glsl_version(&es, &major, &minor);
+
+ if (es || 100 * major + minor < version) {
+ printf("GLSL %d.%d not supported.\n",
+ version / 100, version % 100);
+ piglit_report_result(PIGLIT_SKIP);
+ exit(1);
+ }
+}
+
+void
piglit_require_vertex_shader(void)
{
if (GLEW_VERSION_2_0) {
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index da4c844..78874ee 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -311,6 +311,13 @@ extern PFNGLUNIFORMMATRIX4X3FVPROC piglit_UniformMatrix4x3fv;
#endif
/*@}*/
+/**
+ * Require a specific version of GLSL.
+ *
+ * \param version Integer version, for example 130
+ */
+extern void piglit_require_GLSL_version(int version);
+/** Require any version of GLSL */
extern void piglit_require_GLSL(void);
extern void piglit_require_fragment_shader(void);
extern void piglit_require_vertex_shader(void);
--
1.7.6
More information about the Piglit
mailing list