Skip to content

Commit 93c1d51

Browse files
sofarnerzhul
authored andcommittedApr 18, 2017
Reorder TileSpec. (#5591)
Put accessed members that are needed by updateFastFaceRow() all in the same cacheline.
1 parent eddf16e commit 93c1d51

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed
 

‎src/client/tile.h

+27-24
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,22 @@ struct FrameSpec
197197
struct TileSpec
198198
{
199199
TileSpec():
200-
texture_id(0),
201200
texture(NULL),
202-
normal_texture(NULL),
203-
flags_texture(NULL),
201+
texture_id(0),
202+
color(),
204203
material_type(TILE_MATERIAL_BASIC),
205204
material_flags(
206205
//0 // <- DEBUG, Use the one below
207206
MATERIAL_FLAG_BACKFACE_CULLING
208207
),
208+
rotation(0),
209+
emissive_light(0),
209210
shader_id(0),
210-
animation_frame_count(1),
211+
normal_texture(NULL),
212+
flags_texture(NULL),
211213
animation_frame_length_ms(0),
212-
rotation(0),
213-
has_color(false),
214-
color(),
215-
emissive_light(0)
214+
animation_frame_count(1),
215+
has_color(false)
216216
{
217217
}
218218

@@ -284,30 +284,33 @@ struct TileSpec
284284
material.TextureLayer[1].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
285285
}
286286
}
287-
288-
u32 texture_id;
287+
288+
// ordered for performance! please do not reorder unless you pahole it first.
289289
video::ITexture *texture;
290-
video::ITexture *normal_texture;
291-
video::ITexture *flags_texture;
292-
290+
u32 texture_id;
291+
// The color of the tile, or if the tile does not own
292+
// a color then the color of the node owning this tile.
293+
video::SColor color;
293294
// Material parameters
294295
u8 material_type;
295296
u8 material_flags;
297+
298+
u8 rotation;
299+
//! This much light does the tile emit.
300+
u8 emissive_light;
301+
296302
u32 shader_id;
303+
304+
video::ITexture *normal_texture;
305+
// cacheline (64)
306+
307+
video::ITexture *flags_texture;
297308
// Animation parameters
298-
u8 animation_frame_count;
299309
u16 animation_frame_length_ms;
300-
std::vector<FrameSpec> frames;
301-
302-
u8 rotation;
310+
u8 animation_frame_count;
303311
//! If true, the tile has its own color.
304312
bool has_color;
305-
/*!
306-
* The color of the tile, or if the tile does not own
307-
* a color then the color of the node owning this tile.
308-
*/
309-
video::SColor color;
310-
//! This much light does the tile emit.
311-
u8 emissive_light;
313+
314+
std::vector<FrameSpec> frames;
312315
};
313316
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.