--- tests/all.tests | 2 +- .../spec/arb_color_buffer_float/CMakeLists.gl.txt | 1 + tests/spec/arb_color_buffer_float/api-get.c | 90 ++++++++++++++++++++ 3 files changed, 92 insertions(+), 1 deletions(-) create mode 100644 tests/spec/arb_color_buffer_float/api-get.c
diff --git a/tests/all.tests b/tests/all.tests index 0ec6ee3..507601c 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1012,7 +1012,7 @@ add_color_buffer_float_test('render', 'GL_RGBA32F', '', '') add_color_buffer_float_test('render', 'GL_RGBA32F', 'fog', '') add_color_buffer_float_test('render', 'GL_RGBA32F', 'sanity', '') add_color_buffer_float_test('render', 'GL_RGBA32F', 'sanity', 'fog') - +arb_color_buffer_float['api-get'] = concurrent_test('arb_color_buffer_float-api-get') arb_depth_texture = Group() spec['ARB_depth_texture'] = arb_depth_texture diff --git a/tests/spec/arb_color_buffer_float/CMakeLists.gl.txt b/tests/spec/arb_color_buffer_float/CMakeLists.gl.txt index f01bb02..a5747d5 100644 --- a/tests/spec/arb_color_buffer_float/CMakeLists.gl.txt +++ b/tests/spec/arb_color_buffer_float/CMakeLists.gl.txt @@ -21,5 +21,6 @@ add_executable (arb_color_buffer_float-drawpixels drawpixels.c) add_executable (arb_color_buffer_float-clear clear.c) add_executable (arb_color_buffer_float-render render.c) add_executable (arb_color_buffer_float-mrt mrt.c) +add_executable (arb_color_buffer_float-api-get api-get.c) # vim: ft=cmake: diff --git a/tests/spec/arb_color_buffer_float/api-get.c b/tests/spec/arb_color_buffer_float/api-get.c new file mode 100644 index 0000000..2478638 --- /dev/null +++ b/tests/spec/arb_color_buffer_float/api-get.c @@ -0,0 +1,90 @@ +/* + * Copyright © 2011 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. + */ + +#include "piglit-util.h" + +/** + * @file api-get.c + * + * Tests that the new ARB_color_buffer_float enums can be accessed + * with GetIntegerv. Catches a bug in the Mesa implementation. + * + * From the ARB_color_buffer_float spec: + * + * "Accepted by the <target> parameter of ClampColorARB and the <pname> + * parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev. + * + * CLAMP_VERTEX_COLOR_ARB 0x891A + * CLAMP_FRAGMENT_COLOR_ARB 0x891B + * CLAMP_READ_COLOR_ARB 0x891C + * + * Accepted by the <clamp> parameter of ClampColorARB. + * + * FIXED_ONLY_ARB 0x891D + * FALSE + * TRUE" + */ + +int piglit_width = 32; +int piglit_height = 32; +int piglit_window_mode = GLUT_RGB | GLUT_ALPHA; + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_FAIL; +} + +void +set_and_check(GLenum token, GLenum val) +{ + GLint ret; + + glClampColorARB(token, val); + glGetIntegerv(token, &ret); + piglit_check_gl_error(GL_NO_ERROR, PIGLIT_FAIL); + + if (ret != val) { + fprintf(stderr, "Setting 0x%x to 0x%x returned 0x%x\n", + token, val, ret); + piglit_report_result(PIGLIT_FAIL); + } +} + +void +piglit_init(int argc, char **argv) +{ + piglit_require_extension("GL_ARB_color_buffer_float"); + + set_and_check(GL_CLAMP_VERTEX_COLOR, GL_FIXED_ONLY); + set_and_check(GL_CLAMP_VERTEX_COLOR, GL_TRUE); + set_and_check(GL_CLAMP_VERTEX_COLOR, GL_FALSE); + set_and_check(GL_CLAMP_FRAGMENT_COLOR, GL_FIXED_ONLY); + set_and_check(GL_CLAMP_FRAGMENT_COLOR, GL_TRUE); + set_and_check(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE); + set_and_check(GL_CLAMP_READ_COLOR, GL_FIXED_ONLY); + set_and_check(GL_CLAMP_READ_COLOR, GL_TRUE); + set_and_check(GL_CLAMP_READ_COLOR, GL_FALSE); + + piglit_report_result(PIGLIT_PASS); +} -- 1.7.6.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev