1 #ifndef DALI_TOOLKIT_IMAGE_VISUAL_SHADER_FACTORY_H
2 #define DALI_TOOLKIT_IMAGE_VISUAL_SHADER_FACTORY_H
5 * Copyright (c) 2023 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.
23 #include <dali-toolkit/internal/visuals/image-visual-shader-feature-builder.h>
24 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
25 #include <string_view>
34 * ImageVisualShaderFactory is an object that provides and shares shaders between image visuals
36 class ImageVisualShaderFactory
42 ImageVisualShaderFactory();
47 ~ImageVisualShaderFactory();
50 * @brief Get the standard image rendering shader.
51 * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
52 * @param[in] featureBuilder Collection of current image shader's features
53 * @return The standard image rendering shader with features.
55 Shader GetShader(VisualFactoryCache& factoryCache, ImageVisualShaderFeatureBuilder& featureBuilder);
58 * @brief Request the default vertex shader source.
59 * @return The default vertex shader source.
61 std::string_view GetVertexShaderSource();
64 * @brief Request the default fragment shader source.
65 * @return The default fragment shader source.
67 std::string_view GetFragmentShaderSource();
70 * @brief Get the default shader source.
71 * @param[in] shaders shaderList for precompile
73 void GetPrecompiledShader(RawShaderData& shaders);
77 * Undefined copy constructor.
79 ImageVisualShaderFactory(const ImageVisualShaderFactory&);
82 * Undefined assignment operator.
84 ImageVisualShaderFactory& operator=(const ImageVisualShaderFactory& rhs);
88 * @brief Cached information whether native image should change fragment shader.
89 * Default it is ChangeFragmentShader::UNDECIDED.
90 * If we have any chance to check native image source apply fragment shader,
91 * this vaule will be changed one of these : ChangeFragmentShader::DONT_CHANGE or ChangeFragmentShader::NEED_CHANGE
93 * After result cached, this value will not be changed.
95 * If value is DONT_CHANGE, ImageVisualShaderFactory::GetShader never call ApplyNativeFragmentShader.
96 * Else, ImageVisualShaderFactory::GetShader will call ApplyNativeFragmentShader if native image source texture come.
98 ImageVisualShaderFeature::ChangeFragmentShader::Type mFragmentShaderNeedChange : 3;
101 } // namespace Internal
103 } // namespace Toolkit
107 #endif // DALI_TOOLKIT_IMAGE_VISUAL_SHADER_FACTORY_H