Summary: | Display lists cause GL_INVALID_OPERATION when glGetError() called if GL_COMPILE_AND_EXECUTE used with large lists | ||
---|---|---|---|
Product: | Mesa | Reporter: | Robert Ancell <robert.ancell> |
Component: | Mesa core | Assignee: | mesa-dev |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | high | ||
Version: | 6.4 | ||
Hardware: | x86 (IA32) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Robert Ancell
2006-08-24 09:29:52 UTC
Here is a full Glut program that causes the bug for me: #include <stdlib.h> #include <stdio.h> #include <GL/gl.h> #include <GL/glut.h> // Compile with: gcc -g -Wall -lGL -lglut broken.c -o broken static void renderScene(void) { glClear(GL_COLOR_BUFFER_BIT); glNewList(4, GL_COMPILE_AND_EXECUTE); // Must be GL_COMPILE_AND_EXECUTE glBegin(GL_TRIANGLES); for(i = 0; i < 1000; i++) // Must be large to occur in one frame { glVertex3f(-0.8, -0.8, 1.0); glVertex3f(0.8, -0.8, 1.0); glVertex3f(0.0, 0.8, 1.0); } glGetError(); // Removing this removes the bug glEnd(); glEndList(); printf("OpenGL error = %i\n", glGetError()); glFlush(); } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA); glutInitWindowPosition(100,100); glutInitWindowSize(320,320); glutCreateWindow("Mesa bug?"); glutDisplayFunc(renderScene); glutMainLoop(); return 1; } It's illegal to call glGetError() between glBegin/glEnd, even if you're compiling a display list. 'man glGetError' and see ERRORS section near end. Good point, however: The behaviour is not consistent. If you set the loop to 1 then the GL_INVALID_OPERATION is not generated. I made a mistake in the example; if you change it to: static void renderScene(void) { int i; glClear(GL_COLOR_BUFFER_BIT); glNewList(4, GL_COMPILE_AND_EXECUTE); // Must be GL_COMPILE_AND_EXECUTE glBegin(GL_TRIANGLES); for(i = 0; i < 1000; i++) // Must be large to occur in one frame { glVertex3f(-0.8, -0.8, 1.0); glVertex3f(0.8, -0.8, 1.0); glVertex3f(0.0, 0.8, 1.0); } glEnd(); glGetError(); // Removing this removes the bug glEndList(); printf("OpenGL error = %i\n", glGetError()); glFlush(); } The error should not be generated but it does. This is what causes the Python bindings to fail as glGetError() is called before all calls to glEndList(). The OpenGL man pages and spec seem to indicate this should be valid behaviour. I have run both these examples using MESA_DEBUG=1 and it matches the behaviour I am getting from glGetError(). i.e. displays "Mesa: User error: GL_INVALID_OPERATION in begin/end" if there is a glGetError() called inside a glNewList/glEndList AND the loop is 1000 or more (independant of if the glGetError() is in/outside the glBegin/glEnd pair). OK, I found the problem and checked in the fix. Thanks, could you point at the files changed? Mesa/src/mesa/tnl/t_save_api.c |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.