Move new mesh API to devel-api
[platform/core/uifw/dali-core.git] / dali / internal / event / effects / shader-factory.h
1 #ifndef __DALI_INTERNAL_SHADER_FACTORY_H__
2 #define __DALI_INTERNAL_SHADER_FACTORY_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/resources/resource-ticket.h>
23 #include <dali/internal/event/resources/resource-type-path-id-map.h>
24 #include <dali/internal/event/effects/shader-declarations.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 class ResourceClient;
33 class MessageController;
34
35 /**
36  * ShaderFactory is an object that manages shader binary resource load requests,
37  * It triggers the load requests during core initialization and sends a message to the
38  * render manager with information about all the requested shader binaries and their
39  * request Id.
40  */
41 class ShaderFactory
42 {
43 public:
44
45   /**
46    * Default constructor
47    */
48   ShaderFactory(ResourceClient& resourceClient);
49
50   /**
51    * Destructor
52    */
53   ~ShaderFactory();
54
55   /**
56    * Issues a request to load a binary version of a shader program, and returns a resource ticket
57    * If a request for an identical shader has already been made, the ticket for the older request
58    * is shared.
59    * @param [in] vertexSource   The vertex shader source code
60    * @param [in] fragmentSource The fragment shader source code
61    * @param [out] shaderHash  hash key created with vertex and fragment shader code
62    * @return                    A ticket for the resource
63    */
64   ResourceTicketPtr Load( const std::string& vertexSource, const std::string& fragmentSource, size_t& shaderHash );
65
66   /**
67    * Called during Core initialization to load the default shader.
68    */
69   void LoadDefaultShaders();
70
71 private:
72
73   // Undefined
74   ShaderFactory( const ShaderFactory& );
75
76   // Undefined
77   ShaderFactory& operator=( const ShaderFactory& rhs );
78
79 private:
80   ResourceClient&       mResourceClient;
81   ResourceTypePathIdMap mResourceTypePathIdMap; ///< A map of resource IDs sorted by ResourceTypePath
82   ShaderEffectPtr       mDefaultShader;
83
84 }; // class ShaderFactory
85
86 } // namespace Internal
87
88 } // namespace Dali
89
90 #endif // __DALI_INTERNAL_SHADER_FACTORY_H__