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

Gustaw Smolarczyk wielkiegie at gmail.com
Tue Sep 18 14:56:28 UTC 2018


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


More information about the mesa-dev mailing list