Merge "Check if number of textures match active samplers" into devel/master
[platform/core/uifw/dali-core.git] / dali / integration-api / profiling.cpp
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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
18 // CLASS HEADER
19 #include <dali/integration-api/profiling.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/integration-api/bitmap.h>
23
24 #include <dali/internal/event/common/thread-local-storage.h>
25 #include <dali/internal/event/events/gesture-event-processor.h>
26
27 #include <dali/internal/event/actors/actor-impl.h>
28 #include <dali/internal/event/actors/camera-actor-impl.h>
29 #include <dali/internal/event/actors/layer-impl.h>
30
31 #include <dali/internal/event/animation/animation-impl.h>
32 #include <dali/internal/event/animation/animator-connector.h>
33 #include <dali/internal/event/animation/constraint-impl.h>
34 #include <dali/internal/update/animation/property-accessor.h>
35 #include <dali/internal/update/animation/scene-graph-animation.h>
36 #include <dali/internal/update/animation/scene-graph-constraint.h>
37
38
39 #include <dali/internal/event/images/image-impl.h>
40 #include <dali/internal/event/images/image-factory-cache.h>
41
42 #include <dali/internal/event/resources/resource-ticket.h>
43 #include <dali/internal/event/resources/image-ticket.h>
44
45 #include <dali/internal/update/nodes/node.h>
46 #include <dali/internal/update/nodes/scene-graph-layer.h>
47
48 #include <dali/internal/update/rendering/scene-graph-renderer.h>
49 #include <dali/internal/update/resources/texture-metadata.h>
50
51 #include <dali/internal/render/gl-resources/bitmap-texture.h>
52 #include <dali/internal/render/renderers/render-geometry.h>
53 #include <dali/internal/render/renderers/render-property-buffer.h>
54 #include <dali/internal/render/renderers/render-renderer.h>
55 #include <dali/internal/render/renderers/render-sampler.h>
56 #include <dali/internal/update/render-tasks/scene-graph-camera.h>
57
58 using Dali::Internal::GestureEventProcessor;
59 using Dali::Internal::ThreadLocalStorage;
60
61 namespace Dali
62 {
63
64 namespace Integration
65 {
66
67 void EnableProfiling( ProfilingType type )
68 {
69   GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
70
71   switch( type )
72   {
73     case PROFILING_TYPE_PAN_GESTURE:
74     {
75       eventProcessor.EnablePanGestureProfiling();
76       break;
77     }
78     case PROFILING_TYPE_END:
79     {
80       // nothing to do
81       break;
82     }
83   }
84 }
85
86 namespace Profiling
87 {
88
89 const int ANIMATION_MEMORY_SIZE(
90   sizeof( Internal::Animation ) +
91   sizeof( Internal::AnimatorConnector<float> ) +
92   sizeof( Internal::SceneGraph::Animation ) );
93 const int CONSTRAINT_MEMORY_SIZE(
94   sizeof( Internal::Constraint<float> ) +
95   sizeof( Internal::SceneGraph::Constraint<float, Internal::PropertyAccessor<float> > ) );
96 const int ACTOR_MEMORY_SIZE(
97   sizeof( Internal::Actor ) +
98   sizeof( Internal::SceneGraph::Node ) );
99 const int CAMERA_ACTOR_MEMORY_SIZE(
100   sizeof( Internal::CameraActor ) +
101   sizeof( Internal::SceneGraph::Node ) +
102   sizeof( Internal::SceneGraph::Camera ) );
103 const int LAYER_MEMORY_SIZE(
104   sizeof( Internal::Layer ) +
105   sizeof( Internal::SceneGraph::Layer ) );
106 const int IMAGE_MEMORY_SIZE(
107   sizeof( Internal::Image ) +
108   sizeof( Internal::ImageFactoryCache::Request ) +
109   sizeof( Integration::Bitmap ) +
110   sizeof( Internal::TextureMetadata ) +
111   sizeof( Internal::BitmapTexture ) +
112   sizeof( Internal::ImageTicket ) );
113 const int RENDERER_MEMORY_SIZE(
114   sizeof( Internal::Renderer ) +
115   sizeof( Internal::SceneGraph::Renderer ) +
116   sizeof( Internal::Render::Renderer ) );
117 const int GEOMETRY_MEMORY_SIZE(
118   sizeof( Internal::Geometry ) +
119   sizeof( Internal::Render::Geometry) );
120 const int PROPERTY_BUFFER_MEMORY_SIZE(
121   sizeof( Internal::PropertyBuffer ) +
122   sizeof( Internal::Render::PropertyBuffer ) );
123 const int TEXTURE_SET_MEMORY_SIZE(
124   sizeof( Internal::TextureSet ) +
125   sizeof( Internal::SceneGraph::TextureSet ) );
126 const int SAMPLER_MEMORY_SIZE(
127   sizeof( Internal::Sampler ) +
128   sizeof( Internal::Render::Sampler ) );
129 const int SHADER_MEMORY_SIZE(
130   sizeof( Internal::Shader ) +
131   sizeof( Internal::SceneGraph::Shader ) );
132
133 } // namespace Profiling
134
135 } // namespace Integration
136
137 } // namespace Dali