1 #ifndef __DALI_INTERNAL_COMPLETE_STATUS_MANAGER_H__
2 #define __DALI_INTERNAL_COMPLETE_STATUS_MANAGER_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 #include <dali/public-api/common/map-wrapper.h>
22 #include <dali/integration-api/resource-declarations.h>
23 #include <dali/internal/update/common/scene-graph-buffers.h>
30 class GlSyncAbstraction;
35 class ResourceManager;
36 class ResourceTracker;
40 class RenderMessageDispatcher;
44 * Class to manage resource tracking and completion status.
46 * Resources that are tracked are usually Framebuffer objects that are
47 * being rendered to by a RenderOnce render task.
49 * These need to change completion status either when all resources used by
50 * the framebuffer are complete, or when the framebuffer is backed by a native
51 * image and the native image has been written to by GL.
53 * This class uses ResourceManager to determine the complete status
54 * of non-tracked resources.
56 class CompleteStatusManager
60 * Resource readiness state
64 NOT_READY, ///< Resource is not ready yet
65 COMPLETE, ///< Resource has finished loading, or is otherwise complete
66 NEVER ///< Resource will never be complete, e.g. load failed.
72 * @param[in] glSyncAbstraction The GlSyncObject abstraction (for creating RenderTrackers)
73 * @param[in] renderQueue The render queue (For passing ownership of RenderTrackers to RenderManager)
74 * @param[in] renderManager The render manager
75 * @param[in] query Update buffer query
76 * @param[in] resourceManager The resource manager (For handling untracked resources)
78 CompleteStatusManager( Integration::GlSyncAbstraction& glSyncAbstraction,
79 SceneGraph::RenderMessageDispatcher& renderMessageDispatcher,
80 ResourceManager& resourceManager );
85 ~CompleteStatusManager();
88 * @param[in] id The resource id to track
90 void TrackResource( Integration::ResourceId id );
93 * Stop tracking the resource ID. Will remove any resource / render trackers for this ID.
94 * @param[in] id The resource id to stop tracking
96 void StopTrackingResource ( Integration::ResourceId id );
99 * Get the resource tracker associated with this id
100 * @param[in] id The resource id
101 * @return a valid tracker if this resource is being tracked, or NULL.
103 ResourceTracker* FindResourceTracker( Integration::ResourceId id );
106 * Gets the complete status of the resource. If it has a tracker,
107 * it returns the status from the resource tracker, otherwise it
108 * returns the load status from the resource manager
110 * @param[in] id The resource id @return The complete state of the
113 CompleteState GetStatus( Integration::ResourceId id );
117 * Factory method to create a ResourceTracker or GlResourceTracker for this resource id.
118 * It creates a ResourceTracker for framebuffers without native images, or a GlResourceTracker
119 * for framebuffers with native images that require Gl FenceSync.
120 * @param[in] id The resource id
122 ResourceTracker* CreateResourceTracker(Integration::ResourceId id);
124 typedef std::map< Integration::ResourceId, ResourceTracker* > TrackedResources;
125 typedef TrackedResources::iterator TrackedResourcesIter;
127 Integration::GlSyncAbstraction& mGlSyncAbstraction; ///< The synchronisation interface
128 SceneGraph::RenderMessageDispatcher& mRenderMessageDispatcher; ///< Render thread message dispatcher
129 ResourceManager& mResourceManager; ///< The resource manager
130 TrackedResources mTrackedResources; ///< Tracked resources
136 #endif // __DALI_INTERNAL_COMPLETE_STATUS_MANAGER_H__