[Piglit] [PATCH 3/4] arb_texture_multisample: test creating and binding multisample depth textures

Chris Forbes chrisf at ijw.co.nz
Fri Oct 12 01:20:20 PDT 2012


From: Chris Forbes <chris.forbes at catalyst.net.nz>

---
 .../spec/arb_texture_multisample/CMakeLists.gl.txt |  1 +
 .../arb_texture_multisample/binding-2d-depth.c     | 51 ++++++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 tests/spec/arb_texture_multisample/binding-2d-depth.c

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..3bb7f7f
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/binding-2d-depth.c
@@ -0,0 +1,51 @@
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_MAIN(
+    10 /*window_width*/,
+    10 /*window_height*/,
+    GLUT_RGB)
+
+enum piglit_result
+piglit_display(void)
+{
+    return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+    GLint maxDepthSamples;
+    GLuint tex;
+    GLint boundTex;
+
+    piglit_require_gl_version(30);
+    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.2



More information about the Piglit mailing list