summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2009-02-14 20:43:09 +0100
committerNicolai Haehnle <nhaehnle@gmail.com>2009-02-14 20:43:09 +0100
commit047697a835e67ccbbd6aa5713dd8ff013303443c (patch)
tree06053baa25c0231b2538416ff156aeb31c934966
parent4876e3d39781cd8f5dda24055e54fe0a41e657e6 (diff)
New test: crash-cubemap-order
Regression test for a particular crash of the r300+bufmgr driver, triggered by Sauerbraten. The crash occured when an application uploads cubemaps in a non-canonical order. Signed-off-by: Nicolai Haehnle <nhaehnle@gmail.com>
-rw-r--r--tests/all.tests1
-rw-r--r--tests/bugs/CMakeLists.txt1
-rw-r--r--tests/bugs/crash-cubemap-order.c64
3 files changed, 66 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests
index ab79b4cfb..1b047b6e8 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -78,6 +78,7 @@ fpgeneric['lrp_sat'] = make_fpgeneric('lrp_sat.fp')
shaders['fp-generic'] = fpgeneric
bugs = Group()
+bugs['crash-cubemap-order'] = PlainExecTest([testBinDir + 'crash-cubemap-order'])
bugs['crash-texparameter-before-teximage'] = PlainExecTest([testBinDir + 'crash-texparameter-before-teximage', '-auto'])
bugs['fdo9833'] = PlainExecTest([testBinDir + 'fdo9833', '-auto'])
bugs['fdo10370'] = PlainExecTest([testBinDir + 'fdo10370', '-auto'])
diff --git a/tests/bugs/CMakeLists.txt b/tests/bugs/CMakeLists.txt
index 6ba057104..af09df09c 100644
--- a/tests/bugs/CMakeLists.txt
+++ b/tests/bugs/CMakeLists.txt
@@ -19,6 +19,7 @@ link_libraries (
${TIFF_LIBRARY}
)
+add_executable (crash-cubemap-order crash-cubemap-order.c)
add_executable (crash-texparameter-before-teximage crash-texparameter-before-teximage.c)
add_executable (fdo9833 fdo9833.c)
add_executable (fdo10370 fdo10370.c)
diff --git a/tests/bugs/crash-cubemap-order.c b/tests/bugs/crash-cubemap-order.c
new file mode 100644
index 000000000..c42a2ff25
--- /dev/null
+++ b/tests/bugs/crash-cubemap-order.c
@@ -0,0 +1,64 @@
+/**
+ * @file crash-cubemap-order.c
+ *
+ * Test case for "crash if cubemap faces are loaded in an unusual order".
+ *
+ * This bug existed in the R300 driver and was triggered by Sauerbraten.
+ */
+
+#include "GL/glut.h"
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "piglit-util.h"
+
+
+static int Width = 100, Height = 100;
+
+static void Display(void)
+{
+ piglit_report_result(PIGLIT_SUCCESS);
+}
+
+static void init()
+{
+ GLubyte data[4096]; /* 32*32*4 */
+
+ memset(data, 0, sizeof(data));
+
+ glViewport(0, 0, Width, Height);
+
+ glBindTexture(GL_TEXTURE_CUBE_MAP, 1);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
+
+ glBindTexture(GL_TEXTURE_CUBE_MAP, 2);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+}
+
+
+int main(int argc, char**argv)
+{
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
+ glutInitWindowSize(Width, Height);
+ glutCreateWindow(argv[0]);
+ glutDisplayFunc(Display);
+ init();
+ glutMainLoop();
+ return 0;
+}
+