[Piglit] [PATCH 2/4] arb_texture_multisample: test creating and binding multisample color textures
Chris Forbes
chrisf at ijw.co.nz
Fri Oct 12 01:20:19 PDT 2012
From: Chris Forbes <chris.forbes at catalyst.net.nz>
---
.../spec/arb_texture_multisample/CMakeLists.gl.txt | 1 +
tests/spec/arb_texture_multisample/binding-2d.c | 51 ++++++++++++++++++++++
2 files changed, 52 insertions(+)
create mode 100644 tests/spec/arb_texture_multisample/binding-2d.c
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..7bede36
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/binding-2d.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 maxColorSamples;
+ GLuint tex;
+ GLint boundTex;
+
+ piglit_require_gl_version(30);
+ 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.2
More information about the Piglit
mailing list