[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / control / control-renderers.h
1 #ifndef DALI_TOOLKIT_INTERNAL_CONTROL_RENDERERS_H
2 #define DALI_TOOLKIT_INTERNAL_CONTROL_RENDERERS_H
3
4 /*
5  * Copyright (c) 2021 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 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
21 #include <dali/dali.h>
22
23 namespace Dali
24 {
25 namespace Toolkit
26 {
27 namespace Internal
28 {
29 #define BASIC_VERTEX_SOURCE SHADER_CONTROL_RENDERERS_VERT
30 #define BASIC_FRAGMENT_SOURCE SHADER_CONTROL_RENDERERS_FRAG
31
32 /**
33  * Helper method for rendering an image with custom shader.
34  * @param[in] vertextSrc The custom vertex shader.
35  * @param[in] fragmentSrc The custom fragment shader.
36  * @return A newly created renderer.
37  */
38 Dali::Renderer CreateRenderer(std::string_view vertexSrc, std::string_view fragmentSrc);
39
40 /**
41  * Helper method for rendering an image with custom shader.
42  * @param[in] vertextSrc The custom vertex shader.
43  * @param[in] fragmentSrc The custom fragment shader.
44  * @param[in] gridSize The number of grid sub-divisions required.
45  * @return A newly created renderer.
46  */
47 Dali::Renderer CreateRenderer(std::string_view vertexSrc, std::string_view fragmentSrc, Dali::Shader::Hint::Value hints, Dali::Uint16Pair gridSize);
48
49 /**
50  * Helper method for setting the first texture passed to a renderer.
51  * @param[in] renderer The renderer using the texture.
52  * @param[in] texture The texture to set.
53  */
54 void SetRendererTexture(Dali::Renderer renderer, Dali::Texture texture);
55
56 /**
57  * Helper method for setting the first texture passed to a renderer.
58  * @param[in] renderer The renderer using the texture.
59  * @param[in] framebuffer A frame buffer color texture attached.
60  */
61 void SetRendererTexture(Dali::Renderer renderer, Dali::FrameBuffer frameBuffer);
62
63 } // namespace Internal
64 } // namespace Toolkit
65 } // namespace Dali
66
67 #endif // DALI_TOOLKIT_INTERNAL_CONTROL_RENDERERS_H