Hi,

I wrote a patch that optimizes matrix scale and translate because i doubt gcc will find the shortest path through an invocation, three loops and a memory writeback per strcpy by itself.

diff --git a/compositor/compositor.c b/compositor/compositor.c
index 9d7c330..e571b12 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -87,21 +87,20 @@ wlsc_matrix_multiply(struct wlsc_matrix *m, const struct wlsc_matrix *n)
 static void
wlsc_matrix_translate(struct wlsc_matrix *matrix, GLfloat x, GLfloat y, GLfloat z)
 {
-       struct wlsc_matrix translate = {
-               { 1, 0, 0, 0,  0, 1, 0, 0,  0, 0, 1, 0,  x, y, z, 1 }
-       };
-
-       wlsc_matrix_multiply(matrix, &translate);
+       matrix->d[12] += x;
+       matrix->d[13] += y;
+       matrix->d[14] += z;
 }

 static void
wlsc_matrix_scale(struct wlsc_matrix *matrix, GLfloat x, GLfloat y, GLfloat z)
 {
-       struct wlsc_matrix scale = {
-               { x, 0, 0, 0,  0, y, 0, 0,  0, 0, z, 0,  0, 0, 0, 1 }
-       };
-
-       wlsc_matrix_multiply(matrix, &scale);
+       int i;
+       for(i = 0; i < 4; i++) {
+               matrix->d[0 + 4 * i] *= x;
+               matrix->d[1 + 4 * i] *= y;
+               matrix->d[2 + 4 * i] *= z;
+       }
 }

 static void

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to