mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 04:42:14 +00:00
Reorder some struct members to avoid padding due to alignment
This tweaks the ordering of some struct members in some of the more important structs so that the compiler won't insert wasted padding to avoid breaking the alignment. Some members that were previously unsigned long have been changed to unsigned int. These members need to be able to fit in 32-bits to run on 32-bit machines anyway so there's no point in having them extend to 64-bit on 64-bit machines. This doesn't affect the public API. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit b721af236680005464e39f7f4dd11381d95efb16)
This commit is contained in:
parent
7572fedeaa
commit
3a041ef41b
@ -92,12 +92,12 @@ typedef enum
|
||||
|
||||
struct _CoglClipStack
|
||||
{
|
||||
CoglClipStackType type;
|
||||
|
||||
/* This will be null if there is no parent. If it is not null then
|
||||
this node must be holding a reference to the parent */
|
||||
CoglClipStack *parent;
|
||||
|
||||
CoglClipStackType type;
|
||||
|
||||
/* All clip entries have a window-space bounding box which we can
|
||||
use to calculate a scissor. The scissor limits the clip so that
|
||||
we don't need to do a full stencil clear if the stencil buffer is
|
||||
@ -121,6 +121,9 @@ struct _CoglClipStackRect
|
||||
float x1;
|
||||
float y1;
|
||||
|
||||
/* The matrix that was current when the clip was set */
|
||||
CoglMatrixEntry *matrix_entry;
|
||||
|
||||
/* If this is true then the clip for this rectangle is entirely
|
||||
described by the scissor bounds. This implies that the rectangle
|
||||
is screen aligned and we don't need to use the stencil buffer to
|
||||
@ -130,9 +133,6 @@ struct _CoglClipStackRect
|
||||
journal. In that case we can use the original clip coordinates
|
||||
and modify the rectangle instead. */
|
||||
CoglBool can_be_scissor;
|
||||
|
||||
/* The matrix that was current when the clip was set */
|
||||
CoglMatrixEntry *matrix_entry;
|
||||
};
|
||||
|
||||
struct _CoglClipStackWindowRect
|
||||
|
@ -66,11 +66,11 @@ typedef struct _CoglJournal
|
||||
typedef struct _CoglJournalEntry
|
||||
{
|
||||
CoglPipeline *pipeline;
|
||||
int n_layers;
|
||||
CoglMatrixEntry *modelview_entry;
|
||||
CoglClipStack *clip_stack;
|
||||
/* Offset into ctx->logged_vertices */
|
||||
size_t array_offset;
|
||||
int n_layers;
|
||||
} CoglJournalEntry;
|
||||
|
||||
CoglJournal *
|
||||
|
@ -130,8 +130,8 @@ typedef struct _CoglMatrixEntrySave
|
||||
{
|
||||
CoglMatrixEntry _parent_data;
|
||||
|
||||
CoglBool cache_valid;
|
||||
CoglMatrix *cache;
|
||||
CoglBool cache_valid;
|
||||
|
||||
} CoglMatrixEntrySave;
|
||||
|
||||
|
@ -179,10 +179,10 @@ typedef struct
|
||||
/* The texture matrix dscribes how to transform texture coordinates */
|
||||
CoglMatrix matrix;
|
||||
|
||||
CoglBool point_sprite_coords;
|
||||
|
||||
CoglPipelineSnippetList vertex_snippets;
|
||||
CoglPipelineSnippetList fragment_snippets;
|
||||
|
||||
CoglBool point_sprite_coords;
|
||||
} CoglPipelineLayerBigState;
|
||||
|
||||
struct _CoglPipelineLayer
|
||||
@ -218,7 +218,7 @@ struct _CoglPipelineLayer
|
||||
|
||||
/* A mask of which state groups are different in this layer
|
||||
* in comparison to its parent. */
|
||||
unsigned long differences;
|
||||
unsigned int differences;
|
||||
|
||||
/* Common differences
|
||||
*
|
||||
@ -231,14 +231,14 @@ struct _CoglPipelineLayer
|
||||
/* Each layer is directly associated with a single texture unit */
|
||||
int unit_index;
|
||||
|
||||
/* The texture for this layer, or NULL for an empty
|
||||
* layer */
|
||||
CoglTexture *texture;
|
||||
/* The type of the texture. This is always set even if the texture
|
||||
is NULL and it will be used to determine what type of texture
|
||||
lookups to use in any shaders generated by the pipeline
|
||||
backends. */
|
||||
CoglTextureType texture_type;
|
||||
/* The texture for this layer, or NULL for an empty
|
||||
* layer */
|
||||
CoglTexture *texture;
|
||||
|
||||
const CoglSamplerCacheEntry *sampler_cache_entry;
|
||||
|
||||
|
@ -382,11 +382,6 @@ struct _CoglPipeline
|
||||
* type to track the tree heirachy so we can share code... */
|
||||
CoglNode _parent;
|
||||
|
||||
/* We need to track if a pipeline is referenced in the journal
|
||||
* because we can't allow modification to these pipelines without
|
||||
* flushing the journal first */
|
||||
unsigned long journal_ref_count;
|
||||
|
||||
/* When weak pipelines are destroyed the user is notified via this
|
||||
* callback */
|
||||
CoglPipelineDestroyCallback destroy_callback;
|
||||
@ -395,28 +390,33 @@ struct _CoglPipeline
|
||||
* private data is passed to the above callback */
|
||||
void *destroy_data;
|
||||
|
||||
/* We need to track if a pipeline is referenced in the journal
|
||||
* because we can't allow modification to these pipelines without
|
||||
* flushing the journal first */
|
||||
unsigned int journal_ref_count;
|
||||
|
||||
/* A mask of which sparse state groups are different in this
|
||||
* pipeline in comparison to its parent. */
|
||||
unsigned long differences;
|
||||
unsigned int differences;
|
||||
|
||||
/* Whenever a pipeline is modified we increment the age. There's no
|
||||
* guarantee that it won't wrap but it can nevertheless be a
|
||||
* convenient mechanism to determine when a pipeline has been
|
||||
* changed to you can invalidate some some associated cache that
|
||||
* depends on the old state. */
|
||||
unsigned long age;
|
||||
unsigned int age;
|
||||
|
||||
/* This is the primary color of the pipeline.
|
||||
*
|
||||
* This is a sparse property, ref COGL_PIPELINE_STATE_COLOR */
|
||||
CoglColor color;
|
||||
CoglColor color;
|
||||
|
||||
/* A pipeline may be made up with multiple layers used to combine
|
||||
* textures together.
|
||||
*
|
||||
* This is sparse state, ref COGL_PIPELINE_STATE_LAYERS */
|
||||
GList *layer_differences;
|
||||
unsigned int n_layers;
|
||||
GList *layer_differences;
|
||||
|
||||
/* As a basic way to reduce memory usage we divide the pipeline
|
||||
* state into two groups; the minimal state modified in 90% of
|
||||
|
@ -36,10 +36,10 @@ struct _CoglPrimitive
|
||||
{
|
||||
CoglObject _parent;
|
||||
|
||||
CoglIndices *indices;
|
||||
CoglVerticesMode mode;
|
||||
int first_vertex;
|
||||
int n_vertices;
|
||||
CoglIndices *indices;
|
||||
|
||||
int immutable_ref;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user