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
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
24 * Ian Romanick <ian.d.romanick@intel.com>
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
37 #include "piglit-util.h"
39 static int Automatic
= 0;
40 static int Width
= 128, Height
= 128;
44 static void Display(void)
46 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT
, fb
);
47 glClearColor(1.0, 0.0, 0.0, 1.0);
49 glClear(GL_COLOR_BUFFER_BIT
);
53 printf("PIGLIT: {'result': 'pass' }\n");
59 static void Reshape(int width
, int height
)
66 static void Key(unsigned char key
, int x
, int y
)
86 piglit_require_extension("GL_EXT_framebuffer_object");
88 glGenFramebuffersEXT(1, &fb
);
89 glGenTextures(1, &tex
);
91 glBindTexture(GL_TEXTURE_2D
, tex
);
92 glTexImage2D(GL_TEXTURE_2D
, 0, GL_RGBA
, 66, 66, 1, GL_RGBA
,
93 GL_UNSIGNED_BYTE
, NULL
);
94 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_NEAREST
);
96 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT
, fb
);
97 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT
,
98 GL_COLOR_ATTACHMENT0_EXT
,
99 GL_TEXTURE_2D
, tex
, 0);
101 status
= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT
);
102 if (status
!= GL_FRAMEBUFFER_COMPLETE_EXT
) {
103 printf("%s:%u: framebuffer status = 0x%04x\n",
104 __FUNCTION__
, __LINE__
, status
);
105 printf("PIGLIT: {'result': 'fail' }\n");
111 int main(int argc
, char**argv
)
113 glutInit(&argc
, argv
);
114 if (argc
== 2 && !strcmp(argv
[1], "-auto"))
116 glutInitDisplayMode(GLUT_RGB
);
117 glutInitWindowSize(Width
, Height
);
118 glutCreateWindow("FD.O bug #20701 test");
119 glutReshapeFunc(Reshape
);
120 glutKeyboardFunc(Key
);
121 glutDisplayFunc(Display
);
123 printf("If the test doesn't crash, then it passes.\n");