[Piglit] [PATCH] arb_uniform_buffer_object: Fix tests with clarifications from Khronos

Ian Romanick idr at freedesktop.org
Mon Jan 21 23:43:44 PST 2013


From: Ian Romanick <ian.d.romanick at intel.com>

OpenGL ES 3.0 (and presumably other versions of OpenGL) have two
requirements that these tests expect to be violated:

1. Members of a uniform block that are not used will not be marked
active.

2. It is an error to apply a row_major or column_major layout qualifier
to a non-matirx type.

These changes fix the UBO tests to actually use all of the members of
each block and not use row_major and column_major layout qualifiers on
non-matrix types.

Without these fixes, a patch series that is going out to the mesa-dev
list very soon that fixes many gles3conform failures will regress these
tests.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 tests/all.tests                                        |  5 +++++
 tests/es3conform.tests                                 |  2 +-
 tests/gtf.tests                                        |  4 ++--
 tests/spec/arb_uniform_buffer_object/dlist.c           |  2 +-
 .../getactiveuniformsiv-uniform-array-stride.c         |  2 +-
 .../getactiveuniformsiv-uniform-matrix-stride.c        |  2 +-
 .../getactiveuniformsiv-uniform-type.c                 | 13 +++++++++++--
 .../layout-std140-base-size-and-alignment.c            | 15 ++++++++++++---
 tests/spec/arb_uniform_buffer_object/layout-std140.c   |  2 +-
 tests/spec/arb_uniform_buffer_object/row-major.c       | 18 ++++++++++++++++++
 10 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/tests/all.tests b/tests/all.tests
index fbdb403..cae7f90 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -67,6 +67,11 @@ try:
 except SystemExit:
 	pass
 
+try:
+	execfile(path.join(testsDir, 'es3conform.tests'))
+except SystemExit:
+	pass
+
 # List of all of the MSAA sample counts we wish to test
 MSAA_SAMPLE_COUNTS = (2, 4, 6, 8, 16, 32)
 
diff --git a/tests/es3conform.tests b/tests/es3conform.tests
index 794a371..32cd051 100644
--- a/tests/es3conform.tests
+++ b/tests/es3conform.tests
@@ -49,7 +49,7 @@ class GTFTest(ExecTest):
     pass_re = re.compile(r'Conformance PASSED all 1 tests')
 
     def __init__(self, testpath):
-        ExecTest.__init__(self, [path.join(testBinDir, 'GTF3'), '-id=77', '-width=113', '-height=47', '-run=' + testpath])
+        ExecTest.__init__(self, [path.join(testBinDir, 'GTF3'), '-minfmt', '-width=113', '-height=47', '-run=' + testpath])
 
     def interpretResult(self, out, returncode, results):
         if self.pass_re.search(out) is not None:
diff --git a/tests/gtf.tests b/tests/gtf.tests
index d632df0..6b0272c 100644
--- a/tests/gtf.tests
+++ b/tests/gtf.tests
@@ -35,7 +35,7 @@ from framework.core import testBinDir
 ##### files into the 'gtf' category.
 #############################################################################
 
-if not os.path.exists(os.path.join(testBinDir, 'GTF3')):
+if not os.path.exists(os.path.join(testBinDir, 'GTF')):
     sys.exit(0)
 
 # Chase the piglit/bin/GTF symlink to find where the tests really live.
@@ -45,7 +45,7 @@ class GTFTest(ExecTest):
     pass_re = re.compile(r'(Regression|Conformance) PASSED all 1 tests')
 
     def __init__(self, testpath):
-        ExecTest.__init__(self, [path.join(testBinDir, 'GTF3'), '-width=113', '-height=47', '-seed=2', '-minfmt', '-run=' + testpath])
+        ExecTest.__init__(self, [path.join(testBinDir, 'GTF'), '-noimagefileio', '-width=113', '-height=47', '-seed=2', '-id=52', '-run=' + testpath])
 
     def interpretResult(self, out, returncode, results):
 	if self.pass_re.search(out) is not None:
diff --git a/tests/spec/arb_uniform_buffer_object/dlist.c b/tests/spec/arb_uniform_buffer_object/dlist.c
index 1d101a9..4fe28f8 100644
--- a/tests/spec/arb_uniform_buffer_object/dlist.c
+++ b/tests/spec/arb_uniform_buffer_object/dlist.c
@@ -69,7 +69,7 @@ const char *source =
 	"uniform A { float a; };\n"
 	"uniform B { float b; };\n"
 	"void main() {\n"
-	"	gl_FragColor = vec4(a);\n"
+	"	gl_FragColor = vec4(a + b);\n"
 	"}\n";
 
 enum piglit_result
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-array-stride.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-array-stride.c
index 0d51f3f..8668aef 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-array-stride.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-array-stride.c
@@ -53,7 +53,7 @@ static const char fs_source[] =
 	"\n"
 	"void main()\n"
 	"{\n"
-	"	gl_FragColor = a + e + f[0];\n"
+	"	gl_FragColor = a + b[0] + vec4(c[0]) + d[0][0] + e + f[0];\n"
 	"}\n";
 
 void
diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-matrix-stride.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-matrix-stride.c
index 6e6269a..0aacf62 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-matrix-stride.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-matrix-stride.c
@@ -58,7 +58,7 @@ static const char fs_source[] =
 	"\n"
 	"void main()\n"
 	"{\n"
-	"	gl_FragColor = v4 + default_v4 + default_m4[0];\n"
+	"	gl_FragColor = v4 + default_v4 + default_m4[0] + m4[0] + vec4(m3[0], 0.) + vec4(m2[0], 0., 0.) + m4a[0][0];\n"
 	"}\n";
 
 void
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 c97d914..95849ba 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
@@ -54,15 +54,24 @@ test_format(const struct uniform_type *type)
 		"};\n"
 		"\n"
 		"void main() {\n"
-		"	gl_FragColor = vec4(align_test);\n"
+		"	gl_FragColor = vec4(align_test + float(%s));\n"
 		"}\n";
 	char *fs_source;
 	GLuint fs, prog;
 	const char *uniform_name = "u";
 	GLuint uniform_index;
 	GLint uniform_type;
+	const char *deref;
 
-	asprintf(&fs_source, fs_template, type->type);
+	if (type->size == 4) {
+		deref = "u";
+	} else if (type->size <= 16) {
+		deref = "u.x";
+	} else {
+		deref = "u[0].x";
+	}
+
+	asprintf(&fs_source, fs_template, type->type, deref);
 	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
 	prog = piglit_link_simple_program(0, fs);
 	if (!fs || !prog) {
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 8976435..5797647 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
@@ -62,7 +62,7 @@ test_format(const struct uniform_type *type, bool row_major)
 		"};\n"
 		"\n"
 		"void main() {\n"
-		"	gl_FragColor = vec4(pad);\n"
+		"	gl_FragColor = vec4(pad + %s + size_test);\n"
 		"}\n";
 	char *fs_source;
 	GLuint fs, prog;
@@ -72,15 +72,24 @@ test_format(const struct uniform_type *type, bool row_major)
 	int offset, size, expected_offset;
 	const struct uniform_type *transposed_type;
 	bool pass;
+	const char *deref;
 
 	if (row_major)
 		transposed_type = get_transposed_type(type);
 	else
 		transposed_type = type;
 
+	if (type->size == 4)
+		deref = "u";
+	else if (type->size <= 16)
+		deref = "u.x";
+	else
+		deref = "u[0].x";
+
 	asprintf(&fs_source, fs_template,
-		 row_major ? "layout(row_major) " : "",
-		 type->type);
+		 row_major && type->size > 16 ? "layout(row_major) " : "",
+		 type->type,
+		 deref);
 	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
 	prog = piglit_link_simple_program(0, fs);
 	if (!fs || !prog) {
diff --git a/tests/spec/arb_uniform_buffer_object/layout-std140.c b/tests/spec/arb_uniform_buffer_object/layout-std140.c
index 0f85f3b..d7d6654 100644
--- a/tests/spec/arb_uniform_buffer_object/layout-std140.c
+++ b/tests/spec/arb_uniform_buffer_object/layout-std140.c
@@ -97,7 +97,7 @@ static const char frag_shader_text[] =
 	"\n"
 	"void main()\n"
 	"{\n"
-	"	gl_FragColor = vec4(a);\n"
+	"	gl_FragColor = vec4(a + b.x + c.x + float(f.d) + g + h[0] + i[0].x + o[1].k.x);\n"
 	"}\n";
 
 static void
diff --git a/tests/spec/arb_uniform_buffer_object/row-major.c b/tests/spec/arb_uniform_buffer_object/row-major.c
index 55752c5..7e3425a 100644
--- a/tests/spec/arb_uniform_buffer_object/row-major.c
+++ b/tests/spec/arb_uniform_buffer_object/row-major.c
@@ -122,6 +122,24 @@ static const char *source =
 	"	gl_FragColor = (\n"
 	"		non_ubo_mat[0] + \n"
 	"		non_mat + \n"
+	"		a_cm1[0] + \n"
+	"		a_cm2[0] + \n"
+	"		a_cm3[0] + \n"
+	"		b_cm1[0] + \n"
+	"		b_rm1[0] + \n"
+	"		b_rm2[0] + \n"
+	"		c_cm1[0] + \n"
+	"		c_cm2[0] + \n"
+	"		c_rm1[0] + \n"
+	"		d_cm1[0] + \n"
+	"		d_cm2[0] + \n"
+	"		d_rm1[0] + \n"
+	"		e_cm1[0] + \n"
+	"		e_rm1[0] + \n"
+	"		e_rm2[0] + \n"
+	"		f_cm1[0] + \n"
+	"		f_rm1[0] + \n"
+	"		f_rm2[0] + \n"
 	"		a_non_matrix + \n"
 	"		b_non_matrix + \n"
 	"		c_non_matrix + \n"
-- 
1.7.11.7



More information about the Piglit mailing list