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

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Oct 21 19:25:58 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=84566

--- Comment #34 from Jason Ekstrand <jason at jlekstrand.net> ---
(In reply to Samuel Iglesias from comment #33)
> Jason, I would like to know your opinion about the integer RGBA clamping
> done in pack.c (_mesa_pack_rgba_span_from_ints()).
> 
> glReadPixels() and glGetTexImage() specs said (for example, in OpenGL 3.3.
> core specification) that for an integer RGBA color, each component is
> clamped to the representable range of type.
> 
> Those GL functions end up calling pack.c's functions for performing the
> conversion (mesa_pack_rgba_span_from_ints() and others).
> 
> It's possible to replace some of those pack.c's conversion functions by the
> master conversion but the problem is in the clamping operation. I would like
> to add a boolean argument called "clamp" to the master conversion function
> which is passed to _mesa_swizzle_and_convert() where each of its
> convert_{uint,int,byte,ubyte,short,ushort}() do the right thing when "clamp"
> is true.
> 
> This "clamp" parameter would be false for every call to either master
> conversion function or _mesa_swizzle_and_convert() except when they are
> being called from pack.c.
> 
> What do you think?

Supporting clamping is probably fine.  I think we determined we needed a clamp
parameter anyway for some of the float conversions.  I guess it makes sense for
integers too.  Let's watch out for performance when we implement it though. 
Changing the loop inside mesa_swizzle_and_convert without hurting performance
can be tricky.  The teximage-colors test in Piglit has a -benchmark flag that
can be used for testing that.

-- 
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/20141022/0ae13cd9/attachment.html>


More information about the mesa-dev mailing list