<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 17, 2015 at 3:28 AM, Tapani Pälli <span dir="ltr"><<a href="mailto:tapani.palli@intel.com" target="_blank">tapani.palli@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>OpenGL ES 3.0 spec 3.7.2 "Transfer of Pixel Rectangles" specifies<br>
DEPTH_COMPONENT, UNSIGNED_INT as a valid couple, validation for<br>
internal format is checked by is_float_depth().<br>
<br>
</span>Fix regression caused by 81d2fd91a90e5b2fd9fd74792a7a7c329f0e4d29 in:<br>
<span> ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels<br>
<br>
Test uses GL_DEPTH_COMPONENT, UNSIGNED_INT only when GL_NV_read_depth<br>
extension is present.<br>
<br>
</span>v2: change check in _mesa_error_check_format_and_type to be explicit<br>
for ES 2.0+, desktop OpenGL does not allow this behaviour + uses<br>
this function for both glReadPixels and glDrawPixels validation.<br>
(No Piglit regressions seen with v2.)<br>
<span><br>
Signed-off-by: Tapani Pälli <<a href="mailto:tapani.palli@intel.com" target="_blank">tapani.palli@intel.com</a>><br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=92009" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=92009</a><br>
</span>Cc: "10.7 11.0" <<a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.org</a>><br>
---<br>
src/mesa/main/glformats.c | 7 ++++++-<br>
src/mesa/main/readpix.c | 1 +<br>
2 files changed, 7 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c<br>
index c1d3c7d..eb4a02a 100644<br>
<span>--- a/src/mesa/main/glformats.c<br>
+++ b/src/mesa/main/glformats.c<br>
@@ -494,7 +494,8 @@ _mesa_bytes_per_pixel(GLenum format, GLenum type)<br>
else<br>
return -1;<br>
case GL_UNSIGNED_INT_24_8_EXT:<br>
- if (format == GL_DEPTH_STENCIL_EXT)<br>
+ if (format == GL_DEPTH_COMPONENT ||<br>
+ format == GL_DEPTH_STENCIL_EXT)<br>
return sizeof(GLuint);<br>
else<br>
return -1;<br>
</span>@@ -1789,6 +1790,10 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,<br>
return GL_INVALID_OPERATION;<br>
<br>
case GL_UNSIGNED_INT_24_8:<br>
+ /* Depth buffer OK to read in OpenGL ES (NV_read_depth). */<br>
+ if (ctx->API == API_OPENGLES2 && format == GL_DEPTH_COMPONENT)<br>
+ return GL_NO_ERROR;<br>
+<br></blockquote><div>Verified that NV_read_depth extension is an OpenGL ES extension and allows</div><div>GL_DEPTH_COMPONENT format in ReadPixels.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
if (format != GL_DEPTH_STENCIL) {<br>
return GL_INVALID_OPERATION;<br>
<div><div> }<br>
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c<br>
index 76ef8ee..81bb912 100644<br>
--- a/src/mesa/main/readpix.c<br>
+++ b/src/mesa/main/readpix.c<br>
@@ -963,6 +963,7 @@ read_pixels_es3_error_check(GLenum format, GLenum type,<br>
return GL_NO_ERROR;<br>
break;<br>
case GL_UNSIGNED_SHORT:<br>
+ case GL_UNSIGNED_INT:<br>
case GL_UNSIGNED_INT_24_8:<br>
if (!is_float_depth)<br>
return GL_NO_ERROR;<br>
--<br>
2.4.3<br>
<br>
</div></div></blockquote></div><br></div><div class="gmail_extra">Nice catch before merging. Updated patch is:</div><div class="gmail_extra">Reviewed-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br></div></div>