diff options
author | Eric Anholt <eric@anholt.net> | 2012-03-20 16:45:38 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2012-03-27 14:12:19 -0700 |
commit | e0f3fc04e5f8253a0abcff672b36f170c4bfbddb (patch) | |
tree | 2000e433df0e89c2ccf75f9a75839c725386a9a8 | |
parent | 9355520131ba168633907ea249bf86c49d8171ff (diff) |
GL_ARB_texture_buffer_object/get: New test for remaining queries.
-rw-r--r-- | tests/all.tests | 1 | ||||
-rw-r--r-- | tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt | 1 | ||||
-rw-r--r-- | tests/spec/arb_texture_buffer_object/get.c | 87 |
3 files changed, 89 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests index 4f6fbb179..be5b96407 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -1136,6 +1136,7 @@ add_plain_test(arb_explicit_attrib_location, 'glsl-explicit-location-05') arb_texture_buffer_object = Group() spec['ARB_texture_buffer_object'] = arb_texture_buffer_object arb_texture_buffer_object['dlist'] = concurrent_test('arb_texture_buffer_object-dlist') +arb_texture_buffer_object['get'] = concurrent_test('arb_texture_buffer_object-get') arb_texture_buffer_object['minmax'] = concurrent_test('arb_texture_buffer_object-minmax') arb_texture_buffer_object['negative-bad-bo'] = concurrent_test('arb_texture_buffer_object-negative-bad-bo') arb_texture_buffer_object['negative-bad-format'] = concurrent_test('arb_texture_buffer_object-negative-bad-format') diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt index c56b8a8e9..451fd2721 100644 --- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt +++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt @@ -13,6 +13,7 @@ link_libraries ( ) piglit_add_executable (arb_texture_buffer_object-dlist dlist.c) +piglit_add_executable (arb_texture_buffer_object-get get.c) piglit_add_executable (arb_texture_buffer_object-minmax minmax.c) piglit_add_executable (arb_texture_buffer_object-negative-bad-bo negative-bad-bo.c) piglit_add_executable (arb_texture_buffer_object-negative-bad-format negative-bad-format.c) diff --git a/tests/spec/arb_texture_buffer_object/get.c b/tests/spec/arb_texture_buffer_object/get.c new file mode 100644 index 000000000..86de2bc61 --- /dev/null +++ b/tests/spec/arb_texture_buffer_object/get.c @@ -0,0 +1,87 @@ +/* + * 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 get.c + * + * Tests glGetIntegerv queries not covered by other tests. + */ + +int piglit_width = 32; +int piglit_height = 32; +int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA; + +enum piglit_result +piglit_display(void) +{ + /* UNREACHED */ + return PIGLIT_FAIL; +} + +static bool +_expect(int line, GLenum token, GLint val) +{ + GLint ret = 0xd0d0d0d0; + + glGetIntegerv(token, &ret); + if (ret != val) { + fprintf(stderr, + "line %d: %s was %d, expected %d\n", + line, + piglit_get_gl_enum_name(token), ret, val); + return false; + } + + return true; +} +#define expect(token, val) _expect(__LINE__, token, val) + +void +piglit_init(int argc, char **argv) +{ + bool pass = true; + GLuint tex, bo; + + piglit_require_gl_version(20); + piglit_require_extension("GL_ARB_texture_buffer_object"); + + glGenTextures(1, &tex); + glGenBuffers(1, &bo); + + pass = expect(GL_TEXTURE_BINDING_BUFFER, 0) && pass; + glBindTexture(GL_TEXTURE_BUFFER, tex); + pass = expect(GL_TEXTURE_BINDING_BUFFER, tex) && pass; + + pass = expect(GL_TEXTURE_BUFFER, 0) && pass; + glBindBuffer(GL_TEXTURE_BUFFER, bo); + pass = expect(GL_TEXTURE_BUFFER, bo) && pass; + + pass = expect(GL_TEXTURE_BUFFER_FORMAT, GL_LUMINANCE8) && pass; + glTexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA8, 0); + pass = expect(GL_TEXTURE_BUFFER_FORMAT, GL_RGBA8) && pass; + + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); +} + |