mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
matrix-stack: only maintain composite_gets in debug builds
At times there can be huge numbers of CoglMatrixEntry structures allocated if they are being used to track the transform of many drawing commands or objects in a scenegraph. Therefore the size of a CoglMatrixEntry should be kept as small as possible both to help reduce the memory usage of applications but also to improve cache usage since matrix stack manipulations are performance critical at times. This reduces the size of CoglMatrixEntry structures for non-debug builds by removing the composite_gets counter used to sanity check how often the transform for an entry is resolved. (cherry picked from commit c400b86681a328b1e12b7e120e9c3f4f12c356e0)
This commit is contained in:
parent
f5b95e8087
commit
3e33c00c84
@ -59,7 +59,9 @@ _cogl_matrix_stack_push_entry (CoglMatrixStack *stack,
|
|||||||
entry->op = operation;
|
entry->op = operation;
|
||||||
entry->parent = stack->last_entry;
|
entry->parent = stack->last_entry;
|
||||||
|
|
||||||
|
#ifdef COGL_DEBUG_ENABLED
|
||||||
entry->composite_gets = 0;
|
entry->composite_gets = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
stack->last_entry = entry;
|
stack->last_entry = entry;
|
||||||
|
|
||||||
@ -103,7 +105,9 @@ _cogl_matrix_entry_identity_init (CoglMatrixEntry *entry)
|
|||||||
entry->ref_count = 1;
|
entry->ref_count = 1;
|
||||||
entry->op = COGL_MATRIX_OP_LOAD_IDENTITY;
|
entry->op = COGL_MATRIX_OP_LOAD_IDENTITY;
|
||||||
entry->parent = NULL;
|
entry->parent = NULL;
|
||||||
|
#ifdef COGL_DEBUG_ENABLED
|
||||||
entry->composite_gets = 0;
|
entry->composite_gets = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -507,9 +511,9 @@ initialized:
|
|||||||
g_warning ("Inconsistent matrix stack");
|
g_warning ("Inconsistent matrix stack");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
entry->composite_gets++;
|
entry->composite_gets++;
|
||||||
|
#endif
|
||||||
|
|
||||||
children = g_alloca (sizeof (CoglMatrixEntry) * depth);
|
children = g_alloca (sizeof (CoglMatrixEntry) * depth);
|
||||||
|
|
||||||
@ -524,12 +528,14 @@ initialized:
|
|||||||
children[i] = current;
|
children[i] = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef COGL_ENABLE_DEBUG
|
||||||
if (COGL_DEBUG_ENABLED (COGL_DEBUG_PERFORMANCE) &&
|
if (COGL_DEBUG_ENABLED (COGL_DEBUG_PERFORMANCE) &&
|
||||||
entry->composite_gets >= 2)
|
entry->composite_gets >= 2)
|
||||||
{
|
{
|
||||||
COGL_NOTE (PERFORMANCE,
|
COGL_NOTE (PERFORMANCE,
|
||||||
"Re-composing a matrix stack entry multiple times");
|
"Re-composing a matrix stack entry multiple times");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < depth; i++)
|
for (i = 0; i < depth; i++)
|
||||||
{
|
{
|
||||||
|
@ -55,8 +55,10 @@ struct _CoglMatrixEntry
|
|||||||
CoglMatrixOp op;
|
CoglMatrixOp op;
|
||||||
unsigned int ref_count;
|
unsigned int ref_count;
|
||||||
|
|
||||||
|
#ifdef COGL_ENABLE_DEBUG
|
||||||
/* used for performance tracing */
|
/* used for performance tracing */
|
||||||
int composite_gets;
|
int composite_gets;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _CoglMatrixEntryTranslate
|
typedef struct _CoglMatrixEntryTranslate
|
||||||
|
Loading…
Reference in New Issue
Block a user