summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Ekstrand <laura@jlekstrand.net>2015-01-07 17:04:26 -0800
committerLaura Ekstrand <laura@jlekstrand.net>2015-04-02 17:57:41 -0700
commit504f7fdf3f2c43df968b060bd523e01fcd3c0941 (patch)
tree0b15c6bd2343b83f1360fade3b37d5427f4d708a
parent0692dc6589a455c48b00877db26dfd1700e20e10 (diff)
arb_direct_state_access: gettextureimage-targets.c has display.
-rw-r--r--tests/spec/arb_direct_state_access/gettextureimage-targets.c65
1 files changed, 63 insertions, 2 deletions
diff --git a/tests/spec/arb_direct_state_access/gettextureimage-targets.c b/tests/spec/arb_direct_state_access/gettextureimage-targets.c
index 7f5c51e03..73b4e5586 100644
--- a/tests/spec/arb_direct_state_access/gettextureimage-targets.c
+++ b/tests/spec/arb_direct_state_access/gettextureimage-targets.c
@@ -33,6 +33,7 @@
PIGLIT_GL_TEST_CONFIG_BEGIN
+ config.window_width = 216;
config.supports_gl_compat_version = 10;
config.window_visual = PIGLIT_GL_VISUAL_RGBA |
@@ -43,6 +44,52 @@ PIGLIT_GL_TEST_CONFIG_END
#define IMAGE_WIDTH 32
#define IMAGE_HEIGHT 32
#define IMAGE_SIZE (IMAGE_WIDTH * IMAGE_HEIGHT * 4)
+#define DISPLAY_GAP 4
+
+static void
+show_image(GLubyte *data, int num_layers, const char *title)
+{
+ GLuint name;
+ int i;
+ char junk[50];
+
+ if (!piglit_automatic) {
+ /* Create the texture handle. */
+ glCreateTextures(GL_TEXTURE_2D, 1, &name);
+ glTextureStorage2D(name, 1, GL_RGBA8, IMAGE_WIDTH,
+ IMAGE_HEIGHT);
+ glTextureParameteri(name, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTextureParameteri(name, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glEnable(GL_TEXTURE_2D);
+ glBindTextureUnit(0, name);
+
+ /* Draw the layers, separated by some space */
+ glClear(GL_COLOR_BUFFER_BIT);
+ for (i = 0; i < num_layers; ++i) {
+ int x = (IMAGE_WIDTH + DISPLAY_GAP) * (i % 6);
+ int y = (IMAGE_HEIGHT + DISPLAY_GAP) * (i / 6);
+ glTextureSubImage2D(name, 0, 0, 0,
+ IMAGE_WIDTH, IMAGE_HEIGHT,
+ GL_RGBA, GL_UNSIGNED_BYTE,
+ data + i * IMAGE_SIZE);
+ piglit_draw_rect_tex(x, y, IMAGE_WIDTH, IMAGE_HEIGHT,
+ 0, 0, 1, 1);
+ }
+
+ /* Make the title. */
+ printf("****** %s ******\n", title);
+
+ piglit_present_results();
+
+ /* Pause. */
+ printf("Enter any char to continue.\n>>>>>>");
+ scanf("%s", junk);
+ printf("\n");
+
+ glDeleteTextures(1, &name);
+ }
+}
+
static void
init_layer_data(GLubyte *layer_data, int num_layers)
@@ -56,8 +103,8 @@ init_layer_data(GLubyte *layer_data, int num_layers)
for (y = 0; y < IMAGE_HEIGHT; y += 4) {
int r = (x + 1) * 255 / (IMAGE_WIDTH - 1);
int g = (y + 1) * 255 / (IMAGE_HEIGHT - 1);
- int b = (z + 1) * 255 / (num_layers - 1);
- int a = x ^ y ^ z;
+ int b = (z + 1) * 255 / (num_layers);
+ int a = 255; //x ^ y ^ z;
/* each 4x4 block constains only one color (for S3TC) */
for (i = 0; i < 4; i++) {
@@ -75,6 +122,10 @@ init_layer_data(GLubyte *layer_data, int num_layers)
}
}
}
+
+ /* Show the first layer of the completed layer data. */
+ show_image(layer_data, num_layers, "Test Data");
+
}
static bool
@@ -177,6 +228,10 @@ getTexImage(bool doPBO, GLenum target, GLubyte data[][IMAGE_SIZE],
}
+ /* Show the initial data. */
+ show_image(data[0], num_layers * num_faces, "Data Before Upload");
+
+
/* Setup the PBO or data array to read into from glGetTextureImage */
if (doPBO) {
glGenBuffers(1, &packPBO);
@@ -210,6 +265,9 @@ getTexImage(bool doPBO, GLenum target, GLubyte data[][IMAGE_SIZE],
else
dataGet = data2[0];
+ /* Examine the image after pulling it off the graphics card. */
+ show_image(dataGet, num_layers * num_faces, "Data After Download");
+
for (i = 0; i < num_faces * num_layers; i++) {
pass = compare_layer(i, layer_size, tolerance, dataGet,
data[i]) && pass;
@@ -271,6 +329,9 @@ piglit_init(int argc, char **argv)
}
if (!piglit_is_extension_supported("GL_ARB_texture_cube_map_array"))
clear_target_mask(GL_TEXTURE_CUBE_MAP_ARRAY);
+
+ glClearColor(0.5, 0.5, 0.5, 1);
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
enum piglit_result