summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Ekstrand <laura@jlekstrand.net>2015-01-06 15:28:43 -0800
committerLaura Ekstrand <laura@jlekstrand.net>2015-03-09 16:20:43 -0700
commitcc5b2a8bae47ff862a0a1e96628107d4b15da93a (patch)
tree54fea2f483751d2f9aae7c4d01bf3089506bfd9d
parent1d634ace8f50ab44c618a629eb2551ba25171800 (diff)
arb_direct_state_access: getcompressedtextureimage now has distinct layers.
-rw-r--r--tests/spec/arb_direct_state_access/getcompressedtextureimage.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/spec/arb_direct_state_access/getcompressedtextureimage.c b/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
index 7a58491a5..b62ff7ebd 100644
--- a/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
+++ b/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
@@ -93,17 +93,29 @@ show_image(GLubyte *data, int num_layers, const char *title)
static GLubyte *
make_layer_data(int num_layers)
{
- int z;
+ int x, y, z;
GLubyte *layer_data =
malloc(num_layers * IMAGE_SIZE * sizeof(GLubyte));
- GLubyte *data = piglit_rgbw_image_ubyte(IMAGE_WIDTH,
- IMAGE_HEIGHT, true);
+ int num_channels = IMAGE_SIZE/(IMAGE_WIDTH * IMAGE_HEIGHT);
for (z = 0; z < num_layers; z++) {
+ /* Get some data, but make sure the faces are different */
+ GLubyte *data = piglit_rgbw_image_ubyte(IMAGE_WIDTH,
+ IMAGE_HEIGHT, true);
+ for (y = 0; y < IMAGE_HEIGHT; ++y) {
+ for (x = 0; x < IMAGE_WIDTH; ++x) {
+ int idx = num_channels*(IMAGE_WIDTH*y + x);
+ data[idx+0] *= ((float) (z + 1)/ (float) num_layers);
+ data[idx+1] *= ((float) (z + 1)/ (float) num_layers);
+ data[idx+2] *= ((float) (z + 1)/ (float) num_layers);
+ }
+ }
+
+ /* Copy in the data */
memcpy(layer_data + IMAGE_SIZE * z, data, IMAGE_SIZE);
- }
- free(data);
+ free(data);
+ }
/* Show the first layer of the completed layer data. */
show_image(layer_data, num_layers, "Test Data");
@@ -179,7 +191,6 @@ getTexImage(bool doPBO, GLenum target, GLubyte *data,
break;
case GL_TEXTURE_2D_ARRAY:
- num_layers = 7; /* Fall through. */
case GL_TEXTURE_CUBE_MAP_ARRAY:
num_layers = 6 * 3;
glCreateTextures(target, 1, &name);