[Piglit] [PATCH] arb_uniform_buffer_object: reduce requirements

Chris Forbes chrisf at ijw.co.nz
Tue Aug 26 02:05:39 PDT 2014


We would like to be able to test this on 1.20+ARB_ubo as well. Unsigned
types are only present as of 1.30, so skip them if not available.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 ...getactiveuniformblockiv-uniform-block-data-size.c | 18 ++++++++++++++----
 .../getactiveuniformsiv-uniform-type.c               | 20 +++++++++++++++-----
 .../layout-std140-base-size-and-alignment.c          | 20 ++++++++++++++++----
 tests/spec/arb_uniform_buffer_object/layout-std140.c |  6 +++---
 4 files changed, 48 insertions(+), 16 deletions(-)

diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c
index 97edc40..e61d9e5 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c
@@ -40,7 +40,6 @@
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
 	config.supports_gl_compat_version = 10;
-	config.supports_gl_core_version = 31;
 	config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
 
 PIGLIT_GL_TEST_CONFIG_END
@@ -54,9 +53,9 @@ align(int v, int a)
 static bool
 test_format(const struct uniform_type *type, bool row_major)
 {
-	/* Using 140 to get unsigned ints. */
 	const char *fs_template =
-		"#version 140\n"
+		"#version %d\n"
+		"#extension GL_ARB_uniform_buffer_object: require\n"
 		"layout(std140) uniform ubo {\n"
 		"	float align_test;\n"
 		"	%s%s u;\n"
@@ -71,12 +70,23 @@ test_format(const struct uniform_type *type, bool row_major)
 	int expected;
 	const struct uniform_type *transposed_type;
 
+	if (type->type[0] == 'u' && piglit_get_gl_version() < 30) {
+		printf("%-20s %10s %10d %10s%s\n",
+		       type->type,
+		       row_major ? "y" : "n",
+		       data_size,
+		       "-",
+		       " SKIP");
+		return true;
+	}
+
 	if (row_major)
 		transposed_type = get_transposed_type(type);
 	else
 		transposed_type = type;
 
 	asprintf(&fs_source, fs_template,
+		 type->type[0] == 'u' ? 130 : 120,	/* unsigned requires 1.30 */
 		 row_major ? "layout(row_major) " : "",
 		 type->type);
 	prog = piglit_build_simple_program(NULL, fs_source);
@@ -118,7 +128,7 @@ piglit_init(int argc, char **argv)
 	unsigned int i;
 
 	piglit_require_extension("GL_ARB_uniform_buffer_object");
-	piglit_require_GLSL_version(140);
+	piglit_require_GLSL_version(120);
 
 	printf("%-20s %10s %10s %10s\n",
 	       "type", "row_major", "DATA_SIZE", "expected");
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
index fc54036..26e4229 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
@@ -33,7 +33,6 @@
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
 	config.supports_gl_compat_version = 10;
-	config.supports_gl_core_version = 31;
 	config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
 
 PIGLIT_GL_TEST_CONFIG_END
@@ -41,9 +40,9 @@ PIGLIT_GL_TEST_CONFIG_END
 static bool
 test_format(const struct uniform_type *type)
 {
-	/* Using 140 to get unsigned ints. */
 	const char *fs_template =
-		"#version 140\n"
+		"#version %d\n"
+		"#extension GL_ARB_uniform_buffer_object: require\n"
 		"layout(std140) uniform ubo {\n"
 		"	float align_test;\n"
 		"	%s u;\n"
@@ -67,7 +66,18 @@ test_format(const struct uniform_type *type)
 		deref = "u[0].x";
 	}
 
-	asprintf(&fs_source, fs_template, type->type, deref);
+	if (type->type[0] == 'u' && piglit_get_gl_version() < 30) {
+		printf("%-20s %20s %20s%s\n",
+		       type->type,
+		       "-",
+		       "-",
+		       " SKIP");
+		return true;
+	}
+
+	asprintf(&fs_source, fs_template,
+		 type->type[0] == 'u' ? 130 : 120,
+		 type->type, deref);
 	prog = piglit_build_simple_program(NULL, fs_source);
 	free(fs_source);
 
@@ -93,7 +103,7 @@ piglit_init(int argc, char **argv)
 	unsigned int i;
 
 	piglit_require_extension("GL_ARB_uniform_buffer_object");
-	piglit_require_GLSL_version(140);
+	piglit_require_GLSL_version(120);
 
 	printf("%-20s %20s %20s\n", "type", "GL_UNIFORM_TYPE", "expected");
 	printf("--------------------------------------------------------------\n");
diff --git a/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c b/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c
index ffef8d1..967ee81 100644
--- a/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c
+++ b/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c
@@ -34,7 +34,6 @@
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
 	config.supports_gl_compat_version = 10;
-	config.supports_gl_core_version = 31;
 	config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
 
 PIGLIT_GL_TEST_CONFIG_END
@@ -48,9 +47,9 @@ align(int v, int a)
 static bool
 test_format(const struct uniform_type *type, bool row_major)
 {
-	/* Using 140 to get unsigned ints. */
 	const char *fs_template =
-		"#version 140\n"
+		"#version %d\n"
+		"#extension GL_ARB_uniform_buffer_object: require\n"
 		"layout(std140) uniform ubo {\n"
 		"	float pad;\n"
 		"	%s %s u;\n"
@@ -82,7 +81,20 @@ test_format(const struct uniform_type *type, bool row_major)
 	else
 		deref = "u[0].x";
 
+	if (type->type[0] == 'u' && piglit_get_gl_version() < 30) {
+		printf("%-10s %10s %8s %-16s %8s %-16d%s\n",
+		       type->type,
+		       row_major ? "y" : "n",
+		       "-",
+		       "-",
+		       "-",
+		       transposed_type->size,
+		       " SKIP");
+		return true;
+	}
+
 	asprintf(&fs_source, fs_template,
+		 type->type[0] == 'u' ? 130 : 120,
 		 row_major && type->size > 16 ? "layout(row_major) " : "",
 		 type->type,
 		 deref);
@@ -126,7 +138,7 @@ piglit_init(int argc, char **argv)
 	unsigned int i;
 
 	piglit_require_extension("GL_ARB_uniform_buffer_object");
-	piglit_require_GLSL_version(140);
+	piglit_require_GLSL_version(120);
 
 	printf("%-10s %10s %8s %16s %8s %-16s\n",
 	       "type", "row_major",
diff --git a/tests/spec/arb_uniform_buffer_object/layout-std140.c b/tests/spec/arb_uniform_buffer_object/layout-std140.c
index cb3cff3..d802322 100644
--- a/tests/spec/arb_uniform_buffer_object/layout-std140.c
+++ b/tests/spec/arb_uniform_buffer_object/layout-std140.c
@@ -91,7 +91,7 @@ static const struct result {
 };
 
 static const char frag_shader_text[] =
-	"#version 130\n"
+	"#version 120\n"
 	"#extension GL_ARB_uniform_buffer_object : enable \n"
 	"\n"
 	"struct f_struct {\n"
@@ -100,7 +100,7 @@ static const char frag_shader_text[] =
 	"};\n"
 	"\n"
 	"struct o_struct {\n"
-	"	uvec3 j;\n"
+	"	ivec3 j;\n"
 	"	vec2 k;\n"
 	"	float l[2];\n"
 	"	vec2 m;\n"
@@ -145,7 +145,7 @@ static const char frag_shader_text[] =
 static void
 init(void)
 {
-	piglit_require_GLSL_version(130);
+	piglit_require_GLSL_version(120);
 	piglit_require_extension("GL_ARB_uniform_buffer_object");
 
 	prog = piglit_build_simple_program(NULL, frag_shader_text);
-- 
2.0.4



More information about the Piglit mailing list