2 * Copyright (c) 2011 VMware, Inc.
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
25 * Test related to fd.o bug 31590 involving glEvalCoord inside a display list
26 * when running the glut molehill test.
27 * The mesa-demos redbook/bezcurve.c test (when hacked to use a display list)
28 * also demonstrated the problem. This program is based on the later program.
30 * We test for two things:
31 * 1. an unexpected GL_INVALID_OPERATION error
32 * 2. a segfault/crash during display list compilation
36 #include "piglit-util-gl.h"
38 static const char *TestName
= "dlist-fdo31590";
40 PIGLIT_GL_TEST_CONFIG_BEGIN
42 config
.supports_gl_compat_version
= 10;
44 config
.window_width
= 500;
45 config
.window_height
= 500;
46 config
.window_visual
= PIGLIT_GL_VISUAL_RGB
| PIGLIT_GL_VISUAL_DOUBLE
;
48 PIGLIT_GL_TEST_CONFIG_END
50 static const GLfloat ctrlpoints
[4][3] = {
51 { -4.0, -4.0, 0.0}, { -2.0, 4.0, 0.0},
52 {2.0, -4.0, 0.0}, {4.0, 4.0, 0.0}
61 glNewList(5, GL_COMPILE
);
62 glBegin(GL_LINE_STRIP
);
64 for (i
= 0; i
<= 30; i
++) {
65 glEvalCoord1f((GLfloat
) i
/30.0);
70 glClear(GL_COLOR_BUFFER_BIT
);
71 glColor3f(1.0, 1.0, 1.0);
76 /* As above, but with a glColor() call in the display list.
77 * This caused a segfault in Mesa.
84 glNewList(5, GL_COMPILE
);
85 glBegin(GL_LINE_STRIP
);
86 glColor3f(1,1,0); /* <<<<< this is the only difference */
87 for (i
= 0; i
<= 30; i
++) {
88 glEvalCoord1f((GLfloat
) i
/30.0);
93 glClear(GL_COLOR_BUFFER_BIT
);
94 glColor3f(1.0, 1.0, 1.0);
102 glMap1f(GL_MAP1_VERTEX_3
, 0.0, 1.0, 3, 4, &ctrlpoints
[0][0]);
103 glEnable(GL_MAP1_VERTEX_3
);
106 /* The following code displays the control points as dots. */
108 glColor3f(1.0, 1.0, 0.0);
110 for (i
= 0; i
< 4; i
++)
111 glVertex3fv(&ctrlpoints
[i
][0]);
117 if (glGetError() != GL_NO_ERROR
) {
118 printf("%s: test1 generated an unexpected error\n", TestName
);
124 if (glGetError() != GL_NO_ERROR
) {
125 printf("%s: test2 generated an unexpected error\n", TestName
);
129 piglit_present_results();
136 piglit_init(int argc
, char **argv
)
138 glMatrixMode(GL_PROJECTION
);
140 glOrtho(-5.0, 5.0, -5.0, 5.0, -5.0, 5.0);
141 glMatrixMode(GL_MODELVIEW
);