test-gles2-context: Read pixels using GL_RGBA not GL_RGB

The GLES2 spec only guarantees calling glReadPixels with GL_RGBA and
an implementation specific format. Mesa seems to now reject reading
with GL_RGB so the test had started failing. This fixes it to just
read using GL_RGBA.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 745cbcbdee0f5b4df4c6a735b03709248a551884)
This commit is contained in:
Neil Roberts 2013-02-06 12:59:58 +00:00
parent d6dacf2f65
commit 0494e70955

View File

@ -277,7 +277,7 @@ test_gles2_read_pixels (void)
CoglGLES2Context *gles2_ctx; CoglGLES2Context *gles2_ctx;
const CoglGLES2Vtable *gles2; const CoglGLES2Vtable *gles2;
CoglError *error = NULL; CoglError *error = NULL;
GLubyte pixel[3]; GLubyte pixel[4];
GLuint fbo_handle; GLuint fbo_handle;
create_gles2_context (&offscreen_texture, create_gles2_context (&offscreen_texture,
@ -299,7 +299,7 @@ test_gles2_read_pixels (void)
gles2->glClearColor (1, 0, 0, 1); gles2->glClearColor (1, 0, 0, 1);
gles2->glClear (GL_COLOR_BUFFER_BIT); gles2->glClear (GL_COLOR_BUFFER_BIT);
gles2->glReadPixels (0, 0, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixel); gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
test_utils_compare_pixel (pixel, 0xff0000ff); test_utils_compare_pixel (pixel, 0xff0000ff);
@ -309,7 +309,7 @@ test_gles2_read_pixels (void)
gles2->glClearColor (0, 1, 0, 1); gles2->glClearColor (0, 1, 0, 1);
gles2->glClear (GL_COLOR_BUFFER_BIT); gles2->glClear (GL_COLOR_BUFFER_BIT);
gles2->glReadPixels (0, 0, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixel); gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
test_utils_compare_pixel (pixel, 0x00ff00ff); test_utils_compare_pixel (pixel, 0x00ff00ff);
@ -317,7 +317,7 @@ test_gles2_read_pixels (void)
gles2->glClearColor (0, 1, 1, 1); gles2->glClearColor (0, 1, 1, 1);
gles2->glClear (GL_COLOR_BUFFER_BIT); gles2->glClear (GL_COLOR_BUFFER_BIT);
gles2->glReadPixels (0, 0, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixel); gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
test_utils_compare_pixel (pixel, 0x00ffffff); test_utils_compare_pixel (pixel, 0x00ffffff);
@ -335,7 +335,7 @@ test_gles2_read_pixels (void)
g_error ("Failed to push gles2 context: %s\n", error->message); g_error ("Failed to push gles2 context: %s\n", error->message);
} }
gles2->glReadPixels (0, 0, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixel); gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
test_utils_compare_pixel (pixel, 0x00ffffff); test_utils_compare_pixel (pixel, 0x00ffffff);
@ -355,7 +355,7 @@ test_gles2_read_pixels (void)
g_error ("Failed to push gles2 context: %s\n", error->message); g_error ("Failed to push gles2 context: %s\n", error->message);
} }
gles2->glReadPixels (0, 0, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixel); gles2->glReadPixels (0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
test_utils_compare_pixel (pixel, 0xffffffff); test_utils_compare_pixel (pixel, 0xffffffff);