summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2011-07-30 15:29:10 -0700
committerKenneth Graunke <kenneth@whitecape.org>2011-07-31 15:19:59 -0700
commit8100e93191b61d55a0cc29325f7552b6073b94b1 (patch)
treef44ee912ce74d7d4e8c9565eb06a8bc38e5fbbe1 /tests
parent7fb5b0759e5d29030fdfcb7684a9661b13948991 (diff)
tests/texturing/cubemap: Add a "npot" command line option.
This tests a 50x50 base level size instead of 64x64. Exposes a bug in the i965 driver. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/all.tests1
-rw-r--r--tests/texturing/cubemap.c29
2 files changed, 20 insertions, 10 deletions
diff --git a/tests/all.tests b/tests/all.tests
index 306ae7ed..bac5b22a 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -572,6 +572,7 @@ add_plain_test(texturing, 'copytexsubimage')
add_plain_test(texturing, 'copyteximage')
add_plain_test(texturing, 'copyteximage-clipping')
add_plain_test(texturing, 'cubemap')
+texturing['cubemap npot'] = PlainExecTest(['cubemap', '-auto', 'npot'])
add_plain_test(texturing, 'depth-level-clamp')
add_plain_test(texturing, 'depth-tex-modes')
add_plain_test(texturing, 'depth-tex-modes-glsl')
diff --git a/tests/texturing/cubemap.c b/tests/texturing/cubemap.c
index 57cfcea3..80eae314 100644
--- a/tests/texturing/cubemap.c
+++ b/tests/texturing/cubemap.c
@@ -27,15 +27,13 @@
#include "piglit-util.h"
-#define MAX_SIZE 64
#define PAD 5
-#define WIN_WIDTH ((MAX_SIZE * 6 + PAD * 9) * 2)
-#define WIN_HEIGHT 400
-
int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB;
-int piglit_width = WIN_WIDTH;
-int piglit_height = WIN_HEIGHT;
+int piglit_width = (64 * 6 + PAD * 9) * 2;
+int piglit_height = 400;
+
+int max_size;
static GLfloat colors[][3] = {
{1.0, 1.0, 1.0},
@@ -188,7 +186,7 @@ draw_at_size(int size, int x_offset, int y_offset, GLboolean mipmapped)
GLfloat row_x = PAD + x_offset;
for (face = 0; face < 6; face++) {
- GLfloat base_x = row_x + face * (MAX_SIZE + PAD);
+ GLfloat base_x = row_x + face * (max_size + PAD);
GLfloat base_y = row_y;
glBegin(GL_QUADS);
@@ -248,7 +246,7 @@ piglit_display(void)
* single texture level.
*/
y_offset = 0;
- for (dim = MAX_SIZE; dim > 0; dim /= 2) {
+ for (dim = max_size; dim > 0; dim /= 2) {
pass = draw_at_size(dim, 0, y_offset, GL_FALSE) && pass;
y_offset += dim + PAD;
}
@@ -257,8 +255,8 @@ piglit_display(void)
* to 1x1.
*/
y_offset = 0;
- for (dim = MAX_SIZE; dim > 0; dim /= 2) {
- int x_offset = (i % 2 == 1) ? 0 : WIN_WIDTH / 2;
+ for (dim = max_size; dim > 0; dim /= 2) {
+ int x_offset = (i % 2 == 1) ? 0 : piglit_width / 2;
row_dim = (row_dim < dim) ? dim : row_dim;
@@ -278,5 +276,16 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
+ int i;
+
+ max_size = 64;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "npot") == 0) {
+ piglit_require_extension("GL_ARB_texture_non_power_of_two");
+ max_size = 50;
+ break;
+ }
+ }
piglit_require_extension("GL_ARB_texture_cube_map");
}