diff options
-rw-r--r-- | tests/spec/arb_direct_state_access/getcompressedtextureimage.c | 23 |
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 84aa30bf3..786d2fc02 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); |