[Piglit] [PATCH V2 8/8] arb_texture_multisample: add new test for errors
Chris Forbes
chrisf at ijw.co.nz
Sun Feb 24 11:37:46 PST 2013
Tests that glFramebufferTextureLayer produces the correct error for
layer < 0 when used with GL_TEXTURE_2D_MULTISAMPLE_ARRAY. This was
overlooked in the initial mesa implementation of
ARB_texture_multisample, and crashed deep in the driver instead.
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
tests/all.tests | 1 +
.../spec/arb_texture_multisample/CMakeLists.gl.txt | 1 +
tests/spec/arb_texture_multisample/errors.c | 49 ++++++++++++++++++++++
3 files changed, 51 insertions(+)
create mode 100644 tests/spec/arb_texture_multisample/errors.c
diff --git a/tests/all.tests b/tests/all.tests
index a041515..7dd7b4f 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -874,6 +874,7 @@ for sample_count in MSAA_SAMPLE_COUNTS:
sample_count, stage, sampler)] = \
concurrent_test('texelFetch %s %s %d' % (stage, sampler, sample_count))
add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-texstate')
+add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-errors')
add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-sample-mask')
add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-sample-mask-value')
add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-sample-mask-execution')
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
index f13b062..ce9cb82 100644
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries (
)
piglit_add_executable (arb_texture_multisample-minmax minmax.c)
+piglit_add_executable (arb_texture_multisample-errors errors.c)
piglit_add_executable (arb_texture_multisample-fb-completeness fb-completeness.c)
piglit_add_executable (arb_texture_multisample-texstate texstate.c)
piglit_add_executable (arb_texture_multisample-sample-mask sample-mask.c)
diff --git a/tests/spec/arb_texture_multisample/errors.c b/tests/spec/arb_texture_multisample/errors.c
new file mode 100644
index 0000000..1b2d8b3
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/errors.c
@@ -0,0 +1,49 @@
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 30;
+
+ config.window_width = 64;
+ config.window_height = 64;
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ /* test some new error cases */
+
+ GLuint fbo, tex;
+ glGenFramebuffers(1, &fbo);
+
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex);
+ glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
+ 4, GL_RGBA, 64, 64, 2, GL_TRUE);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ printf("should be no error so far\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ /* binding a negative layer should fail */
+ glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 0, -1);
+
+ if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
+ printf("glFramebufferTextureLayer w/ negative layer must "
+ "emit GL_INVALID_VALUE but did not\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ piglit_report_result(PIGLIT_PASS);
+}
--
1.8.1.4
More information about the Piglit
mailing list