summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Ekstrand <laura@jlekstrand.net>2015-02-04 16:17:58 -0800
committerLaura Ekstrand <laura@jlekstrand.net>2015-03-09 16:20:45 -0700
commit31c7c5607a912764542df0cefe42c9eb4e21f7d7 (patch)
tree5396c644654c9d4df27d05009a03d81bd33bcc3c
parent9698dd9dd7eb679cea5083e3c9362d9ef4d54490 (diff)
arb_direct_state_access: Testing Invalidate*Framebuffer*.
This is just some trivial error testing, because apparently Mesa doesn't actually implement the glInvalidate*Framebuffer* functionality. Testers of other drivers are welcome to submit a less trivial test at a future date.
-rw-r--r--tests/all.py1
-rw-r--r--tests/spec/arb_direct_state_access/CMakeLists.gl.txt1
-rw-r--r--tests/spec/arb_direct_state_access/invalidateframebuffer.c120
3 files changed, 122 insertions, 0 deletions
diff --git a/tests/all.py b/tests/all.py
index d64637596..904583c7a 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4245,6 +4245,7 @@ with profile.group_manager(
g(['arb_direct_state_access-framebufferblit'], 'framebufferblit')
g(['arb_direct_state_access-checkfbstatus-errors'], 'checkfbstatus-errors')
g(['arb_direct_state_access-fbattachmentparam-errors'], 'fbattachmentparam-errors')
+ g(['arb_direct_state_access-invalidateframebuffer'], 'invalidateframebuffer')
with profile.group_manager(
PiglitGLTest,
diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
index 37015a7ef..406c3c128 100644
--- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
+++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
@@ -29,6 +29,7 @@ piglit_add_executable (arb_direct_state_access-namedframebufferrenderbuffer name
piglit_add_executable (arb_direct_state_access-framebufferblit framebufferblit.c)
piglit_add_executable (arb_direct_state_access-checkfbstatus-errors checkfbstatus-errors.c)
piglit_add_executable (arb_direct_state_access-fbattachmentparam-errors fbattachmentparam-errors.c)
+piglit_add_executable (arb_direct_state_access-invalidateframebuffer invalidateframebuffer.c)
piglit_add_executable (arb_direct_state_access-dsa-textures dsa-textures.c dsa-utils.c)
piglit_add_executable (arb_direct_state_access-texturesubimage texturesubimage.c)
piglit_add_executable (arb_direct_state_access-bind-texture-unit bind-texture-unit.c)
diff --git a/tests/spec/arb_direct_state_access/invalidateframebuffer.c b/tests/spec/arb_direct_state_access/invalidateframebuffer.c
new file mode 100644
index 000000000..30daee1d8
--- /dev/null
+++ b/tests/spec/arb_direct_state_access/invalidateframebuffer.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2015 Intel Corporation
+ *
+ * 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.
+ */
+
+/** @file invalidateframebuffer.c
+ *
+ * Trivial tests for glInvalidate*Framebuffer* functions.
+ */
+
+#include "piglit-util-gl.h"
+#include "dsa-utils.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_core_version = 32;
+
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA |
+ PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_ARB_direct_state_access");
+ piglit_require_extension("GL_ARB_invalidate_subdata");
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ bool pass = true;
+ GLuint fbo, texture[2];
+ GLenum attachments[2] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1};
+ GLenum winsysatt[2] = {GL_FRONT_LEFT, GL_COLOR};
+
+ glCreateFramebuffers(1, &fbo);
+ glCreateTextures(GL_TEXTURE_2D, 2, texture);
+ glNamedFramebufferTexture(fbo, attachments[0], texture[0], 0);
+ glNamedFramebufferTexture(fbo, attachments[1], texture[1], 0);
+
+ /* Bad target */
+ glInvalidateSubFramebuffer(GL_INVALID_ENUM, 2, attachments,
+ 0, 0, 32, 32);
+ SUBTEST(GL_INVALID_ENUM, pass, "bad target");
+
+ /* Non-generated name */
+ glInvalidateNamedFramebufferSubData(1337, 2, attachments,
+ 0, 0, 32, 32);
+ SUBTEST(GL_INVALID_OPERATION, pass, "bad name");
+
+ /* Negative number of attachments */
+ glInvalidateNamedFramebufferSubData(fbo, -1, attachments,
+ 0, 0, 32, 32);
+ SUBTEST(GL_INVALID_VALUE, pass, "numAttachments < 0");
+
+ /* Number of attachments larger than array */
+ glInvalidateNamedFramebufferSubData(fbo, 3, attachments,
+ 0, 0, 32, 32);
+ SUBTEST(GL_INVALID_ENUM, pass, "numAttachments exceeds array size");
+
+ /* Negative width */
+ glInvalidateNamedFramebufferSubData(fbo, 2, attachments,
+ 0, 0, -32, 32);
+ SUBTEST(GL_INVALID_VALUE, pass, "width < 0");
+
+ /* Negative height */
+ glInvalidateNamedFramebufferSubData(fbo, 2, attachments,
+ 0, 0, 32, -32);
+ SUBTEST(GL_INVALID_VALUE, pass, "height < 0");
+
+ /* fbo with default attachment enums */
+ glInvalidateNamedFramebufferSubData(fbo, 2, winsysatt,
+ 0, 0, 32, 32);
+ SUBTEST(GL_INVALID_ENUM, pass, "default fb attachments, user fbo");
+
+ /* default framebuffer with fbo attachment enums */
+ glInvalidateNamedFramebufferSubData(0, 2, attachments,
+ 0, 0, 32, 32);
+ SUBTEST(GL_INVALID_ENUM, pass, "user fbo attachments, default fb");
+
+
+ /* Trivial cases */
+ glInvalidateNamedFramebufferSubData(0, 2, winsysatt,
+ 0, 0, 32, 32);
+ SUBTEST(GL_NO_ERROR, pass, "trivial default fb test");
+
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glInvalidateFramebuffer(GL_FRAMEBUFFER, 2, winsysatt);
+ SUBTEST(GL_NO_ERROR, pass, "trivial, traditional default fb test");
+
+ glInvalidateNamedFramebufferData(fbo, 2, attachments);
+ SUBTEST(GL_NO_ERROR, pass, "trivial fbo test");
+
+
+ glDeleteTextures(2, texture);
+ glDeleteFramebuffers(1, &fbo);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+