1 #ifndef __DALI_INTEGRATION_SHADER_DATA_H__
2 #define __DALI_INTEGRATION_SHADER_DATA_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.
25 #include <dali/public-api/object/ref-object.h>
26 #include <dali/public-api/common/vector-wrapper.h>
36 typedef IntrusivePtr<ShaderData> ShaderDataPtr;
40 * A container for shader source code and compiled binary byte code
42 class DALI_IMPORT_API ShaderData : public Dali::RefObject
47 * @param[in] vertexSource Source code for vertex program
48 * @param[in] fragmentSource Source code for fragment program
50 ShaderData(const std::string& vertexSource, const std::string& fragmentSource);
54 * Protected Destructor
55 * A reference counted object may only be deleted by calling Unreference()
57 virtual ~ShaderData();
61 * Check whether there is a compiled binary available
62 * @return true if this objects contains a compiled binary
64 bool HasBinary() const;
67 * Allocate a buffer for the compiled binary bytecode
68 * @param[in] size The size of the buffer in bytes
70 void AllocateBuffer(const unsigned int size);
73 * Set hash value which is created with vertex and fragment shader code
74 * @param [in] shaderHash hash key created with vertex and fragment shader code
76 void SetHashValue(size_t shaderHash) { mShaderHash = shaderHash; }
79 * Get hash value which is created with vertex and fragment shader code
80 * @return shaderHash hash key created with vertex and fragment shader code
82 size_t GetHashValue() { return mShaderHash; }
85 ShaderData(const ShaderData& other); ///< defined private to prevent use
86 ShaderData& operator= (const ShaderData& rhs); ///< defined private to prevent use
89 size_t mShaderHash; ///< hash key created with vertex and fragment shader code
90 const std::string vertexShader; ///< source code for vertex program
91 const std::string fragmentShader; ///< source code for fragment program
92 std::vector<unsigned char> buffer; ///< buffer containing compiled binary bytecode
95 } // namespace Integration
99 #endif // __DALI_INTEGRATION_SHADER_DATA_H__