diff options
author | Laura Ekstrand <laura@jlekstrand.net> | 2015-01-29 17:10:35 -0800 |
---|---|---|
committer | Laura Ekstrand <laura@jlekstrand.net> | 2015-03-09 16:20:44 -0700 |
commit | de6bd0bd2a5dfee6ea5c4444b90fd87fcc87dcb9 (patch) | |
tree | 1ed24ba100706ab112d3e02fcbfc00d832d8b7d8 | |
parent | dacd04fa1ad9e4769ee783428d0f3ddd3f16dd4e (diff) |
arb_direct_state_access: Testing GetNamedFramebufferAttachmentParameteriv.
-rw-r--r-- | tests/all.py | 1 | ||||
-rw-r--r-- | tests/spec/arb_direct_state_access/CMakeLists.gl.txt | 1 | ||||
-rw-r--r-- | tests/spec/arb_direct_state_access/fbattachmentparam-errors.c | 117 |
3 files changed, 119 insertions, 0 deletions
diff --git a/tests/all.py b/tests/all.py index 6862d44e5..d64637596 100644 --- a/tests/all.py +++ b/tests/all.py @@ -4244,6 +4244,7 @@ with profile.group_manager( g(['arb_direct_state_access-namedframebufferrenderbuffer'], 'namedframebufferrenderbuffer') 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') 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 20c2528d9..37015a7ef 100644 --- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt +++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt @@ -28,6 +28,7 @@ piglit_add_executable (arb_direct_state_access-getnamedbuffersubdata getnamedbuf piglit_add_executable (arb_direct_state_access-namedframebufferrenderbuffer namedframebufferrenderbuffer.c) 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-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/fbattachmentparam-errors.c b/tests/spec/arb_direct_state_access/fbattachmentparam-errors.c new file mode 100644 index 000000000..3d6670b60 --- /dev/null +++ b/tests/spec/arb_direct_state_access/fbattachmentparam-errors.c @@ -0,0 +1,117 @@ +/* + * 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 fbattachmentparam-errors.c + * + * Make sure that glGetNamedFramebufferAttachmentParameteriv behaves + * according to the OpenGL 4.5 spec (30.10.2014). + * + * Section 9.2 Binding and Managing Framebuffer Objects of the OpenGL + * 4.5 core spec (30.10.2014, PDF page 314): + * "If framebuffer is zero, then the default draw framebuffer is + * queried." + */ + +#include "piglit-util-gl.h" +#include "dsa-utils.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_core_version = 32; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + piglit_require_extension("GL_ARB_direct_state_access"); +} + +static bool +get_param(GLuint fbo, GLenum att, GLenum pname, GLint expected_param, + bool expect_fail) +{ + GLint param; + + glGetNamedFramebufferAttachmentParameteriv(fbo, att, pname, ¶m); + if (!expect_fail && (param != expected_param)) { + printf("fbo=%u, att=%s, pname=%s status:" + " got %d, expected %d\n", + fbo, piglit_get_gl_enum_name(att), + piglit_get_gl_enum_name(pname), param, expected_param); + return false; + } + + return true; +} + +enum piglit_result +piglit_display(void) +{ + bool pass = true; + GLuint fbo, texture; + + /* Non-generated name */ + get_param(1337, GL_COLOR_ATTACHMENT0, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, 0, true); + SUBTEST(GL_INVALID_OPERATION, pass, "bad fbo name"); + + /* Uninitialized fbo */ + glCreateFramebuffers(1, &fbo); + SUBTESTCONDITION(get_param(fbo, GL_COLOR_ATTACHMENT0, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, + GL_NONE, false), pass, "uninitialized fbo"); + piglit_check_gl_error(GL_NO_ERROR); + + /* This should be complete */ + glCreateTextures(GL_TEXTURE_2D, 1, &texture); + glTextureStorage2D(texture, 1, GL_RGB8, 30, 30); + glNamedFramebufferTexture(fbo, GL_COLOR_ATTACHMENT0, texture, 0); + SUBTESTCONDITION(get_param(fbo, GL_COLOR_ATTACHMENT0, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, + GL_TEXTURE, false), pass, "initialized fbo"); + piglit_check_gl_error(GL_NO_ERROR); + + /* Bad attachment name for user fbo */ + get_param(fbo, GL_FRONT_LEFT, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, 0, true); + SUBTEST(GL_INVALID_ENUM, pass, "default fb attachment, user fbo"); + + /* Bad attachment name for default fbo */ + get_param(0, GL_COLOR_ATTACHMENT0, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, 0, true); + SUBTEST(GL_INVALID_ENUM, pass, "fbo attachment, default fb"); + + /* Default fbo */ + SUBTESTCONDITION(get_param(0, GL_FRONT_LEFT, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, + GL_FRAMEBUFFER_DEFAULT, false), pass, + "default fb with default fb attachment"); + piglit_check_gl_error(GL_NO_ERROR); + + + glDeleteTextures(1, &texture); + glDeleteFramebuffers(1, &fbo); + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} |