[Piglit] [PATCH] glslparsertest: Support geometry and compute shader in {compile, link} status

Anuj Phogat anuj.phogat at gmail.com
Wed Jan 29 16:45:17 PST 2014


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 tests/glslparsertest/glslparsertest.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tests/glslparsertest/glslparsertest.c b/tests/glslparsertest/glslparsertest.c
index 5957144..18bd062 100644
--- a/tests/glslparsertest/glslparsertest.c
+++ b/tests/glslparsertest/glslparsertest.c
@@ -122,6 +122,24 @@ get_shader_info_log_length(GLuint shader)
 	return length;
 }
 
+static char*
+get_shader_name(GLenum type)
+{
+	switch(type) {
+	case GL_VERTEX_SHADER:
+		return "vertex";
+	case GL_GEOMETRY_SHADER:
+		return "geometry";
+	case GL_FRAGMENT_SHADER:
+		return "fragment";
+	case GL_COMPUTE_SHADER:
+		return "compute";
+	default:
+		fprintf(stderr, "Unexpected type in get_shader_name()\n");
+		piglit_report_result(PIGLIT_FAIL);
+	}
+	return NULL;
+}
 
 /**
  * Attach a dumy shader of the given type.
@@ -295,7 +313,7 @@ test(void)
 	if (!ok) {
 		fprintf(out, "Failed to %s %s shader %s: %s\n",
 			failing_stage,
-			type == GL_FRAGMENT_SHADER ? "fragment" : "vertex",
+			get_shader_name(type),
 			filename, info);
 		if (expected_pass) {
 			printf("Shader source:\n");
@@ -304,7 +322,7 @@ test(void)
 	} else {
 		fprintf(out, "Successfully %s %s shader %s: %s\n",
 			check_link ? "compiled and linked" : "compiled",
-			type == GL_FRAGMENT_SHADER ? "fragment" : "vertex",
+			get_shader_name(type),
 			filename, info);
 		if (!expected_pass) {
 			printf("Shader source:\n");
-- 
1.8.3.1



More information about the Piglit mailing list