Add new API tests for BPTC and RGTC GLES extensions (v2)

Submitted by Marek Olšák on Nov. 29, 2018, 3:44 a.m.

Details

Message ID 20181129034458.24242-1-maraeo@gmail.com
State New
Headers show
Series "Add new API tests for BPTC and RGTC GLES extensions (v2)" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Marek Olšák Nov. 29, 2018, 3:44 a.m.
From: Marek Olšák <marek.olsak@amd.com>

v2: add glCompressedTexImage2D tests
---
 tests/opengl.py                               |  6 ++
 tests/spec/CMakeLists.txt                     |  2 +
 .../CMakeLists.gles2.txt                      |  7 ++
 .../CMakeLists.txt                            |  1 +
 .../ext_texture_compression_bptc/bptc-api.c   | 91 +++++++++++++++++++
 .../CMakeLists.gles2.txt                      |  7 ++
 .../CMakeLists.txt                            |  1 +
 .../ext_texture_compression_rgtc/rgtc-api.c   | 91 +++++++++++++++++++
 8 files changed, 206 insertions(+)
 create mode 100644 tests/spec/ext_texture_compression_bptc/CMakeLists.gles2.txt
 create mode 100644 tests/spec/ext_texture_compression_bptc/CMakeLists.txt
 create mode 100644 tests/spec/ext_texture_compression_bptc/bptc-api.c
 create mode 100644 tests/spec/ext_texture_compression_rgtc/CMakeLists.gles2.txt
 create mode 100644 tests/spec/ext_texture_compression_rgtc/CMakeLists.txt
 create mode 100644 tests/spec/ext_texture_compression_rgtc/rgtc-api.c

Patch hide | download patch | download mbox

