Commit 047697a8 authored by Nicolai Hähnle's avatar Nicolai Hähnle
Browse files

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 Hähnle's avatarNicolai Haehnle <nhaehnle@gmail.com>
parent 4876e3d3
......@@ -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'])
......
......@@ -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)
......
/**
* @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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment