1 #ifndef DALI_GRAPHICS_SHADER_CREATE_INFO_H
2 #define DALI_GRAPHICS_SHADER_CREATE_INFO_H
5 * Copyright (c) 2021 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.
26 #include "graphics-shader.h"
27 #include "graphics-types.h"
34 * @brief ShaderCreateInfo contains details of a single shader (not a GL program!)
35 * attached to a specified pipeline stage (ie. vertex shader, fragment shader etc.)
37 struct ShaderCreateInfo
40 * @brief Sets pointer to the extension
42 * The pointer to the extension must be set either to nullptr
43 * or to the valid structure. The structures may create
44 * a chain. The last structure in a chain must point at
47 * @param[in] value pointer to the valid extension structure
48 * @return reference to this structure
50 auto& SetNextExtension(ExtensionCreateInfo* value)
52 nextExtension = value;
57 * @brief Sets pipeline stage the shader will be executed in
59 * @param[in] value valid pipeline stage
60 * @return reference to this structure
62 auto& SetPipelineStage(PipelineStage value)
64 pipelineStage = value;
69 * @brief Sets shader source language
71 * @param[in] value valid source language
72 * @return reference to this structure
74 auto& SetShaderlanguage(ShaderLanguage value)
76 shaderlanguage = value;
81 * @brief Sets pointer to the source data
83 * @param[in] value pointer to the source data
84 * @return reference to this structure
86 auto& SetSourceData(const void* value)
93 * @brief Sets size of the source data (in bytes)
95 * If the shader mode is TEXT, the size must include
98 * @param[in] value size in bytes
99 * @return reference to this structure
101 auto& SetSourceSize(uint32_t value)
108 * @brief Sets shader source mode
110 * @param[in] value shader mode
111 * @return reference to this structure
113 auto& SetSourceMode(ShaderSourceMode value)
120 * @brief Sets allocation callbacks which will be used when object is created
123 * @param[in] value Valid reference to AllocationCallbacksStructure
124 * @return reference to this structure
126 auto& SetAllocationCallbacks(const AllocationCallbacks& value)
128 allocationCallbacks = &value;
133 * @brief Equality operator.
135 * @param[in] rhs The ShaderCreateInfo to test against
136 * @return True if the ShaderCreateInfo are equal
138 bool operator==(const ShaderCreateInfo& rhs) const
140 return (sourceSize == rhs.sourceSize && 0 == memcmp(sourceData, rhs.sourceData, sourceSize) && pipelineStage == rhs.pipelineStage && allocationCallbacks == rhs.allocationCallbacks);
143 GraphicsStructureType type{GraphicsStructureType::SHADER_CREATE_INFO_STRUCT};
144 ExtensionCreateInfo* nextExtension{nullptr};
146 PipelineStage pipelineStage{};
147 ShaderLanguage shaderlanguage{};
148 const void* sourceData{nullptr};
149 uint32_t sourceSize{0u};
150 ShaderSourceMode sourceMode{};
152 const AllocationCallbacks* allocationCallbacks{nullptr};
155 } // namespace Graphics
158 #endif // DALI_GRAPHICS_SHADER_CREATE_INFO_H