aboutsummaryrefslogtreecommitdiff
path: root/tests/texturing
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-09-06 17:06:30 -0600
committerBrian Paul <brianp@vmware.com>2012-09-11 08:23:19 -0600
commit29488b7ad052985f5b8bd9ef2ec8aba05e454f99 (patch)
tree00a8e88b76040e22820a68d96747fded57fb7815 /tests/texturing
parentfc19d53b52110329343ca989092d66e8fd6ab768 (diff)
max-texture-size-level: don't try to create maxSize x maxSize textures
We might not have enough memory for a texture that large. Use width or height = 1 instead. Reviewed-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'tests/texturing')
-rw-r--r--tests/texturing/max-texture-size-level.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/tests/texturing/max-texture-size-level.c b/tests/texturing/max-texture-size-level.c
index 390e8622..3b064827 100644
--- a/tests/texturing/max-texture-size-level.c
+++ b/tests/texturing/max-texture-size-level.c
@@ -61,25 +61,47 @@ piglit_init(int argc, char **argv)
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
- /* The max texture size should be OK for mipmap level zero. */
+ /*
+ * Note: we don't try to create any maxSize by maxSize textures
+ * since we may not have enough texture memory.
+ */
+
+ /*
+ * For level 0, maxSize by 1 (and vice-versa) should be OK.
+ */
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
- maxSize, maxSize, 0,
+ maxSize, 1, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
pass = piglit_check_gl_error(GL_NO_ERROR);
- /* Setting the level 1 image to the max texture size should be
- * an error.
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
+ 1, maxSize, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+ /*
+ * For level 1, maxSize by 1 (and vice versa) should fail.
*/
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA,
- maxSize, maxSize, 0,
+ maxSize, 1, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) & pass;
+
+ glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA,
+ 1, maxSize, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) & pass;
+
+ /*
+ * For level 2, maxSize/2 by 1 (and vice versa) should fail.
+ */
+ glTexImage2D(GL_TEXTURE_2D, 2, GL_RGBA,
+ maxSize/2, 1, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
pass = piglit_check_gl_error(GL_INVALID_VALUE) & pass;
- /* Setting the level 2 image to half the max texture size should be
- * an error also.
- */
glTexImage2D(GL_TEXTURE_2D, 2, GL_RGBA,
- maxSize/2, maxSize/2, 0,
+ 1, maxSize/2, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
pass = piglit_check_gl_error(GL_INVALID_VALUE) & pass;