diff options
-rw-r--r-- | tests/egl/egl-gl_oes_egl_image.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/egl/egl-gl_oes_egl_image.c b/tests/egl/egl-gl_oes_egl_image.c index 30a5001cd..1490d92b3 100644 --- a/tests/egl/egl-gl_oes_egl_image.c +++ b/tests/egl/egl-gl_oes_egl_image.c @@ -92,13 +92,38 @@ piglit_init(int argc, char **argv) glGenTextures(1, &texture_a); glBindTexture(GL_TEXTURE_2D, texture_a); + unsigned char *data_a = malloc (256 * 256 * 4); + unsigned char *p = data_a; + for (unsigned y = 0; y < 256; y++) { + for (unsigned x = 0; x < 256; x++, p += 4) { + p[0] = 255; + p[1] = 0; + p[2] = 0; + p[3] = 255; + } + } + + unsigned char *data_b = malloc (128 * 128 * 4); + p = data_b; + for (unsigned y = 0; y < 128; y++) { + for (unsigned x = 0; x < 128; x++, p += 4) { + p[0] = 0; + p[1] = 255; + p[2] = 0; + p[3] = 255; + } + } + /* Setup 2 miplevels, and max level. */ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, - GL_UNSIGNED_BYTE, NULL); + GL_UNSIGNED_BYTE, data_a); glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 128, 128, 0, GL_RGBA, - GL_UNSIGNED_BYTE, NULL); + GL_UNSIGNED_BYTE, data_b); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1); + free(data_a); + free(data_b); + if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); @@ -142,6 +167,9 @@ piglit_init(int argc, char **argv) piglit_report_result(PIGLIT_FAIL); } + const float expected[] = { 0.0, 1.0, 0.0, 1.0 }; + piglit_probe_texel_rect_rgba(GL_TEXTURE_2D, 0, 0, 0, w, h, expected); + glDeleteTextures(1, &texture_a); glDeleteTextures(1, &texture_b); peglDestroyImageKHR(dpy, egl_image); |