[Mesa-dev] [PATCH v2] mesa: rotation of 0-vector

Sergii Romantsov sergii.romantsov at globallogic.com
Tue Sep 18 15:12:32 UTC 2018


>
> Isn't x guaranteed to be 0.0F here?

Yes, it will 0.0f but its not used in any computation anywhere. So new
'else'-block should be treated as (1,0,0) on input - its optimized
computation of rotation only by x.

On Tue, Sep 18, 2018 at 5:56 PM, Gustaw Smolarczyk <wielkiegie at gmail.com>
wrote:

> wt., 18 wrz 2018 o 15:59 Sergii Romantsov <sergii.romantsov at gmail.com>
> napisaƂ(a):
> >
> > Specification doesn't define behaviour for rotation of 0-vector.
> > Windows and Nvidia drivers have a workaround for that.
> > For compatibility proposed that for 0-vector a rotation will be
> > done around x-axis.
> >
> > -v2: logic moved to _math_matrix_rotate
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100960
> > Signed-off-by: Sergii Romantsov <sergii.romantsov at globallogic.com>
> > ---
> >  src/mesa/math/m_matrix.c | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> >
> > diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c
> > index 57a4953..2b3adb3 100644
> > --- a/src/mesa/math/m_matrix.c
> > +++ b/src/mesa/math/m_matrix.c
> > @@ -824,6 +824,25 @@ _math_matrix_rotate( GLmatrix *mat,
> >                 M(1,0) = s;
> >              }
> >           }
> > +         else {
> > +            /* https://bugs.freedesktop.org/show_bug.cgi?id=100960
> > +             * https://github.com/KhronosGroup/OpenGL-API/issues/41
> > +             * So that is kind of workaround for empty-vectors to have
> > +             * compatibility with Windows and Nvidia drivers.
> > +             */
> > +            optimized = GL_TRUE;
> > +            /* rotate only around x-axis */
> > +            M(1,1) = c;
> > +            M(2,2) = c;
> > +            if (x < 0.0F) {
>
> Isn't x guaranteed to be 0.0F here? And I think you wanted to treat it
> as 1.0F in that case, so that (0, 0, 0) becomes (1, 0, 0).
>
> Regards,
> Gustaw Smolarczyk
>
> > +               M(1,2) = s;
> > +               M(2,1) = -s;
> > +            }
> > +            else {
> > +               M(1,2) = -s;
> > +               M(2,1) = s;
> > +            }
> > +         }
> >        }
> >        else if (z == 0.0F) {
> >           optimized = GL_TRUE;
> > --
> > 2.7.4
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



-- 
Sergii Romantsov
GlobalLogic Inc.
www.globallogic.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180918/fe9f35c0/attachment.html>


More information about the mesa-dev mailing list