mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
journal: avoiding some _cogl_matrix_entry_get()'s
When uploading the vertices the journal calls _cogl_matrix_entry_get() to get a CoglMatrix for each journal entry so that it can so a software transform. Since _cogl_matrix_entry_get() can be a performance hot-spot and since it's trivial to keep track of the last CoglMatrixEntry seen we now avoid repeatedly calling _cogl_matrix_entry_get() for sequential entries with the same transform. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 70cad61533316e2303b8e188f2f361701dfb0c61)
This commit is contained in:
parent
e3d6bc36d3
commit
8b22b0da65
@ -1070,6 +1070,8 @@ upload_vertices (CoglJournal *journal,
|
|||||||
float *vout;
|
float *vout;
|
||||||
int entry_num;
|
int entry_num;
|
||||||
int i;
|
int i;
|
||||||
|
CoglMatrixEntry *last_modelview_entry = NULL;
|
||||||
|
CoglMatrix modelview;
|
||||||
|
|
||||||
g_assert (needed_vbo_len);
|
g_assert (needed_vbo_len);
|
||||||
|
|
||||||
@ -1107,7 +1109,6 @@ upload_vertices (CoglJournal *journal,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
float v[8];
|
float v[8];
|
||||||
CoglMatrix modelview;
|
|
||||||
|
|
||||||
v[0] = vin[0];
|
v[0] = vin[0];
|
||||||
v[1] = vin[1];
|
v[1] = vin[1];
|
||||||
@ -1118,6 +1119,7 @@ upload_vertices (CoglJournal *journal,
|
|||||||
v[6] = vin[array_stride];
|
v[6] = vin[array_stride];
|
||||||
v[7] = vin[1];
|
v[7] = vin[1];
|
||||||
|
|
||||||
|
if (entry->modelview_entry != last_modelview_entry)
|
||||||
_cogl_matrix_entry_get (entry->modelview_entry, &modelview);
|
_cogl_matrix_entry_get (entry->modelview_entry, &modelview);
|
||||||
cogl_matrix_transform_points (&modelview,
|
cogl_matrix_transform_points (&modelview,
|
||||||
2, /* n_components */
|
2, /* n_components */
|
||||||
|
Loading…
Reference in New Issue
Block a user