[Piglit] [PATCH 3/4] arb_texture_multisample: test creating and binding multisample depth textures V2: updated for new piglit config block

Chris Forbes chrisf at ijw.co.nz
Sat Oct 13 19:55:07 PDT 2012


Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 tests/all.tests                                    |  1 +
 .../spec/arb_texture_multisample/CMakeLists.gl.txt |  1 +
 .../arb_texture_multisample/binding-2d-depth.c     | 55 ++++++++++++++++++++++
 3 files changed, 57 insertions(+)
 create mode 100644 tests/spec/arb_texture_multisample/binding-2d-depth.c

diff --git a/tests/all.tests b/tests/all.tests
index a6b73d7..c6a1004 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1091,6 +1091,7 @@ add_plain_test(arb_point_sprite, 'point-sprite')
 arb_texture_multisample = Group()
 spec['ARB_texture_multisample'] = arb_texture_multisample
 add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-binding-2d')
+add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-binding-2d-depth')
 
 # Group AMD_shader_stencil_export
 spec['AMD_shader_stencil_export'] = Group()
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
index c1cd973..c259403 100644
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -11,5 +11,6 @@ link_libraries (
 )
 
 piglit_add_executable (arb_texture_multisample-binding-2d binding-2d.c)
+piglit_add_executable (arb_texture_multisample-binding-2d-depth binding-2d-depth.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_multisample/binding-2d-depth.c b/tests/spec/arb_texture_multisample/binding-2d-depth.c
new file mode 100644
index 0000000..7b57340
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/binding-2d-depth.c
@@ -0,0 +1,55 @@
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_compat_version = 30;
+
+	config.window_width = 10;
+	config.window_height = 10;
+	config.window_visual = PIGLIT_GL_VISUAL_RGB;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+    return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+    GLint maxDepthSamples;
+    GLuint tex;
+    GLint boundTex;
+
+    piglit_require_extension("GL_ARB_texture_multisample");
+
+    glGetIntegerv( GL_MAX_DEPTH_TEXTURE_SAMPLES, &maxDepthSamples );
+    piglit_check_gl_error(GL_NO_ERROR);
+    if (maxDepthSamples < 1) {
+        printf("GL_MAX_DEPTH_TEXTURE_SAMPLES must be at least 1\n");
+        piglit_report_result(PIGLIT_FAIL);
+    }
+
+    printf("GL_MAX_DEPTH_TEXTURE_SAMPLES: %d\n", maxDepthSamples);
+
+    /* verify that the binding point exists and has the zero texture
+        object bound initially */
+    glGetIntegerv( GL_TEXTURE_BINDING_2D_MULTISAMPLE, &boundTex );
+    piglit_check_gl_error(GL_NO_ERROR);
+    if (boundTex != 0) {
+        printf( "GL_TEXTURE_BINDING_2D_MULTISAMPLE default is bogus\n" );
+        piglit_report_result(PIGLIT_FAIL);
+    }
+
+    /* create a multisample depth texture with the max # samples */
+    glGenTextures(1, &tex);
+    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
+    glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+        maxDepthSamples, GL_DEPTH_COMPONENT, 64, 64, GL_TRUE);
+
+    piglit_check_gl_error(GL_NO_ERROR);
+
+    piglit_report_result(PIGLIT_PASS);
+}
-- 
1.7.12.3



More information about the Piglit mailing list