[Piglit] [PATCH 1/2] arb_texture_storage_multisample: add test for TexStorage*Multisample
Chris Forbes
chrisf at ijw.co.nz
Sat Mar 16 20:17:59 PDT 2013
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
tests/all.tests | 4 +
tests/spec/CMakeLists.txt | 1 +
.../CMakeLists.gl.txt | 15 ++++
.../arb_texture_storage_multisample/CMakeLists.txt | 1 +
.../arb_texture_storage_multisample/tex-storage.c | 91 ++++++++++++++++++++++
5 files changed, 112 insertions(+)
create mode 100644 tests/spec/arb_texture_storage_multisample/CMakeLists.gl.txt
create mode 100644 tests/spec/arb_texture_storage_multisample/CMakeLists.txt
create mode 100644 tests/spec/arb_texture_storage_multisample/tex-storage.c
diff --git a/tests/all.tests b/tests/all.tests
index 451aef7..71722d5 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1193,6 +1193,10 @@ arb_texture_storage = Group()
spec['ARB_texture_storage'] = arb_texture_storage
arb_texture_storage['texture-storage'] = plain_test('arb_texture_storage-texture-storage')
+arb_texture_storage_multisample = Group()
+spec['ARB_texture_storage_multisample'] = arb_texture_storage_multisample
+arb_texture_storage_multisample['tex-storage'] = concurrent_test('arb_texture_storage_multisample-tex-storage')
+
tdfx_texture_compression_fxt1 = Group()
spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
add_concurrent_test(tdfx_texture_compression_fxt1, 'compressedteximage GL_COMPRESSED_RGB_FXT1_3DFX')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 18b1d37..ce07a23 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -28,6 +28,7 @@ add_subdirectory (arb_texture_float)
add_subdirectory (arb_texture_rectangle)
add_subdirectory (arb_texture_multisample)
add_subdirectory (arb_texture_storage)
+add_subdirectory (arb_texture_storage_multisample)
add_subdirectory (arb_timer_query)
add_subdirectory (arb_transform_feedback2)
add_subdirectory (ati_envmap_bumpmap)
diff --git a/tests/spec/arb_texture_storage_multisample/CMakeLists.gl.txt b/tests/spec/arb_texture_storage_multisample/CMakeLists.gl.txt
new file mode 100644
index 0000000..c0d4df0
--- /dev/null
+++ b/tests/spec/arb_texture_storage_multisample/CMakeLists.gl.txt
@@ -0,0 +1,15 @@
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+ ${piglit_SOURCE_DIR}/tests/spec/arb_texture_storage_multisample
+)
+
+link_libraries (
+ piglitutil_${piglit_target_api}
+ ${OPENGL_gl_LIBRARY}
+ ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_texture_storage_multisample-tex-storage tex-storage.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_texture_storage_multisample/CMakeLists.txt b/tests/spec/arb_texture_storage_multisample/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/arb_texture_storage_multisample/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_texture_storage_multisample/tex-storage.c b/tests/spec/arb_texture_storage_multisample/tex-storage.c
new file mode 100644
index 0000000..5d6e57d
--- /dev/null
+++ b/tests/spec/arb_texture_storage_multisample/tex-storage.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright © 2013 Chris Forbes
+ *
+ * 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-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 30;
+
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLuint tex;
+ GLint param;
+
+ piglit_require_extension("GL_ARB_texture_storage_multisample");
+
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
+
+ /* specify storage for the texture, and mark it immutable-format */
+ glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+ 4, GL_RGBA, 64, 64, GL_TRUE);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+
+
+ /* should now have TEXTURE_IMMUTABLE_FORMAT */
+ glGetTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE,
+ GL_TEXTURE_IMMUTABLE_FORMAT, ¶m);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ printf("failed to fetch texture parameter TEXTURE_IMMUTABLE_FORMAT\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ if (param != GL_TRUE) {
+ printf("expected TEXTURE_IMMUTABLE_FORMAT to be true, got %d\n", param);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ /* calling TexStorage2DMultisample again on the same texture should fail */
+ glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+ 4, GL_RGBA, 32, 32, GL_TRUE);
+
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
+ printf("expected respecifying an immutable-format texture (with TexStorage*Multisample) to fail\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ /* calling TexImage2DMultisample should fail too */
+ glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+ 4, GL_RGBA, 32, 32, GL_TRUE);
+
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
+ printf("expected respecifying an immutable-format texture (with TexImage*Multisample) to fail\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ piglit_report_result(PIGLIT_PASS);
+}
--
1.8.2
More information about the Piglit
mailing list