summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/texturing/texsubimage.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/tests/texturing/texsubimage.c b/tests/texturing/texsubimage.c
index 2f10e3d47..630bce733 100644
--- a/tests/texturing/texsubimage.c
+++ b/tests/texturing/texsubimage.c
@@ -96,8 +96,8 @@ static const struct test_desc texsubimage_test_sets[] = {
/* Default texture size. Other values might be used if the texture has
* less dimensions or other restrictions */
-#define DEFAULT_TEX_WIDTH 128
-#define DEFAULT_TEX_HEIGHT 64
+#define DEFAULT_TEX_WIDTH 32
+#define DEFAULT_TEX_HEIGHT 32
#define DEFAULT_TEX_DEPTH 8
/* List of texture targets to test, terminated by GL_NONE */
@@ -407,6 +407,7 @@ test_format(GLenum target, GLenum intFormat)
GLuint h = DEFAULT_TEX_HEIGHT;
GLuint d = DEFAULT_TEX_DEPTH;
GLuint tex, i, j, k, n, t;
+ GLubyte *original_img_2;
GLubyte *original_img, *original_ref;
GLubyte *updated_img, *updated_ref;
GLubyte *testImg;
@@ -436,6 +437,7 @@ test_format(GLenum target, GLenum intFormat)
updated_img = (GLubyte *) malloc(w * h * d * 4);
updated_ref = (GLubyte *) malloc(w * h * d * 4);
testImg = (GLubyte *) malloc(w * h * d * 4);
+ original_img_2 = (GLubyte *) malloc(w * h * d * 4);
/* fill source tex images */
n = 0;
@@ -447,6 +449,11 @@ test_format(GLenum target, GLenum intFormat)
original_img[n + 2] = i * 128 / d;
original_img[n + 3] = 255;
+ original_img_2[n + 0] = j * 5;
+ original_img_2[n + 1] = k * 3;
+ original_img_2[n + 2] = i * 128 / d;
+ original_img_2[n + 3] = 255;
+
/* Swizzle the components in the
* updated image
*/
@@ -480,14 +487,16 @@ test_format(GLenum target, GLenum intFormat)
draw_and_read_texture(w, h, d, original_ref);
glDeleteTextures(1, &tex);
+#if 0
/* draw updated reference image */
tex = create_texture(target, intFormat, w, h, d,
srcFormat, updated_img);
glClear(GL_COLOR_BUFFER_BIT);
draw_and_read_texture(w, h, d, updated_ref);
glDeleteTextures(1, &tex);
+#endif
- for (t = 0; t < 10; t++) {
+ for (t = 0; t < 2; t++) {
/* Choose random region of texture to update.
* Use sizes and positions that are multiples of
* the compressed block size.
@@ -496,22 +505,23 @@ test_format(GLenum target, GLenum intFormat)
GLint tw = (rand() % w) & wMask;
GLint th = (rand() % h) & hMask;
#else
- GLint tw = 81;
- GLint th = 59;
+ GLint tw = 81 - 64;
+ GLint th = 59 - 32;
#endif
GLint td = (rand() % d) & dMask;
#if 0
GLint tx = (rand() % (w - tw)) & wMask;
GLint ty = (rand() % (h - th)) & hMask;
#else
- GLint tx = 46;
+ GLint tx = 46 - 32;
GLint ty = 4;
#endif
GLint tz = (rand() % (d - td)) & dMask;
/* Recreate the original texture */
tex = create_texture(target, intFormat, w, h, d,
- srcFormat, original_img);
+ srcFormat,
+ i == 0 ? original_img : original_img_2);
assert(tx + tw <= w);
assert(ty + th <= h);
@@ -524,6 +534,8 @@ test_format(GLenum target, GLenum intFormat)
glPixelStorei(GL_UNPACK_SKIP_PIXELS, tx);
glPixelStorei(GL_UNPACK_SKIP_ROWS, ty);
glPixelStorei(GL_UNPACK_SKIP_IMAGES, tz);
+
+ printf("using z = %u\n", tz);
if (d > 1) {
glTexSubImage3D(target, 0, tx, ty, tz, tw, th, td,
srcFormat, GL_UNSIGNED_BYTE,
@@ -551,7 +563,8 @@ test_format(GLenum target, GLenum intFormat)
piglit_present_results();
if (!equal_images(target,
- original_ref, updated_ref, testImg,
+ i == 0 ? original_img : original_img_2,
+ updated_ref, testImg,
w, h, d,
tx, ty, tz, tw, th, td)) {
printf("texsubimage failed on round %d\n", t);