Merge "Guide to ResourceImage scaling and filtering" into tizen
[platform/core/uifw/dali-toolkit.git] / docs / content / shared-javascript-and-cpp-documentation / performance-tips.md
1 /**
2  *
3
4 # Performance Tips {#performancetips}
5
6 ## High CPU occupancy
7
8   - Try to reduce actor count ( less actors == less processing)
9   - Delete any actors that are not visible, or move them off stage
10   - Use TextureAtlases ( reduces OpenGL driver calls to glBindTexture
11   - Optimise / reduce any constraints used
12
13 ## High GPU occupancy
14
15   - Reduce visible actor count ( == less draw calls)
16   - For 2D UI graphics which require no z sorting you can use
17
18 ~~~{.cpp}
19 // C++
20 // In this mode depth testing is turned off and order is determined by the hierachy (depth-first search order).
21 // Not always recommended if there is going to be a lot of overdraw ( if lots of actors are on top of each other)
22
23 Actor::SetDrawMode( DrawMode::OVERLAY ); // C++
24 ~~~
25
26 ~~~{.js}
27 // JavaScript
28 // In this mode depth testing is turned off and order is determined by the hierachy (depth-first search order).
29 // Not always recommended if there is going to be a lot of overdraw ( if lots of actors are on top of each other)
30
31 actor.drawMode = dali.DRAW_MODE_OVERLAY;
32 ~~~
33   - Use TextureAtlases ( reduces state changes in the GPU)
34   - Use compressed textures
35   - Use lower quality textures, e.g. smaller, lower number of bits per pixel
36   - Use Dali::NinePatchImage  where possible.
37   - Avoid using too many textures which contain alpha and require blending
38   - Avoid using too many Dali::Layer with depth testing enabled. Otherwise the layer has to clear the depth buffer.
39   - Optimise any shaders used. Pixel shaders should be kept as lean as possible.
40
41
42 @class _Guide_Performance_Tips
43
44 */
45
46