ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / ext_framebuffer_object / border-texture-finish.c
blob0cbf7c7d97f63133f53005fdb7c791d99f581ad5
1 /*
2 * Copyright © 2009 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
23 * Authors:
24 * Ian Romanick <ian.d.romanick@intel.com>
28 /**
29 * \file border-texture-finish.c
30 * Test case from fd.o bug #20701
32 * Configure an FBO for rendering to a color texture with border. Call
33 * glFinish while that FBO is bound. If it doesn't segfault, then the test
34 * passes.
37 #include "piglit-util-gl.h"
39 PIGLIT_GL_TEST_CONFIG_BEGIN
41 config.supports_gl_compat_version = 10;
43 config.window_visual = PIGLIT_GL_VISUAL_RGB;
44 config.khr_no_error_support = PIGLIT_NO_ERRORS;
46 PIGLIT_GL_TEST_CONFIG_END
48 static GLuint fb;
49 static GLuint tex;
51 enum piglit_result
52 piglit_display(void)
54 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
55 glClearColor(1.0, 0.0, 0.0, 1.0);
57 glClear(GL_COLOR_BUFFER_BIT);
58 glFinish();
60 // If the test doesn't crash, then it passes.
61 return PIGLIT_PASS;
65 void
66 piglit_init(int argc, char**argv)
68 GLenum status;
70 piglit_require_extension("GL_EXT_framebuffer_object");
72 glGenFramebuffersEXT(1, &fb);
73 glGenTextures(1, &tex);
75 glBindTexture(GL_TEXTURE_2D, tex);
76 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 66, 66, 1, GL_RGBA,
77 GL_UNSIGNED_BYTE, NULL);
78 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
80 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
81 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
82 GL_COLOR_ATTACHMENT0_EXT,
83 GL_TEXTURE_2D, tex, 0);
85 status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
86 if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
87 printf("%s:%u: framebuffer status = 0x%04x\n",
88 __FUNCTION__, __LINE__, status);
89 if (status == GL_FRAMEBUFFER_UNSUPPORTED_EXT)
90 piglit_report_result(PIGLIT_PASS);
91 else
92 piglit_report_result(PIGLIT_FAIL);