[Piglit] [PATCH] glslparsertest: Update for gles3.1 and gles3.2

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Wed Nov 4 13:35:12 PST 2015


From: Dylan Baker <baker.dylan.c at gmail.com>

I noticed during my fast-skip work that one test[1] changed status (from
fail -> skip), what I realized is that glslparsertest doesn't know how
to handle gles3.1 or gles3.2.

This patch adds support for checking 3.1 and 3.2 glsl versions, both in
setting the config information, and in checking for
ARB_ES3_x_compatibility extensions when running on a non-GLES or mixed
piglit build.

[1] spec at glsl-es-3.10@compiler at helper-invocation.frag

This fixes [1] on the i965 driver (fail -> skip), since it now requests
ARB_ES3_1_compatibility

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---

This was tested with i965 on HSW, and only the mentioned test changes. 

 tests/glslparsertest/glslparsertest.c | 37 +++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/tests/glslparsertest/glslparsertest.c b/tests/glslparsertest/glslparsertest.c
index e9a2cb3..ca66b4b 100644
--- a/tests/glslparsertest/glslparsertest.c
+++ b/tests/glslparsertest/glslparsertest.c
@@ -45,6 +45,12 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 		const unsigned int int_version
 			= parse_glsl_version_number(argv[3]);
 		switch (int_version) {
+		/* This is a hack to support es
+		 *
+		 * This works because version 1.00, 3.00, 3.10, 3.20 (even
+		 * though 3.x should include "es") are unique to GLES, there is
+		 * no desktop OpenGL shader language 1.00, 3.00, 3.10, or 3.20
+		 */
 		case 100:
 			config.supports_gl_compat_version = 10;
 			config.supports_gl_es_version = 20;
@@ -53,6 +59,14 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 			config.supports_gl_compat_version = 10;
 			config.supports_gl_es_version = 30;
 			break;
+		case 310:
+			config.supports_gl_compat_version = 10;
+			config.supports_gl_es_version = 31;
+			break;
+		case 320:
+			config.supports_gl_compat_version = 10;
+			config.supports_gl_es_version = 32;
+			break;
 		default: {
 			const unsigned int gl_version
 				= required_gl_version_from_glsl_version(int_version);
@@ -145,6 +159,15 @@ get_shader_name(GLenum type)
 	return NULL;
 }
 
+static bool
+glsl_is_es(int version)
+{
+	if (version == 100 || version == 300 || version == 310 || version == 320) {
+		return true;
+	}
+	return false;
+}
+
 /**
  * Attach a dumy shader of the given type.
  */
@@ -154,6 +177,8 @@ attach_dummy_shader(GLuint shader_prog, GLenum type)
 	const char *shader_template;
 	char shader_text[4096];
 	GLint shader;
+	/* this sets the 'es' string at the end of the version, 1.00 doesn't have that */
+	bool es_flag = (glsl_is_es(requested_version) && requested_version != 100);
 
 	switch (type) {
 	case GL_VERTEX_SHADER:
@@ -183,7 +208,7 @@ attach_dummy_shader(GLuint shader_prog, GLenum type)
 	snprintf(shader_text, sizeof(shader_text),
 		 shader_template,
 		 requested_version,
-		 (requested_version == 300) ? "es" : "");
+		 es_flag ? "es" : "");
 	shader = piglit_compile_shader_text(type, shader_text);
 	glAttachShader(shader_prog, shader);
 }
@@ -228,6 +253,7 @@ test(void)
 	GLint size;
 	GLenum type;
 	char *failing_stage = NULL;
+	bool is_es = glsl_is_es(requested_version);
 
 	if (strcmp(filename + strlen(filename) - 4, "frag") == 0)
 		type = GL_FRAGMENT_SHADER;
@@ -302,8 +328,9 @@ test(void)
 
 		shader_prog = glCreateProgram();
 		glAttachShader(shader_prog, prog);
-		if (requested_version == 100 || requested_version == 300)
+		if (is_es) {
 			attach_complementary_shader(shader_prog, type);
+		}
 #if PIGLIT_USE_OPENGL
 		if (type == GL_GEOMETRY_SHADER ||
 		    type == GL_TESS_CONTROL_SHADER ||
@@ -450,6 +477,12 @@ check_version(unsigned glsl_version)
 		} else if (requested_version == 300) {
 			piglit_require_extension("GL_ARB_ES3_compatibility");
 			return;
+		} else if (requested_version == 310) {
+			piglit_require_extension("GL_ARB_ES3_1_compatibility");
+			return;
+		} else if (requested_version == 320) {
+			piglit_require_extension("GL_ARB_ES3_2_compatibility");
+			return;
 		}
 	}
 
-- 
2.6.2



More information about the Piglit mailing list