OSDN Git Service

readpix: allow implementation format/type
authorJordan Justen <jordan.l.justen@intel.com>
Sat, 12 Jan 2013 09:05:44 +0000 (01:05 -0800)
committerMatt Turner <mattst88@gmail.com>
Mon, 21 Jan 2013 03:54:38 +0000 (19:54 -0800)
For GLES2/3 allow reading of pixels with format/type based on:
 * GL_IMPLEMENTATION_COLOR_READ_FORMAT
 * GL_IMPLEMENTATION_COLOR_READ_TYPE

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/main/readpix.c

index 994e589..6b07563 100644 (file)
@@ -773,7 +773,12 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
     * combination is, and Mesa can handle anything valid.  Just work instead.
     */
    if (_mesa_is_gles(ctx)) {
-      if (ctx->Version < 30) {
+      if (ctx->API == API_OPENGLES2 &&
+          _mesa_is_color_format(format) &&
+          _mesa_get_color_read_format(ctx) == format &&
+          _mesa_get_color_read_type(ctx) == type) {
+         err = GL_NO_ERROR;
+      } else if (ctx->Version < 30) {
          err = _mesa_es_error_check_format_and_type(format, type, 2);
          if (err == GL_NO_ERROR) {
             if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {