aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Forbes <chrisf@ijw.co.nz>2013-01-22 20:11:06 +1300
committerChris Forbes <chrisf@ijw.co.nz>2013-03-03 21:03:22 +1300
commit773e3fa8bb6c10584096ad7a813718c599366446 (patch)
tree10f200464cac6409941fb5d877be1fccc10b5cc6
parent53e978ef175f24e172c8830e0e099767c55a8eef (diff)
downloadpiglit-773e3fa8bb6c10584096ad7a813718c599366446.tar.gz
arb_texture_multisample: add new test for errors
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. V3: - Don't set the window size, we don't care. V4: - Add missing copyright notice. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
-rw-r--r--tests/all.tests1
-rw-r--r--tests/spec/arb_texture_multisample/CMakeLists.gl.txt1
-rw-r--r--tests/spec/arb_texture_multisample/errors.c69
3 files changed, 71 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests
index 9c7144f3..1dccd9ad 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -880,6 +880,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 f13b0625..ce9cb824 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 00000000..38451f55
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/errors.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 2013 Chris Forbes
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 30;
+
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA | 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);
+}