[Piglit] [PATCH V2 1/2] arb_texture_storage_multisample: add test for TexStorage*Multisample

Chris Forbes chrisf at ijw.co.nz
Fri Mar 29 01:25:44 PDT 2013


V2: - Use a legal (sized!) internalformat.
    - Refactor to subtests.
    - Add new test cases for:
        * Correct error generation for unsized formats.
        * Correct error generation for texture object zero.

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  | 141 +++++++++++++++++++++
 5 files changed, 162 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 03ae705..01487c0 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..815f591
--- /dev/null
+++ b/tests/spec/arb_texture_storage_multisample/tex-storage.c
@@ -0,0 +1,141 @@
+/*
+ * 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;
+}
+
+static void
+check_zero_texture(void)
+{
+    /* attempting to call TexStorage*Multisample on the zero texture
+     * must fail with INVALID_OPERATION */
+
+    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
+    glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+            4, GL_RGBA8, 64, 64, GL_TRUE);
+
+    piglit_report_subtest_result(
+            piglit_check_gl_error(GL_INVALID_OPERATION) ? PIGLIT_PASS : PIGLIT_FAIL,
+            "zero-texture");
+}
+
+static void
+check_unsized_format(void)
+{
+    /* attempting to call TexStorage*Multisample with an unsized internalformat
+     * must fail with INVALID_ENUM */
+
+    GLuint tex;
+    glGenTextures(1, &tex);
+    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
+
+    glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+            4, GL_RGBA, 64, 64, GL_TRUE);
+
+    /* unsized formats may not be used with TexStorage* */
+    piglit_report_subtest_result(
+            piglit_check_gl_error(GL_INVALID_ENUM) ? PIGLIT_PASS : PIGLIT_FAIL,
+            "unsized-format");
+}
+
+static void
+check_immutable(void)
+{
+    GLuint tex;
+    GLint param;
+
+    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_RGBA8, 64, 64, GL_TRUE);
+
+    if (!piglit_check_gl_error(GL_NO_ERROR)) {
+        piglit_report_subtest_result(PIGLIT_FAIL, "immutable");
+        return;
+    }
+
+    /* should now have TEXTURE_IMMUTABLE_FORMAT */
+    glGetTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE,
+            GL_TEXTURE_IMMUTABLE_FORMAT, &param);
+
+    if (!piglit_check_gl_error(GL_NO_ERROR)) {
+        printf("failed to fetch texture parameter TEXTURE_IMMUTABLE_FORMAT\n");
+        piglit_report_subtest_result(PIGLIT_FAIL, "immutable");
+        return;
+    }
+
+    if (param != GL_TRUE) {
+        printf("expected TEXTURE_IMMUTABLE_FORMAT to be true, got %d\n", param);
+        piglit_report_subtest_result(PIGLIT_FAIL, "immutable");
+        return;
+    }
+
+    /* calling TexStorage2DMultisample again on the same texture should fail */
+    glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+            4, GL_RGBA8, 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_subtest_result(PIGLIT_FAIL, "immutable");
+        return;
+    }
+
+    /* calling TexImage2DMultisample should fail too */
+    glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+            4, GL_RGBA8, 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_subtest_result(PIGLIT_FAIL, "immutable");
+        return;
+    }
+
+    piglit_report_subtest_result(PIGLIT_PASS, "immutable");
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+    piglit_require_extension("GL_ARB_texture_storage_multisample");
+
+    check_zero_texture();
+    check_immutable();
+    check_unsized_format();
+
+    piglit_report_result(PIGLIT_SKIP);
+}
-- 
1.8.2



More information about the Piglit mailing list