[Mesa-dev] [PATCH v2 01/23] mesa/format_utils: Fix a bug in unorm_to_float helper function
Iago Toral
itoral at igalia.com
Thu Dec 4 01:07:11 PST 2014
On Wed, 2014-12-03 at 14:26 -0800, Jason Ekstrand wrote:
>
>
> On Wed, Dec 3, 2014 at 2:15 PM, Ian Romanick <idr at freedesktop.org>
> wrote:
> This patch is
>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>
> Should it also be tagged for 10.4?
>
>
> Yes, it should.
Should I add "Cc: 10.4 <mesa-stable at lists.freedesktop.org>" then?
Iago
>
>
>
> On 12/01/2014 03:04 AM, Iago Toral Quiroga wrote:
> > From: Jason Ekstrand <jason.ekstrand at intel.com>
> >
> > This patch fixes the return of a wrong value when x is lower
> than
> > -MAX_INT(src_bits) as the result would not be between [-1.0
> 1.0].
> >
> > v2 by Samuel Iglesias <siglesias at igalia.com>:
> > - Modify unorm_to_float() to avoid doing the division
> when
> > x == -MAX_INT(src_bits)
> > ---
> > src/mesa/main/format_utils.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/src/mesa/main/format_utils.c
> b/src/mesa/main/format_utils.c
> > index 93a0cea..5dd0848 100644
> > --- a/src/mesa/main/format_utils.c
> > +++ b/src/mesa/main/format_utils.c
> > @@ -152,7 +152,7 @@ unorm_to_float(unsigned x, unsigned
> src_bits)
> > static inline float
> > snorm_to_float(int x, unsigned src_bits)
> > {
> > - if (x == -MAX_INT(src_bits))
> > + if (x <= -MAX_INT(src_bits))
> > return -1.0f;
> > else
> > return x * (1.0f / (float)MAX_INT(src_bits));
> >
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
>
More information about the mesa-dev
mailing list