<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Unify the format conversion code"
href="https://bugs.freedesktop.org/show_bug.cgi?id=84566#c35">Comment # 35</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Unify the format conversion code"
href="https://bugs.freedesktop.org/show_bug.cgi?id=84566">bug 84566</a>
from <span class="vcard"><a class="email" href="mailto:itoral@igalia.com" title="Iago Toral <itoral@igalia.com>"> <span class="fn">Iago Toral</span></a>
</span></b>
<pre>Jason, you wrote some fast paths in _mesa_format_convert for the cases where we
can directly pack or unpack to the destination format. In these paths, if we
have to pack from or unpack to RGBA8888 UINT, you have asserts to make sure
that we are packing to or unpacking from an integer type. Likewise, if we are
packing from or unpacking to RGBA8888 UBYTE, you added asserts to make sure
that we are packing to or unpacking from a non-integer type.
I am not sure why these were added, but I think we should remove them since
there are valid conversions that will hit these paths. For example,
glReadPixels where we want to store the pixel data in GL_RGBA/GL_UNSIGNED_INT.
In this case, the destination format matches one of these fast path (RGBA UINT)
but the source format, which is the render buffer's format, is
MESA_FORMAT_B8G8R8A8_UNORM which is not integer.
I think we have at least two options:
1) Transform the asserts into conditionals. With these we make sure that these
fast paths are only used when the assertions you have are not violated, but we
still let _mesa_format_convert use the non-fast paths to resolve the conversion
in the cases that would hit the assertions. If there was a good reason for
these assertions to exist then I guess this is the way to go.
2) We simply remove the asserts. I think pack/unpack functions can deal with
any format type, right? At the moment uint pack/unpack functions seem to be an
exception since they only support packing to and unpacking from integer types,
but since these functions are auto-generated it seems we could just let them
handle other types too. Since in this case we would enable the fast path, it
would be the most efficient solution.
What do you think?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>