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

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


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

diff --git a/tests/all.tests b/tests/all.tests
index 964c84c..a6b73d7 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1087,6 +1087,11 @@ arb_point_sprite = Group()
 spec['ARB_point_sprite'] = arb_point_sprite
 add_plain_test(arb_point_sprite, 'point-sprite')
 
+# Group ARB_texture_multisample
+arb_texture_multisample = Group()
+spec['ARB_texture_multisample'] = arb_texture_multisample
+add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-binding-2d')
+
 # Group AMD_shader_stencil_export
 spec['AMD_shader_stencil_export'] = Group()
 import_glsl_parser_tests(spec['AMD_shader_stencil_export'],
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
index c37afac..c1cd973 100644
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries (
 	${OPENGL_glu_LIBRARY}
 )
 
+piglit_add_executable (arb_texture_multisample-binding-2d binding-2d.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_multisample/binding-2d.c b/tests/spec/arb_texture_multisample/binding-2d.c
new file mode 100644
index 0000000..50bacc9
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/binding-2d.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 maxColorSamples;
+    GLuint tex;
+    GLint boundTex;
+
+    piglit_require_extension("GL_ARB_texture_multisample");
+
+    glGetIntegerv( GL_MAX_COLOR_TEXTURE_SAMPLES, &maxColorSamples );
+    piglit_check_gl_error(GL_NO_ERROR);
+    if (maxColorSamples < 1) {
+        printf("GL_MAX_COLOR_TEXTURE_SAMPLES must be at least 1\n");
+        piglit_report_result(PIGLIT_FAIL);
+    }
+
+    printf("GL_MAX_COLOR_TEXTURE_SAMPLES: %d\n", maxColorSamples);
+
+    /* 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 color texture with the max # samples */
+    glGenTextures(1, &tex);
+    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
+    glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
+        maxColorSamples, GL_RGBA, 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