<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 20, 2014 at 11:33 PM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, 2014-11-20 at 10:40 -0800, Jason Ekstrand wrote:<br>
><br>
><br>
> On Wed, Nov 19, 2014 at 11:24 PM, Iago Toral <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>><br>
> wrote:<br>
>         Hi Jason,<br>
><br>
>         we discussed this some weeks ago actually, the detailed<br>
>         explanation is<br>
>         here:<br>
>         <a href="https://bugs.freedesktop.org/show_bug.cgi?id=84566#c5" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=84566#c5</a><br>
><br>
>         the short answer is that this is necessary because there is a<br>
>         normalized<br>
>         parameter to _mesa_swizzle_and_convert, and when we deal with<br>
>         float<br>
>         types we want to set this to true.<br>
><br>
><br>
> I went back and looked at that and I thought the result of the<br>
> discussion was to fix the assert in mesa_format_convert and compute<br>
> the normalized parameter correctly.  After that, I thought this<br>
> shouldn't be strictly needed.  It may still be a good idea for<br>
> consistency, but I want to make sure we're doing the right thing in<br>
> mesa_format_convert<br>
<br>
</span>With this patch, in mesa_format_convert we simply take the "normalized"<br>
value for mesa_swizzle_and_convert from the normalized field of the<br>
array format, since we make sure that all float array formats will have<br>
this set to 1.<br>
<br>
Without this patch we would have to do something like this (pseudocode)<br>
in mesa_format_convert:<br>
<br>
normalized = array_format.normalized || array_format.type == FLOAT ||<br>
             array_format.type == HALF_FLOAT;<br>
<br>
We can do it either way, I just think that the latter is a bit<br>
inconsistent because:<br>
<br>
a) why would we want to generate array formats with a normalized setting<br>
of 0 if we then want to set normalized to true when they are involved?.<br>
<br>
b) Other parts of Mesa check if a format is normalized by doing<br>
normalized = !_mesa_is_enum_format_integer(srcFormat), which will make<br>
float types normalized.<br>
<span class="HOEnZb"><font color="#888888"><br>
Iago<br></font></span></blockquote><div><br></div><div>That's fine.  I just wanted to make sure that this wasn't hiding some fundamental breakage of the mesa_format_convert function.<br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
</font></span><div class="HOEnZb"><div class="h5"><br>
>         Iago<br>
><br>
>         On Wed, 2014-11-19 at 11:31 -0800, Jason Ekstrand wrote:<br>
>         > I'm not sure what I think about this.  Does it make a<br>
>         functional<br>
>         > change other than consistancy?<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>
>         >         In order to check if a format is normalized Mesa<br>
>         does<br>
>         >         something like this:<br>
>         >         normalized = !<br>
>         _mesa_is_enum_format_integer(srcFormat);<br>
>         ><br>
>         >         So all float types will set normalized to true.<br>
>         Since our<br>
>         >         mesa_array_format<br>
>         >         includes a normalized flag for each type we want to<br>
>         make it<br>
>         >         consistent with<br>
>         >         this.<br>
>         >         ---<br>
>         >          src/mesa/main/format_info.py | 3 ++-<br>
>         >          src/mesa/main/format_utils.c | 2 +-<br>
>         >          2 files changed, 3 insertions(+), 2 deletions(-)<br>
>         ><br>
>         >         diff --git a/src/mesa/main/format_info.py<br>
>         >         b/src/mesa/main/format_info.py<br>
>         >         index 315767d..d4bc276 100644<br>
>         >         --- a/src/mesa/main/format_info.py<br>
>         >         +++ b/src/mesa/main/format_info.py<br>
>         >         @@ -220,9 +220,10 @@ for fmat in formats:<br>
>         >             print '      {{ {0} }},'.format(',<br>
>         '.join(map(str,<br>
>         >         fmat.swizzle)))<br>
>         >             if fmat.is_array() and fmat.colorspace in<br>
>         ('rgb', 'srgb'):<br>
>         >                chan = fmat.array_element()<br>
>         >         +      norm = chan.norm or chan.type == parser.FLOAT<br>
>         >                print '      {{{{ {0} }}}},'.format(',<br>
>         '.join([<br>
>         >                   get_array_format_datatype(chan),<br>
>         >         -         str(int(chan.norm)),<br>
>         >         +         str(int(norm)),<br>
>         >                   str(len(fmat.channels)),<br>
>         >                   str(fmat.swizzle[0]),<br>
>         >                   str(fmat.swizzle[1]),<br>
>         >         diff --git a/src/mesa/main/format_utils.c<br>
>         >         b/src/mesa/main/format_utils.c<br>
>         >         index c3815cb..1d65f2b 100644<br>
>         >         --- a/src/mesa/main/format_utils.c<br>
>         >         +++ b/src/mesa/main/format_utils.c<br>
>         >         @@ -30,7 +30,7 @@<br>
>         ><br>
>         >          mesa_array_format RGBA8888_FLOAT = {{<br>
>         >             MESA_ARRAY_FORMAT_TYPE_FLOAT,<br>
>         >         -   0,<br>
>         >         +   1,<br>
>         >             4,<br>
>         >             0, 1, 2, 3,<br>
>         >             0, 1<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>
>         ><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>
><br>
><br>
><br>
<br>
<br>
</div></div></blockquote></div><br></div></div>