[Mesa-dev] [PATCH v2] mesa: rotation of 0-vector
Sergii Romantsov
sergii.romantsov at gmail.com
Tue Sep 18 13:57:54 UTC 2018
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) {
+ 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
More information about the mesa-dev
mailing list