aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2013-03-04 14:32:29 -0800
committerAnuj Phogat <anuj.phogat@gmail.com>2013-03-08 15:10:06 -0800
commitf74125242a544676554fd20fc53e013c4d88e4b2 (patch)
treed255e372e954fb8cd9632a14c9cbd8aba551069e
parent343384b8bb3f7e5f2e5f3d1495345c6707e5d41b (diff)
downloadpiglit-f74125242a544676554fd20fc53e013c4d88e4b2.tar.gz
Enable etc2 tests on gl contexts that support GL_ARB_ES3_compatibility extension
V2: Enable the test to choose core/compat GL context at run time. Add GL version of test to all.tests. Use VAO to enable the test run on core context. Reviewed-by: Matt Turner <mattst88@gmail.com>
-rw-r--r--tests/all.tests10
-rw-r--r--tests/spec/gles-3.0/CMakeLists.gl.txt4
-rw-r--r--tests/spec/gles-3.0/CMakeLists.gles3.txt2
-rw-r--r--tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c66
4 files changed, 69 insertions, 13 deletions
diff --git a/tests/all.tests b/tests/all.tests
index cb0c21c9..74e864b0 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2802,7 +2802,7 @@ add_concurrent_test(gles20, 'fbo_discard_gles2')
gles30 = Group()
spec['!OpenGL ES 3.0'] = gles30
for tex_format in ('rgb8', 'srgb8', 'rgba8', 'srgb8-alpha8', 'r11', 'rg11', 'rgb8-punchthrough-alpha1', 'srgb8-punchthrough-alpha1'):
- test_name = ' ' .join(['oes_compressed_etc2_texture-miptree', tex_format])
+ test_name = ' ' .join(['oes_compressed_etc2_texture-miptree_gles3', tex_format])
executable = '{0} -auto'.format(test_name)
gles30[test_name] = concurrent_test(executable)
gles30['minmax'] = concurrent_test('minmax_gles3')
@@ -2810,6 +2810,14 @@ for test_mode in ['teximage', 'texsubimage']:
test_name = 'ext_texture_array-compressed_gles3 {0}'.format(test_mode)
gles30[test_name] = PlainExecTest(test_name + ' -auto -fbo')
+arb_es3_compatibility = Group()
+spec['ARB_ES3_compatibility'] = arb_es3_compatibility
+for tex_format in ('rgb8', 'srgb8', 'rgba8', 'srgb8-alpha8', 'r11', 'rg11', 'rgb8-punchthrough-alpha1', 'srgb8-punchthrough-alpha1'):
+ for context in ('core', 'compat'):
+ test_name = ' ' .join(['oes_compressed_etc2_texture-miptree', tex_format, context])
+ executable = '{0}'.format(test_name)
+ arb_es3_compatibility[test_name] = concurrent_test(executable)
+
add_shader_test_dir(spec, os.path.join(generatedTestDir, 'spec'),
recursive=True)
import_glsl_parser_tests(profile.tests, generatedTestDir, ['spec'])
diff --git a/tests/spec/gles-3.0/CMakeLists.gl.txt b/tests/spec/gles-3.0/CMakeLists.gl.txt
new file mode 100644
index 00000000..8bf06140
--- /dev/null
+++ b/tests/spec/gles-3.0/CMakeLists.gl.txt
@@ -0,0 +1,4 @@
+link_libraries (
+ piglitutil_${piglit_target_api}
+)
+piglit_add_executable(oes_compressed_etc2_texture-miptree oes_compressed_etc2_texture-miptree.c)
diff --git a/tests/spec/gles-3.0/CMakeLists.gles3.txt b/tests/spec/gles-3.0/CMakeLists.gles3.txt
index d02e8c6e..13cef0cf 100644
--- a/tests/spec/gles-3.0/CMakeLists.gles3.txt
+++ b/tests/spec/gles-3.0/CMakeLists.gles3.txt
@@ -3,6 +3,6 @@ link_libraries(
)
piglit_add_executable(minmax_${piglit_target_api} minmax.c)
-piglit_add_executable(oes_compressed_etc2_texture-miptree oes_compressed_etc2_texture-miptree.c)
+piglit_add_executable(oes_compressed_etc2_texture-miptree_gles3 oes_compressed_etc2_texture-miptree.c)
# vim: ft=cmake:
diff --git a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
index fceafab8..0e29fd1a 100644
--- a/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
+++ b/tests/spec/gles-3.0/oes_compressed_etc2_texture-miptree.c
@@ -54,13 +54,6 @@ static const int num_vertices = 4;
static const int window_width = 128;
static const int window_height = 64;
-PIGLIT_GL_TEST_CONFIG_BEGIN
- config.supports_gl_es_version = 30;
- config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
-
-PIGLIT_GL_TEST_CONFIG_END
-
-
static GLuint prog;
/* Texture objects. */
@@ -108,7 +101,7 @@ load_texture(const char *filename, GLuint *tex_name)
void
print_usage_and_exit(char *prog_name)
{
- printf("Usage: %s <format>\n"
+ printf("Usage: %s <format> %s\n"
" where <format> is one of:\n"
" rgb8\n"
" srgb8\n"
@@ -117,7 +110,14 @@ print_usage_and_exit(char *prog_name)
" r11\n"
" rg11\n"
" rgb8-punchthrough-alpha1\n"
- " srgb8-punchthrough-alpha1\n", prog_name);
+ " srgb8-punchthrough-alpha1\n"
+#if defined(PIGLIT_USE_OPENGL)
+ " <profile> is one of:\n"
+ " compat\n"
+ " core\n", prog_name, "<profile>");
+#elif defined(PIGLIT_USE_OPENGL_ES3)
+ ,prog_name, "");
+#endif
piglit_report_result(PIGLIT_FAIL);
}
@@ -173,9 +173,10 @@ piglit_init(int argc, char **argv)
GLint vertex_loc;
GLuint vertex_buf;
+ GLuint vao;
- if (argc < 2)
- print_usage_and_exit(argv[0]);
+ if (!piglit_is_gles())
+ piglit_require_extension("GL_ARB_ES3_compatibility");
if (strcmp(argv[1], "rgb8") == 0) {
compressed_filename =
@@ -245,6 +246,8 @@ piglit_init(int argc, char **argv)
glUseProgram(prog);
vertex_loc = glGetAttribLocation(prog, "vertex");
+ glGenVertexArrays(1, &vao);
+ glBindVertexArray(vao);
glGenBuffers(1, &vertex_buf);
glBindBuffer(GL_ARRAY_BUFFER, vertex_buf);
glEnableVertexAttribArray(vertex_loc);
@@ -309,3 +312,44 @@ piglit_display(void)
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
+
+int
+main(int argc, char *argv[])
+{
+ struct piglit_gl_test_config config;
+ bool test_compat = true;
+
+#if defined(PIGLIT_USE_OPENGL)
+ if (argc < 3)
+ print_usage_and_exit(argv[0]);
+
+ test_compat = strcmp(argv[2], "compat") == 0;
+
+ if (!test_compat && strcmp(argv[2], "core") != 0)
+ print_usage_and_exit(argv[0]);
+
+#elif defined(PIGLIT_USE_OPENGL_ES3)
+ if (argc < 2)
+ print_usage_and_exit(argv[0]);
+#endif
+
+ piglit_gl_test_config_init(&config);
+ config.init = piglit_init;
+ config.display = piglit_display;
+
+ if (test_compat)
+ config.supports_gl_compat_version = 10;
+ else
+ config.supports_gl_core_version = 31;
+
+ config.supports_gl_es_version = 30;
+
+ config.window_width = 150;
+ config.window_height = 150;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA;
+
+ piglit_gl_test_run(argc, argv, &config);
+
+ assert(false);
+ return 0;
+}