<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 20, 2014 at 12:29 AM, Iago Toral <span dir="ltr"><<a href="mailto:itoral@igalia.com" target="_blank">itoral@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It is explained here:<br>
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=84566#c35" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=84566#c35</a><br>
<br>
So one example of this was a glReadPixels where we want to store the<br>
pixel data as RGBA UINT, but the render buffer format we read from is<br>
MESA_FORMAT_B8G8R8A8_UNORM. There are piglit tests that hit this case.<br></blockquote><div><br></div><div>I'm still not seeing how this is allowed. From the 4.2 core spec:<br><br>"If format is one of RED , GREEN , BLUE , RG , RGB , RGBA , BGR , or BGRA , then<br>red, green, blue, and alpha values are obtained from the selected buffer at each<br>pixel location.<br>If format is an integer format and the color buffer is not an integer format, or<br>if the color buffer is an integer format and format is not an integer format, an<br>INVALID_OPERATION error is generated."<br><br></div><div>I also checked the 3.3 compatibility spec and it says the same thing. This seems to indicate that that combination should result in GL_INVALID_OPERATION.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class=""><font color="#888888"><br>
Iago<br>
</font></span><div class=""><div class="h5"><br>
On Wed, 2014-11-19 at 12:04 -0800, Jason Ekstrand wrote:<br>
> Can you remind me again as to what formats hit these paths? I<br>
> remember you hitting them, but I'm still not really seeing how it<br>
> happens.<br>
><br>
> --Jason<br>
><br>
><br>
> On Tue, Nov 18, 2014 at 1:23 AM, Iago Toral Quiroga<br>
> <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> wrote:<br>
> We can have conversions from non-integer types to integer<br>
> types, so remove<br>
> the assertions for these in the pack/unpack fast paths. It<br>
> could be that<br>
> we do not have all the necessary pack/unpack functions in<br>
> these cases though,<br>
> so protect these paths with conditionals and let<br>
> _mesa_format_convert use<br>
> other paths to resolve these kind of conversions if necessary.<br>
> ---<br>
> src/mesa/main/format_utils.c | 16 ++++++++--------<br>
> 1 file changed, 8 insertions(+), 8 deletions(-)<br>
><br>
> diff --git a/src/mesa/main/format_utils.c<br>
> b/src/mesa/main/format_utils.c<br>
> index 1d65f2b..56a3b8d 100644<br>
> --- a/src/mesa/main/format_utils.c<br>
> +++ b/src/mesa/main/format_utils.c<br>
> @@ -143,8 +143,8 @@ _mesa_format_convert(void *void_dst,<br>
> uint32_t dst_format, size_t dst_stride,<br>
> dst += dst_stride;<br>
> }<br>
> return;<br>
> - } else if (dst_array_format.as_uint ==<br>
> RGBA8888_UBYTE.as_uint) {<br>
> - assert(!_mesa_is_format_integer_color(src_format));<br>
> + } else if (dst_array_format.as_uint ==<br>
> RGBA8888_UBYTE.as_uint &&<br>
> + !_mesa_is_format_integer_color(src_format))<br>
> {<br>
> for (row = 0; row < height; ++row) {<br>
> _mesa_unpack_ubyte_rgba_row(src_format, width,<br>
> src, (uint8_t<br>
> (*)[4])dst);<br>
> @@ -152,8 +152,8 @@ _mesa_format_convert(void *void_dst,<br>
> uint32_t dst_format, size_t dst_stride,<br>
> dst += dst_stride;<br>
> }<br>
> return;<br>
> - } else if (dst_array_format.as_uint ==<br>
> RGBA8888_UINT.as_uint) {<br>
> - assert(_mesa_is_format_integer_color(src_format));<br>
> + } else if (dst_array_format.as_uint ==<br>
> RGBA8888_UINT.as_uint &&<br>
> + _mesa_is_format_integer_color(src_format)) {<br>
> for (row = 0; row < height; ++row) {<br>
> _mesa_unpack_uint_rgba_row(src_format, width,<br>
> src, (uint32_t<br>
> (*)[4])dst);<br>
> @@ -174,8 +174,8 @@ _mesa_format_convert(void *void_dst,<br>
> uint32_t dst_format, size_t dst_stride,<br>
> dst += dst_stride;<br>
> }<br>
> return;<br>
> - } else if (src_array_format.as_uint ==<br>
> RGBA8888_UBYTE.as_uint) {<br>
> - assert(!_mesa_is_format_integer_color(dst_format));<br>
> + } else if (src_array_format.as_uint ==<br>
> RGBA8888_UBYTE.as_uint &&<br>
> + !_mesa_is_format_integer_color(dst_format))<br>
> {<br>
> for (row = 0; row < height; ++row) {<br>
> _mesa_pack_ubyte_rgba_row(dst_format, width,<br>
> (const uint8_t<br>
> (*)[4])src, dst);<br>
> @@ -183,8 +183,8 @@ _mesa_format_convert(void *void_dst,<br>
> uint32_t dst_format, size_t dst_stride,<br>
> dst += dst_stride;<br>
> }<br>
> return;<br>
> - } else if (src_array_format.as_uint ==<br>
> RGBA8888_UINT.as_uint) {<br>
> - assert(_mesa_is_format_integer_color(dst_format));<br>
> + } else if (src_array_format.as_uint ==<br>
> RGBA8888_UINT.as_uint &&<br>
> + _mesa_is_format_integer_color(dst_format)) {<br>
> for (row = 0; row < height; ++row) {<br>
> _mesa_pack_uint_rgba_row(dst_format, width,<br>
> (const uint32_t<br>
> (*)[4])src, dst);<br>
> --<br>
> 1.9.1<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
><br>
><br>
<br>
<br>
</div></div></blockquote></div><br></div></div>