2 * Copyright © 2009 Nicolai Hähnle
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * @file cubemap-unusual-order.c
27 * Test case for "crash if cubemap faces are loaded in an unusual order".
29 * This bug existed in the R300 driver and was triggered by Sauerbraten.
32 #include "piglit-util-gl.h"
34 PIGLIT_GL_TEST_CONFIG_BEGIN
36 config
.supports_gl_compat_version
= 10;
38 config
.window_visual
= PIGLIT_GL_VISUAL_DOUBLE
| PIGLIT_GL_VISUAL_RGB
;
39 config
.khr_no_error_support
= PIGLIT_NO_ERRORS
;
41 PIGLIT_GL_TEST_CONFIG_END
50 piglit_init(int argc
, char **argv
)
52 GLubyte data
[4096]; /* 32*32*4 */
54 piglit_require_extension("GL_ARB_texture_cube_map");
56 memset(data
, 0, sizeof(data
));
58 glViewport(0, 0, piglit_width
, piglit_height
);
60 glBindTexture(GL_TEXTURE_CUBE_MAP
, 1);
61 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X
, 0, GL_RGBA
, 32, 32, 0,
62 GL_RGBA
, GL_UNSIGNED_BYTE
, data
);
63 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
, 0, GL_RGBA
, 32, 32, 0,
64 GL_RGBA
, GL_UNSIGNED_BYTE
, data
);
65 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
, 0, GL_RGBA
, 32, 32, 0,
66 GL_RGBA
, GL_UNSIGNED_BYTE
, data
);
67 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z
, 0, GL_RGBA
, 32, 32, 0,
68 GL_RGBA
, GL_UNSIGNED_BYTE
, data
);
69 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y
, 0, GL_RGBA
, 32, 32, 0,
70 GL_RGBA
, GL_UNSIGNED_BYTE
, data
);
71 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X
, 0, GL_RGBA
, 32, 32, 0,
72 GL_RGBA
, GL_UNSIGNED_BYTE
, data
);
74 glBindTexture(GL_TEXTURE_CUBE_MAP
, 2);
75 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X
, 0, GL_RGBA
, 32, 32, 0,
76 GL_RGBA
, GL_UNSIGNED_BYTE
, 0);
77 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
, 0, GL_RGBA
, 32, 32, 0,
78 GL_RGBA
, GL_UNSIGNED_BYTE
, 0);
79 glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
, 0, GL_RGBA
, 32, 32, 0,
80 GL_RGBA
, GL_UNSIGNED_BYTE
, 0);
81 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z
, 0, GL_RGBA
, 32, 32, 0,
82 GL_RGBA
, GL_UNSIGNED_BYTE
, 0);
83 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y
, 0, GL_RGBA
, 32, 32, 0,
84 GL_RGBA
, GL_UNSIGNED_BYTE
, 0);
85 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X
, 0, GL_RGBA
, 32, 32, 0,
86 GL_RGBA
, GL_UNSIGNED_BYTE
, 0);