diff options
-rw-r--r-- | tests/all.tests | 1 | ||||
-rw-r--r-- | tests/bugs/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/bugs/crash-cubemap-order.c | 64 |
3 files changed, 66 insertions, 0 deletions
diff --git a/tests/all.tests b/tests/all.tests index ab79b4cf..1b047b6e 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 6ba05710..af09df09 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 00000000..c42a2ff2 --- /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; +} + |