diff --git a/tests/opengl.py b/tests/opengl.py
index f2ddaa217..b2e5cf7fd 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2647,20 +2647,25 @@  with profile.test_list.group_manager(
     g(['compressedteximage', 'GL_COMPRESSED_RGBA_BPTC_UNORM'])
     g(['compressedteximage', 'GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM'])
     g(['compressedteximage', 'GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT'])
     g(['compressedteximage', 'GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT'])
     g(['fbo-generatemipmap-formats', 'GL_ARB_texture_compression_bptc-unorm'],
       'fbo-generatemipmap-formats unorm')
     g(['fbo-generatemipmap-formats', 'GL_ARB_texture_compression_bptc-float'],
       'fbo-generatemipmap-formats float')
     add_texwrap_format_tests(g, 'GL_ARB_texture_compression_bptc')
 
+with profile.test_list.group_manager(
+        PiglitGLTest,
+        grouptools.join('spec', 'ext_texture_compression_bptc')) as g:
+    g(['bptc-api_gles2'])
+
 with profile.test_list.group_manager(
         PiglitGLTest,
         grouptools.join('spec', 'ext_vertex_array_bgra')) as g:
     g(['bgra-sec-color-pointer'], run_concurrent=False)
     g(['bgra-vert-attrib-pointer'], run_concurrent=False)
 
 with profile.test_list.group_manager(
         PiglitGLTest,
         grouptools.join('spec', 'apple_vertex_array_object')) as g:
     g(['vao-01'], run_concurrent=False)
@@ -3193,20 +3198,21 @@  with profile.test_list.group_manager(
     g(['compressedteximage', 'GL_COMPRESSED_SIGNED_RED_RGTC1_EXT'])
     g(['compressedteximage', 'GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT'])
     g(['arb_texture_compression-invalid-formats', 'rgtc'], 'invalid formats')
     g(['rgtc-teximage-01'], run_concurrent=False)
     g(['rgtc-teximage-02'], run_concurrent=False)
     g(['fbo-generatemipmap-formats', 'GL_EXT_texture_compression_rgtc'],
       'fbo-generatemipmap-formats')
     g(['fbo-generatemipmap-formats', 'GL_EXT_texture_compression_rgtc-signed'],
       'fbo-generatemipmap-formats-signed')
     add_texwrap_format_tests(g, 'GL_EXT_texture_compression_rgtc')
+    g(['rgtc-api_gles2'])
 
 with profile.test_list.group_manager(
         PiglitGLTest,
         grouptools.join('spec', 'ext_texture_compression_s3tc')) as g:
     g(['compressedteximage', 'GL_COMPRESSED_RGB_S3TC_DXT1_EXT'])
     g(['compressedteximage', 'GL_COMPRESSED_RGBA_S3TC_DXT1_EXT'])
     g(['compressedteximage', 'GL_COMPRESSED_RGBA_S3TC_DXT3_EXT'])
     g(['compressedteximage', 'GL_COMPRESSED_RGBA_S3TC_DXT5_EXT'])
     g(['arb_texture_compression-invalid-formats', 's3tc'], 'invalid formats')
     g(['gen-compressed-teximage'], run_concurrent=False)
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 4df9d331d..74edc5f24 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -177,10 +177,12 @@  add_subdirectory (ext_window_rectangles)
 add_subdirectory (arb_shader_texture_image_samples)
 add_subdirectory (arb_texture_barrier)
 add_subdirectory (intel_conservative_rasterization)
 add_subdirectory (arb_post_depth_coverage)
 add_subdirectory (arb_fragment_shader_interlock)
 add_subdirectory (ext_occlusion_query_boolean)
 add_subdirectory (ext_disjoint_timer_query)
 add_subdirectory (intel_blackhole_render)
 add_subdirectory (ext_texture_norm16)
 add_subdirectory (ext_render_snorm)
+add_subdirectory (ext_texture_compression_bptc)
+add_subdirectory (ext_texture_compression_rgtc)
diff --git a/tests/spec/ext_texture_compression_bptc/CMakeLists.gles2.txt b/tests/spec/ext_texture_compression_bptc/CMakeLists.gles2.txt
new file mode 100644
index 000000000..ce9d018b5
--- /dev/null
+++ b/tests/spec/ext_texture_compression_bptc/CMakeLists.gles2.txt
@@ -0,0 +1,7 @@ 
+link_libraries (
+	piglitutil_${piglit_target_api}
+)
+
+piglit_add_executable (bptc-api_gles2 bptc-api.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/ext_texture_compression_bptc/CMakeLists.txt b/tests/spec/ext_texture_compression_bptc/CMakeLists.txt
new file mode 100644
index 000000000..144a306f4
--- /dev/null
+++ b/tests/spec/ext_texture_compression_bptc/CMakeLists.txt
@@ -0,0 +1 @@ 
+piglit_include_target_api()
diff --git a/tests/spec/ext_texture_compression_bptc/bptc-api.c b/tests/spec/ext_texture_compression_bptc/bptc-api.c
new file mode 100644
index 000000000..f8456cad6
--- /dev/null
+++ b/tests/spec/ext_texture_compression_bptc/bptc-api.c
@@ -0,0 +1,91 @@ 
+/*
+ * Copyright © 2018 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_es_version = 30;
+
+	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+	config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_EXT_texture_compression_bptc");
+
+	GLuint tex;
+	glGenTextures(1, &tex);
+	glBindTexture(GL_TEXTURE_2D, tex);
+
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
+		     64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
+		     64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
+		     64, 64, 0, GL_RGB, GL_FLOAT, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
+		     64, 64, 0, GL_RGB, GL_FLOAT, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
+			       64, 64, 0, 4096, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
+			       64, 64, 0, 4096, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
+			       64, 64, 0, 4096, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
+			       64, 64, 0, 4096, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	piglit_report_result(PIGLIT_PASS);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_FAIL;
+}
diff --git a/tests/spec/ext_texture_compression_rgtc/CMakeLists.gles2.txt b/tests/spec/ext_texture_compression_rgtc/CMakeLists.gles2.txt
new file mode 100644
index 000000000..a3a325401
--- /dev/null
+++ b/tests/spec/ext_texture_compression_rgtc/CMakeLists.gles2.txt
@@ -0,0 +1,7 @@ 
+link_libraries (
+	piglitutil_${piglit_target_api}
+)
+
+piglit_add_executable (rgtc-api_gles2 rgtc-api.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/ext_texture_compression_rgtc/CMakeLists.txt b/tests/spec/ext_texture_compression_rgtc/CMakeLists.txt
new file mode 100644
index 000000000..144a306f4
--- /dev/null
+++ b/tests/spec/ext_texture_compression_rgtc/CMakeLists.txt
@@ -0,0 +1 @@ 
+piglit_include_target_api()
diff --git a/tests/spec/ext_texture_compression_rgtc/rgtc-api.c b/tests/spec/ext_texture_compression_rgtc/rgtc-api.c
new file mode 100644
index 000000000..fb43ea56f
--- /dev/null
+++ b/tests/spec/ext_texture_compression_rgtc/rgtc-api.c
@@ -0,0 +1,91 @@ 
+/*
+ * Copyright © 2018 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_es_version = 30;
+
+	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+	config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_EXT_texture_compression_rgtc");
+
+	GLuint tex;
+	glGenTextures(1, &tex);
+	glBindTexture(GL_TEXTURE_2D, tex);
+
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RED_RGTC1_EXT,
+		     64, 64, 0, GL_RED, GL_UNSIGNED_BYTE, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
+		     64, 64, 0, GL_RED, GL_BYTE, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
+		     64, 64, 0, GL_RG, GL_UNSIGNED_BYTE, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
+		     64, 64, 0, GL_RG, GL_BYTE, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RED_RGTC1_EXT,
+			       64, 64, 0, 2048, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
+			       64, 64, 0, 2048, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
+			       64, 64, 0, 4096, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
+			       64, 64, 0, 4096, NULL);
+	if (!piglit_check_gl_error(GL_NO_ERROR))
+		piglit_report_result(PIGLIT_FAIL);
+
+	piglit_report_result(PIGLIT_PASS);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_FAIL;
+}