[Mesa-dev] [Bug 84566] Unify the format conversion code

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Oct 23 00:57:31 PDT 2014


--- Comment #35 from Iago Toral <itoral at igalia.com> ---
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?

You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141023/5128f40c/attachment.html>

More information about the mesa-dev mailing list