This tests correct rendering of polygons using antialised GL_LINE mode for one face and GL_FILL for the other one. On some Intel hardware at least this used to require special handling that has caused regressions in the past.
The test checks that the GL_FILL face of the polygon renders properly. --- tests/bugs/CMakeLists.gl.txt | 1 + tests/bugs/polygon-line-aa.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 tests/bugs/polygon-line-aa.c diff --git a/tests/bugs/CMakeLists.gl.txt b/tests/bugs/CMakeLists.gl.txt index e24ec6b..fd71c0f 100644 --- a/tests/bugs/CMakeLists.gl.txt +++ b/tests/bugs/CMakeLists.gl.txt @@ -30,5 +30,6 @@ piglit_add_executable (fdo28551 fdo28551.c) piglit_add_executable (fdo31934 fdo31934.c) piglit_add_executable (tri-tex-crash tri-tex-crash.c) piglit_add_executable (vbo-buffer-unmap vbo-buffer-unmap.c) +piglit_add_executable (polygon-aa polygon-line-aa.c) # vim: ft=cmake: diff --git a/tests/bugs/polygon-line-aa.c b/tests/bugs/polygon-line-aa.c new file mode 100644 index 0000000..3aef97c --- /dev/null +++ b/tests/bugs/polygon-line-aa.c @@ -0,0 +1,70 @@ +/* + * Test case for a special case of line antialiasing + * https://bugs.freedesktop.org/show_bug.cgi?id=78679 + * + * This test renders a polygon using GL_LINE mode (with antialised lines) + * for one face of the polygon, and GL_FILL for the other face. For gen < 6 + * intel hardware this setup requires special handling that if not done + * correctly produces incorrect rendering of the GL_FILL face. This caused + * regressions in the past. + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.window_width = 100; + config.window_height = 100; + config.window_visual = PIGLIT_GL_VISUAL_RGBA; + +PIGLIT_GL_TEST_CONFIG_END + +void +piglit_init(int argc, char **argv) +{ + /* This enables the case we want to test for */ + glEnable(GL_LINE_SMOOTH); + glShadeModel(GL_SMOOTH); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + glLineWidth(1.5); + glEnable(GL_BLEND); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glPolygonMode(GL_BACK, GL_LINE); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); + + glClearColor(1, 1, 1, 1); +} + +enum piglit_result +piglit_display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, piglit_width, piglit_height); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glColor4f(0.0f, 0.0f, 1.0f, 1.0); + glBegin(GL_QUADS); + glVertex2f(-1.0f, -1.0f); + glVertex2f( 1.0f, -1.0f); + glVertex2f( 1.0f, 1.0f); + glVertex2f(-1.0f, 1.0f); + glEnd(); + + glFlush(); + + /* The test checks that the fill face of the quad is all blue without + * noise artifacts + */ + GLfloat expected[4] = { 0.0, 0.0, 1.0, 1.0 }; + if (piglit_probe_rect_rgba(0, 0, 100, 100, expected)) + return PIGLIT_PASS; + else + return PIGLIT_FAIL; +} -- 1.9.1 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
