diff options
author | Rob Clark <[email protected]> | 2015-08-10 06:58:37 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-08-12 18:37:43 -0400 |
commit | 81d2fd91a90e5b2fd9fd74792a7a7c329f0e4d29 (patch) | |
tree | 6938dcf429a3bdcb5f36752d83fdd4540b1d789f /src/mesa/main/readpix.c | |
parent | 078aef0e97bf7e0cc8fae4d541d5035ff6c29ad7 (diff) |
mesa: add NV_read_{depth,stencil,depth_stencil} extensions
These extensions allow reading depth/stencil for GLES contexts, which is
useful for tools like apitrace.
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/readpix.c')
-rw-r--r-- | src/mesa/main/readpix.c | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index 2744232f906..d826ecfc3d5 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -916,10 +916,8 @@ read_pixels_es3_error_check(GLenum format, GLenum type, const GLenum data_type = _mesa_get_format_datatype(rb->Format); GLboolean is_unsigned_int = GL_FALSE; GLboolean is_signed_int = GL_FALSE; - - if (!_mesa_is_color_format(internalFormat)) { - return GL_INVALID_OPERATION; - } + GLboolean is_float_depth = (internalFormat == GL_DEPTH_COMPONENT32F) || + (internalFormat == GL_DEPTH32F_STENCIL8); is_unsigned_int = _mesa_is_enum_format_unsigned_int(internalFormat); if (!is_unsigned_int) { @@ -950,6 +948,43 @@ read_pixels_es3_error_check(GLenum format, GLenum type, (is_unsigned_int && type == GL_UNSIGNED_INT)) return GL_NO_ERROR; break; + case GL_DEPTH_STENCIL: + switch (type) { + case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + if (is_float_depth) + return GL_NO_ERROR; + break; + case GL_UNSIGNED_INT_24_8: + if (!is_float_depth) + return GL_NO_ERROR; + break; + default: + return GL_INVALID_ENUM; + } + break; + case GL_DEPTH_COMPONENT: + switch (type) { + case GL_FLOAT: + if (is_float_depth) + return GL_NO_ERROR; + break; + case GL_UNSIGNED_SHORT: + case GL_UNSIGNED_INT_24_8: + if (!is_float_depth) + return GL_NO_ERROR; + break; + default: + return GL_INVALID_ENUM; + } + break; + case GL_STENCIL_INDEX: + switch (type) { + case GL_UNSIGNED_BYTE: + return GL_NO_ERROR; + default: + return GL_INVALID_ENUM; + } + break; } return GL_INVALID_OPERATION; @@ -1023,11 +1058,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height, err = read_pixels_es3_error_check(format, type, rb); } - if (err == GL_NO_ERROR && (format == GL_DEPTH_COMPONENT - || format == GL_DEPTH_STENCIL)) { - err = GL_INVALID_ENUM; - } - if (err != GL_NO_ERROR) { _mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)", _mesa_enum_to_string(format), |