[Piglit] [PATCH] tests/texturing/cubemap: Add a "npot" command line option.
Ian Romanick
idr at freedesktop.org
Tue Aug 2 18:44:39 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/30/2011 03:32 PM, Kenneth Graunke wrote:
> This tests a 50x50 base level size instead of 64x64. Exposes a bug in
> the i965 driver.
Shouldn't this new variation be added to all.tests?
> ---
> tests/texturing/cubemap.c | 24 ++++++++++++++----------
> 1 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/tests/texturing/cubemap.c b/tests/texturing/cubemap.c
> index 57cfcea..07d55ff 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,11 @@ piglit_display(void)
> void
> piglit_init(int argc, char **argv)
> {
> + if (argc == 2 && strcmp(argv[1], "npot") == 0) {
> + piglit_require_extension("GL_ARB_texture_non_power_of_two");
> + max_size = 50;
> + } else {
> + max_size = 64;
> + }
> piglit_require_extension("GL_ARB_texture_cube_map");
This check should probably be first. On an implementation that doesn't
support either extension, you really want the log message about
texture_cube_map.
> }
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk44qAcACgkQX1gOwKyEAw9KkwCdEn9Uigim4Hgt+zZ4OFB+O06z
pXwAnAvz7J94gkGkYmoeJ4ZKV1nJ/5TY
=Dj4E
-----END PGP SIGNATURE-----
More information about the Piglit
mailing list