2. Overview
ArrayMemoryManager, base system for SoA (structure of
arrays).
NodeMemeryManager: manages multiple
NodeArrayMemoryManager (one per parent level).
Store Transform.
ObjectDataMemoryManager: manages multiple
ObjectDataArrayMemoryManager (one per render queue).
Store ObjectData.
3. SIMD Coherence
SSE2 single precision build, process/pack 4
nodes/entities at a time.
Always allocate memory for 4 objects (even handling with
1~3 objects). Default PACKED_ARRAY_REALS = 4.
Set default sane values (identity quaternion, matrix and
dummy pointer) to prevent NaN.
Memory manager uses concept of slots.
4 slots make a block.
LIFO (last in first out) for best performance.
If slot is dropped without LIFO order, it is recorded in
another list for later reuse.
4. Memory Cleanup
When non-LIFO order released slots are too many,
performing cleanup to move memory to keep it
contiguous again.
Example:
Too many released:
Cleaup:
5. Memory Pre-allocate
Pre-allocate a fix amount of slots at initialization.
When pre-allocate limit is reached:
Buffer resizing, pointers to the previous slots become invalid.
Nodes, MovableObjects internal pointers are automatically
updated.
If hard limit is reached, throw exception.
How to configure? Not implemented… (|||゚д゚)
6. No More
RenderTarget::update
OGRE 2.x removes RenderTarget::update(), cause
render scene update is split in 2 stages (cull and
render).
Try Compositor! Compositor! And Compositor!
If you insist low-level developing with render
targets, read CompositorPassScene::execute().
7. Port 1.x to 2.0
Main changes:
Compositor: not for post-processing only. Design how you
render the scene.
Many listeners are removed (for performance). Most
important listener left is CompositorWorkspaceListener.
Create a custom rendering pass via CompositorPassProvider.
Light must be attached to SceneNode.
SceneNodes and Cameras should not be modified after
SceneManager::updateAllTransforms(). Use assertions for
debugging.
8. Port 2.0 to 2.1
Main changes: v2 objects and Hlms (High-Level
Material System).
V2 object, Item: considerably faster than v1::Entity.
v1::Entity is still useful (good performance).
Render 100 different meshes, v1::Entities need 100 draw
calls while Items can drop to 1 draw call! How???
In OGRE 2.1, should use HlmsDatablock to replace
Material.
Manipulating Materials, can change to use Hlms scripts.
Use Hlms, setup parameters (texture, color, …) and then
Hlms analyzes it and generates shaders for rendering.
To design your custom Hlms, study templates of Hlms
implementation (need more documents …).