summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-02-06 14:18:54 -0800
committerEric Anholt <eric@anholt.net>2013-02-06 14:18:54 -0800
commit30258ba71c6e16d1889edf787eb990278022e5e5 (patch)
treee3ed64f6fcfb3d2626dcd06d5f824120792db8dc
parent2b33656226d4780e496166f87c3de30f072b4ee3 (diff)
WIP test for bug 49779lineloop-many
-rw-r--r--tests/spec/gl-1.0/CMakeLists.gl.txt1
-rw-r--r--tests/spec/gl-1.0/beginend-lineloop-many.c94
2 files changed, 95 insertions, 0 deletions
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt b/tests/spec/gl-1.0/CMakeLists.gl.txt
index 2f819fa84..cb425ed4f 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -10,6 +10,7 @@ link_libraries (
)
piglit_add_executable (gl-1.0-beginend-coverage beginend-coverage.c)
+piglit_add_executable (gl-1.0-beginend-lineloop-many beginend-lineloop-many.c)
piglit_add_executable (gl-1.0-edgeflag edgeflag.c)
piglit_add_executable (gl-1.0-edgeflag-quads edgeflag-quads.c)
diff --git a/tests/spec/gl-1.0/beginend-lineloop-many.c b/tests/spec/gl-1.0/beginend-lineloop-many.c
new file mode 100644
index 000000000..2c4bd5dc2
--- /dev/null
+++ b/tests/spec/gl-1.0/beginend-lineloop-many.c
@@ -0,0 +1,94 @@
+/* Copyright © 2013 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.
+ */
+
+/** @file beginend-lineloop-many.c
+ *
+ * Test that lineloops within a glBegin()/glEnd() block don't get
+ * incorrectly split by buffering in the driver.
+ */
+
+#include "piglit-util-gl-common.h"
+#include "minmax-test.h"
+
+#define SQUARE_SIZE 5
+#define SQUARES 100
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 10;
+
+ config.window_width = SQUARE_SIZE * SQUARES;
+ config.window_height = SQUARE_SIZE * SQUARES;
+
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display()
+{
+ bool pass = true;
+ const float bg[4] = {0, 0, 0, 0};
+ const float fg[4] = {1, 1, 1, 0};
+ float x, y;
+
+ piglit_ortho_projection(piglit_width, piglit_height, false);
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glColor4fv(fg);
+
+ for (x = 0; x < SQUARES * SQUARE_SIZE; x += SQUARE_SIZE) {
+ for (y = 0; y < SQUARES * SQUARE_SIZE; y += SQUARE_SIZE) {
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(x + 1.5, y + 1.5);
+ glVertex2f(x + 3.5, y + 1.5);
+
+ /* Spam in an extra vert so that we probably
+ * have a prim spanning whatever buffer size.
+ */
+ if (x == 0 && y == 0)
+ glVertex2f(x + 3.5, y + 1.5);
+
+ glVertex2f(x + 3.5, y + 3.5);
+ glVertex2f(x + 1.5, y + 3.5);
+ glEnd();
+ }
+ }
+
+
+ for (x = 0; x < SQUARES * SQUARE_SIZE; x += SQUARE_SIZE) {
+ for (y = 0; y < SQUARES * SQUARE_SIZE; y += SQUARE_SIZE) {
+ pass = pass && piglit_probe_pixel_rgba(x+2, y+2, bg);
+ }
+ }
+
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+}