Demonstrates an i965 bug, which wined3d hits in many apps. V2: Fix comment describing vertex layout V3: Simplify -- the vertex layout actually doesn't matter; the i965 bug is entirely in the SF setup.
Signed-off-by: Chris Forbes <chr...@ijw.co.nz> --- tests/all.py | 1 + tests/spec/gl-2.0/CMakeLists.gl.txt | 1 + tests/spec/gl-2.0/pointsprite-non-points.c | 106 +++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 tests/spec/gl-2.0/pointsprite-non-points.c diff --git a/tests/all.py b/tests/all.py index b3417a9..f199582 100644 --- a/tests/all.py +++ b/tests/all.py @@ -864,6 +864,7 @@ add_concurrent_test(gl20, 'attribs') add_concurrent_test(gl20, 'gl-2.0-edgeflag') add_concurrent_test(gl20, 'gl-2.0-edgeflag-immediate') add_concurrent_test(gl20, 'gl-2.0-vertexattribpointer') +add_concurrent_test(gl20, 'gl-2.0-pointsprite-non-points') add_plain_test(gl20, 'attrib-assignments') add_plain_test(gl20, 'getattriblocation-conventional') add_plain_test(gl20, 'clip-flag-behavior') diff --git a/tests/spec/gl-2.0/CMakeLists.gl.txt b/tests/spec/gl-2.0/CMakeLists.gl.txt index 3ac0d68..a06bb8a 100644 --- a/tests/spec/gl-2.0/CMakeLists.gl.txt +++ b/tests/spec/gl-2.0/CMakeLists.gl.txt @@ -14,3 +14,4 @@ piglit_add_executable (vertex-program-two-side vertex-program-two-side.c) piglit_add_executable (gl-2.0-edgeflag edgeflag.c) piglit_add_executable (gl-2.0-edgeflag-immediate edgeflag-immediate.c) piglit_add_executable (gl-2.0-vertexattribpointer vertexattribpointer.c) +piglit_add_executable (gl-2.0-pointsprite-non-points pointsprite-non-points.c) diff --git a/tests/spec/gl-2.0/pointsprite-non-points.c b/tests/spec/gl-2.0/pointsprite-non-points.c new file mode 100644 index 0000000..1827059 --- /dev/null +++ b/tests/spec/gl-2.0/pointsprite-non-points.c @@ -0,0 +1,106 @@ +/* + * Copyright 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * With point sprites enabled, and texcoord replacement enabled for + * the first set of texcoords, test DrawArrays with the following + * varying layout: + * - position + * - constant zero color + * - texcoord + * + * This demonstrates a bug in i965, which is hit by wined3d in many + * apps. To exercise this case, it is important that the texcoord + * not be in the first non-position varying slot. + */ + + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + config.supports_gl_compat_version = 20; + config.window_visual = (PIGLIT_GL_VISUAL_RGBA | + PIGLIT_GL_VISUAL_DOUBLE); +PIGLIT_GL_TEST_CONFIG_END + + +static const char *vs_text = + "void main() {\n" + " gl_Position = gl_Vertex;\n" + " gl_FrontColor = vec4(1, 0, 0, 0);\n" + " gl_TexCoord[0] = vec4(0, 1, 0, 0);\n" + "}\n"; +static const char *fs_text = + "void main() { \n" + " gl_FragColor = gl_Color.yxyy + gl_TexCoord[0];\n" + "}\n"; + +static GLuint program; + +GLuint vbo; +float verts[] = { + -1, -1, 0, 0, + 1, -1, 1, 0, + 1, 1, 1, 1, + -1, 1, 0, 1 +}; + +enum piglit_result +piglit_display(void) +{ + const float green[] = {0, 1, 0}; + bool pass = true; + + glViewport(0, 0, piglit_width, piglit_height); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, green); + + piglit_present_results(); + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + + +void +piglit_init(int argc, char **argv) +{ + piglit_require_GLSL(); + + program = piglit_build_simple_program(vs_text, fs_text); + glUseProgram(program); + + glClearColor(0.25f, 0.25f, 0.25f, 1.0f); + + glGenBuffers(1, &vbo); + glBindBuffer(GL_ARRAY_BUFFER, vbo); + glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STREAM_DRAW); + glVertexPointer(2, GL_FLOAT, 16, (GLvoid *)0); + glEnableClientState(GL_VERTEX_ARRAY); + glEnable(GL_POINT_SPRITE); + + glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE); +} + -- 2.1.3 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit