[Piglit] Spec justification for test_illegal_begin_mode?
Ian Romanick
idr at freedesktop.org
Thu Nov 26 03:13:46 UTC 2020
I was looking at the dlist-beginend subtest test_illegal_begin_mode.
The test compiles a display list with GL_COMPILE_AND_EXECUTE mode. The
glBegin in the test uses an invalid mode. This should generate a
GL_INVALID_OPERATION error immediately. The test checks this, and that
seems correct.
The test then tries to execute the display list and checks for
GL_INVALID_OPERATION again. I believe this is incorrect. Section 5.4
("Display Lists") of the OpenGL 1.0 spec (this is a gl-1.0 test, after
all!) says:
If mode is COMPILE_AND_EXECUTE then commands are executed as they
are encountered, then placed in the display list.
Section 2.5 ("GL Errors") of the OpenGL 1.0 spec says:
In other cases, the command generating the error is ignored so that
it has no effect on GL state or framebuffer contents.
While the section numbers and titles have changed, every later version
of the GL (compatibility profile) spec says the exact same thing.
To me, this indicates that the errant glBegin should not be included in
the display list. Assuming this test passes on other implementations, I
think it does so only by luck. The mis-matched glEnd in the display
list will generate the same error. Am I missing some spec language to
justify this test?
I noticed this because I was adding a test that does
glNewList(list, GL_COMPILE_AND_EXECUTE);
glColor4fv(green);
glBegin(GL_QUADS);
glBegin(GL_QUADS);
glVertex2f(-1, -1);
glVertex2f( 1, -1);
glVertex2f( 1, 0);
glVertex2f(-1, 0);
glEnd();
glEndList();
I expected an error while compiling the list, but I expected glCallList
to not generate an error. Errors are generated in both places.
I think it gets worse. There's a second part to this new subtest that
replaces the errant glBegin call with glReadPixels. glReadPixels is not
allowed between glBegin and glEnd, so it should generate an error in
GL_COMPILE_AND_EXECUTE mode. It does not.
These changes are in the top commit of:
https://gitlab.freedesktop.org/idr/piglit/-/commits/display-list-hell
I don't have any systems currently available with closed-source drivers,
but I would be very interested to see the results of
gl-1.0-dlist-beginend from that branch on any closed source drivers (on
any platform).
More information about the Piglit
mailing list