Merge branch 'master' into tizen
[platform/core/uifw/dali-core.git] / dali / integration-api / profiling.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 // CLASS HEADER
18 #include <dali/integration-api/profiling.h>
19
20 // INTERNAL INCLUDES
21 #include <dali/integration-api/bitmap.h>
22
23 #include <dali/internal/event/common/thread-local-storage.h>
24 #include <dali/internal/event/events/gesture-event-processor.h>
25
26 #include <dali/internal/event/actors/actor-impl.h>
27 #include <dali/internal/event/actors/camera-actor-impl.h>
28 #include <dali/internal/event/actors/text-actor-impl.h>
29 #include <dali/internal/event/actors/image-actor-impl.h>
30 #include <dali/internal/event/actors/mesh-actor-impl.h>
31 #include <dali/internal/event/actors/layer-impl.h>
32
33 #include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
34 #include <dali/internal/event/actor-attachments/camera-attachment-impl.h>
35 #include <dali/internal/event/actor-attachments/text-attachment-impl.h>
36 #include <dali/internal/event/actor-attachments/image-attachment-impl.h>
37 #include <dali/internal/event/actor-attachments/mesh-attachment-impl.h>
38
39 #include <dali/internal/event/animation/animation-impl.h>
40 #include <dali/internal/event/animation/animator-connector.h>
41 #include <dali/internal/event/animation/constraint-impl.h>
42 #include <dali/internal/event/animation/active-constraint-impl.h>
43 #include <dali/internal/update/animation/property-accessor.h>
44 #include <dali/internal/update/animation/scene-graph-animation.h>
45 #include <dali/internal/update/animation/scene-graph-constraint.h>
46
47
48 #include <dali/internal/event/images/image-impl.h>
49 #include <dali/internal/event/images/image-factory-cache.h>
50 #include <dali/internal/common/text-parameters.h>
51 #include <dali/internal/event/modeling/mesh-impl.h>
52 #include <dali/internal/event/modeling/material-impl.h>
53
54 #include <dali/internal/event/resources/resource-ticket.h>
55 #include <dali/internal/event/resources/image-ticket.h>
56
57 #include <dali/internal/update/nodes/node.h>
58 #include <dali/internal/update/nodes/scene-graph-layer.h>
59 #include <dali/internal/update/modeling/internal-mesh-data.h>
60 #include <dali/internal/update/modeling/scene-graph-animatable-mesh.h>
61 #include <dali/internal/update/modeling/scene-graph-material.h>
62 #include <dali/internal/update/modeling/scene-graph-mesh.h>
63
64 #include <dali/internal/update/node-attachments/node-attachment.h>
65 #include <dali/internal/update/node-attachments/scene-graph-camera-attachment.h>
66 #include <dali/internal/update/node-attachments/scene-graph-image-attachment.h>
67 #include <dali/internal/update/node-attachments/scene-graph-mesh-attachment.h>
68 #include <dali/internal/update/node-attachments/scene-graph-text-attachment.h>
69
70 #include <dali/internal/update/resources/bitmap-metadata.h>
71
72 #include <dali/internal/render/gl-resources/bitmap-texture.h>
73
74 #include <dali/internal/render/renderers/render-material.h>
75 #include <dali/internal/render/renderers/scene-graph-image-renderer.h>
76 #include <dali/internal/render/renderers/scene-graph-text-renderer.h>
77 #include <dali/internal/render/renderers/scene-graph-mesh-renderer.h>
78
79 using Dali::Internal::GestureEventProcessor;
80 using Dali::Internal::ThreadLocalStorage;
81
82 namespace Dali
83 {
84
85 namespace Integration
86 {
87
88 void EnableProfiling( ProfilingType type )
89 {
90   GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
91
92   switch( type )
93   {
94     case PROFILING_TYPE_PAN_GESTURE:
95     {
96       eventProcessor.EnablePanGestureProfiling();
97     }
98
99     default:
100     {
101       // Do nothing
102       break;
103     }
104   }
105 }
106
107 void SetPanGesturePredictionMode( int mode )
108 {
109   GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
110   eventProcessor.SetPanGesturePredictionMode(mode);
111 }
112
113 namespace Profiling
114 {
115
116 const int ANIMATION_MEMORY_SIZE(
117   sizeof( Internal::Animation ) +
118   sizeof( Internal::AnimatorConnector<float> ) +
119   sizeof( Internal::SceneGraph::Animation ) );
120 const int CONSTRAINT_MEMORY_SIZE(
121   sizeof( Internal::Constraint ) +
122   sizeof( Internal::SceneGraph::Constraint<float, Internal::PropertyAccessor<float> > ) +
123   sizeof( Internal::ActiveConstraint<float> ) );
124 const int ACTOR_MEMORY_SIZE(
125   sizeof( Internal::Actor ) +
126   sizeof( Internal::ActorAttachment ) +
127   sizeof( Internal::SceneGraph::Node ) +
128   sizeof( Internal::SceneGraph::NodeAttachment ));
129 const int CAMERA_ACTOR_MEMORY_SIZE(
130   sizeof( Internal::CameraActor ) +
131   sizeof( Internal::CameraAttachment ) +
132   sizeof( Internal::SceneGraph::Node ) +
133   sizeof( Internal::SceneGraph::CameraAttachment ) );
134 const int TEXT_ACTOR_MEMORY_SIZE(
135   sizeof( Internal::TextActor ) +
136   sizeof( Internal::TextAttachment ) +
137   sizeof( Internal::SceneGraph::Node ) +
138   sizeof( Internal::SceneGraph::TextAttachment ) +
139   sizeof( Internal::TextParameters ) +
140   sizeof( Internal::SceneGraph::TextRenderer ) );
141 const int MESH_ACTOR_MEMORY_SIZE(
142   sizeof( Internal::MeshActor ) +
143   sizeof( Internal::MeshAttachment ) +
144   sizeof( Internal::SceneGraph::Node ) +
145   sizeof( Internal::SceneGraph::MeshAttachment ) +
146   sizeof( Internal::SceneGraph::MeshRenderer ) );
147 const int IMAGE_ACTOR_MEMORY_SIZE(
148   sizeof( Internal::ImageActor ) +
149   sizeof( Internal::ImageAttachment ) +
150   sizeof( Internal::SceneGraph::Node ) +
151   sizeof( Internal::SceneGraph::ImageAttachment ) +
152   sizeof( Internal::SceneGraph::ImageRenderer ));
153 const int LAYER_MEMORY_SIZE(
154   sizeof( Internal::Layer ) +
155   sizeof( Internal::ActorAttachment ) +
156   sizeof( Internal::SceneGraph::Layer ) +
157   sizeof( Internal::SceneGraph::NodeAttachment ) );
158 const int IMAGE_MEMORY_SIZE(
159   sizeof( Internal::Image ) +
160   sizeof( Internal::ImageFactoryCache::Request ) +
161   sizeof( Integration::Bitmap ) +
162   sizeof( Internal::BitmapMetadata ) +
163   sizeof( Internal::BitmapTexture ) +
164   sizeof( Internal::ImageTicket ) );
165 const int MESH_MEMORY_SIZE(
166   sizeof( Internal::Mesh ) +
167   sizeof( Internal::MeshData ) +
168   sizeof( Internal::SceneGraph::Mesh ) +
169   sizeof( Internal::ResourceTicket ) );
170 const int MATERIAL_MEMORY_SIZE(
171   sizeof( Internal::Material ) +
172   sizeof( Internal::SceneGraph::Material ) +
173   sizeof( Internal::SceneGraph::RenderMaterial ) );
174
175 } // namespace Profiling
176
177 } // namespace Integration
178
179 } // namespace Dali