util: optimize _clutter_util_fully_transform_vertices

Instead of unconditionally combining the modelview and projection
matrices and then iterating each of the vertices to call
cogl_matrix_transform_point for each one in turn we now only combine the
matrices if there are more than 4 vertices (with less than 4 vertices
its less work to transform them separately) and we use the new
cogl_vertex_{transform,project}_points APIs which can hopefully
vectorize the transformations.

Finally the perspective divide and viewport scale is done in a separate
loop at the end and we don't do the spurious perspective divide and
viewport scale for the z component.
This commit is contained in:
Robert Bragg 2011-02-08 10:37:15 +00:00
parent 962b84ed56
commit d4a5d70ee0
2 changed files with 9 additions and 9 deletions

View File

@ -498,7 +498,7 @@ typedef struct _Point4f
static void
_cogl_matrix_transform_points_f2 (const CoglMatrix *matrix,
size_t stride_in,
void *points_in,
const void *points_in,
size_t stride_out,
void *points_out,
int n_points)
@ -519,7 +519,7 @@ _cogl_matrix_transform_points_f2 (const CoglMatrix *matrix,
static void
_cogl_matrix_project_points_f2 (const CoglMatrix *matrix,
size_t stride_in,
void *points_in,
const void *points_in,
size_t stride_out,
void *points_out,
int n_points)
@ -541,7 +541,7 @@ _cogl_matrix_project_points_f2 (const CoglMatrix *matrix,
static void
_cogl_matrix_transform_points_f3 (const CoglMatrix *matrix,
size_t stride_in,
void *points_in,
const void *points_in,
size_t stride_out,
void *points_out,
int n_points)
@ -565,7 +565,7 @@ _cogl_matrix_transform_points_f3 (const CoglMatrix *matrix,
static void
_cogl_matrix_project_points_f3 (const CoglMatrix *matrix,
size_t stride_in,
void *points_in,
const void *points_in,
size_t stride_out,
void *points_out,
int n_points)
@ -591,7 +591,7 @@ _cogl_matrix_project_points_f3 (const CoglMatrix *matrix,
static void
_cogl_matrix_project_points_f4 (const CoglMatrix *matrix,
size_t stride_in,
void *points_in,
const void *points_in,
size_t stride_out,
void *points_out,
int n_points)
@ -618,7 +618,7 @@ void
cogl_matrix_transform_points (const CoglMatrix *matrix,
int n_components,
size_t stride_in,
void *points_in,
const void *points_in,
size_t stride_out,
void *points_out,
int n_points)
@ -646,7 +646,7 @@ void
cogl_matrix_project_points (const CoglMatrix *matrix,
int n_components,
size_t stride_in,
void *points_in,
const void *points_in,
size_t stride_out,
void *points_out,
int n_points)

View File

@ -505,7 +505,7 @@ void
cogl_matrix_transform_points (const CoglMatrix *matrix,
int n_components,
size_t stride_in,
void *points_in,
const void *points_in,
size_t stride_out,
void *points_out,
int n_points);
@ -560,7 +560,7 @@ void
cogl_matrix_project_points (const CoglMatrix *matrix,
int n_components,
size_t stride_in,
void *points_in,
const void *points_in,
size_t stride_out,
void *points_out,
int n_points);