summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTopi Pohjolainen <topi.pohjolainen@intel.com>2015-10-26 14:31:03 +0200
committerTopi Pohjolainen <topi.pohjolainen@intel.com>2015-10-26 14:31:03 +0200
commitcd641f59bc5ffde9863b8dc1c684e152790f60d1 (patch)
tree2b32cc00d4c23d2856532cb8011c4fa555e9f6d2
parent9c40614826cf9ecdc0b15c3bfaa9eeb69cb82fea (diff)
Reject invalid dimensions
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
-rw-r--r--tests/texturing/texsubimage.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/texturing/texsubimage.c b/tests/texturing/texsubimage.c
index 5d38736da..bb2f2ab50 100644
--- a/tests/texturing/texsubimage.c
+++ b/tests/texturing/texsubimage.c
@@ -482,16 +482,23 @@ test_format(GLenum target, GLenum intFormat)
glDeleteTextures(1, &tex);
for (t = 0; t < 10; t++) {
+ GLint tw = 0;
+ GLint th = 0;
+ GLint td = 0;
+ GLint tx, ty, tz;
+
/* Choose random region of texture to update.
* Use sizes and positions that are multiples of
* the compressed block size.
*/
- GLint tw = (rand() % w) & wMask;
- GLint th = (rand() % h) & hMask;
- GLint td = (rand() % d) & dMask;
- GLint tx = (rand() % (w - tw)) & wMask;
- GLint ty = (rand() % (h - th)) & hMask;
- GLint tz = (rand() % (d - td)) & dMask;
+ while (!tw || (h > 1 && !th) || (d > 1 && !td)) {
+ tw = (rand() % w) & wMask;
+ th = (rand() % h) & hMask;
+ td = (rand() % d) & dMask;
+ tx = (rand() % (w - tw)) & wMask;
+ ty = (rand() % (h - th)) & hMask;
+ tz = (rand() % (d - td)) & dMask;
+ }
/* Recreate the original texture */
tex = create_texture(target, intFormat, w, h, d,