summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/all.tests1
-rw-r--r--tests/bugs/CMakeLists.txt1
-rw-r--r--tests/bugs/r200-swtnl-material-fallback.c79
3 files changed, 81 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests
index 478f51bc..6ea733cc 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -246,6 +246,7 @@ add_plain_test(bugs, 'fdo10370')
add_plain_test(bugs, 'fdo14575')
add_plain_test(bugs, 'fdo20701')
add_plain_test(bugs, 'r300-readcache')
+add_plain_test(bugs, 'r200-swtnl-material-fallback')
add_plain_test(bugs, 'tex1d-2dborder')
add_plain_test(bugs, 'point-sprite')
add_plain_test(bugs, 'fdo22540')
diff --git a/tests/bugs/CMakeLists.txt b/tests/bugs/CMakeLists.txt
index 3a72a961..de5ac5d8 100644
--- a/tests/bugs/CMakeLists.txt
+++ b/tests/bugs/CMakeLists.txt
@@ -35,3 +35,4 @@ add_executable (fdo23670-depth_test fdo23670-depth_test.c)
add_executable (fdo23670-drawpix_stencil fdo23670-drawpix_stencil.c)
add_executable (fdo24066 fdo24066.c)
add_executable (fdo25614-genmipmap fdo25614-genmipmap.c)
+add_executable (r200-swtnl-material-fallback r200-swtnl-material-fallback.c)
diff --git a/tests/bugs/r200-swtnl-material-fallback.c b/tests/bugs/r200-swtnl-material-fallback.c
new file mode 100644
index 00000000..4cc22d82
--- /dev/null
+++ b/tests/bugs/r200-swtnl-material-fallback.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright © 2010 Pauli Nieminen
+ *
+ * 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.
+ */
+
+/**
+ * Check that r200 swtnl fallback return doesn't emit hwtnl state.
+ *
+ * \author Pauli Nieminen
+ */
+
+
+#include "piglit-util.h"
+
+int piglit_width = 100;
+int piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ static GLfloat excepted[][3] = {
+ {0.2,0.0,0.0},
+ {0.2,0.2,0.2},
+ };
+ static GLfloat mat[][4] = {
+ {1.0,0.0,0.0,0.0},
+ {1.0,1.0,1.0,0.0},
+ };
+
+ GLboolean pass = GL_TRUE;
+ glClear(GL_COLOR_BUFFER_BIT);
+ glEnable(GL_LIGHTING);
+
+ glBegin(GL_TRIANGLE_STRIP);
+
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat[0]);
+ glVertex3f((GLfloat)piglit_height, 0.0, 0.0);
+ glVertex3f(0.0, 0.0, 0.0);
+ glVertex3f((GLfloat)piglit_height, (GLfloat)piglit_width, 0.0);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat[1]);
+ glVertex3f(0.0, (GLfloat) piglit_width, 0.0);
+
+ glEnd();
+
+ if (!piglit_probe_pixel_rgb(piglit_width - 1, 1, excepted[0]))
+ pass = GL_FALSE;
+ if (!piglit_probe_pixel_rgb(1, piglit_height - 1, excepted[1]))
+ pass = GL_FALSE;
+
+ glutSwapBuffers();
+
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
+}