[Mesa-dev] [PATCH 14/20] mesa: Add non-normalized formats support for ubyte packing functions

Jason Ekstrand jason at jlekstrand.net
Tue Nov 18 11:08:42 PST 2014


On Tue, Nov 18, 2014 at 12:44 AM, Iago Toral Quiroga <itoral at igalia.com>
wrote:

> From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
>
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> ---
>  src/mesa/main/format_pack.c.mako | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/format_pack.c.mako
> b/src/mesa/main/format_pack.c.mako
> index b9f4656..97adf6e 100644
> --- a/src/mesa/main/format_pack.c.mako
> +++ b/src/mesa/main/format_pack.c.mako
> @@ -84,7 +84,15 @@ pack_ubyte_${f.short_name()}(const GLubyte src[4], void
> *dst)
>        %endif
>
>        ${channel_datatype(c)} ${c.name} =
> -      %if c.type == parser.UNSIGNED:
> +      %if not f.is_normalized():
> +         %if c.type == parser.FLOAT and c.size == 32:
> +            UBYTE_TO_FLOAT(src[${i}]);
> +         %elif c.type == parser.FLOAT and c.size == 16:
> +            _mesa_float_to_half(UBYTE_TO_FLOAT(src[${i}]));
>

Same question here as in the previous patch.  Why are we using
UBYTE_TO_FLOAT?


> +         %else:
> +            (${channel_datatype(c)}) src[${i}];
> +         %endif
> +      %elif c.type == parser.UNSIGNED:
>           %if f.colorspace == 'srgb' and c.name in 'rgb':
>              util_format_linear_to_srgb_8unorm(src[${i}]);
>           %else:
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141118/b72f29a7/attachment.html>


More information about the mesa-dev mailing list