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/visual-factory-cache.h>
24 #include <dali-toolkit/internal/visuals/image-visual-shader-feature-builder.h>
25 #include <string_view>
35 * ImageVisualShaderFactory is an object that provides and shares shaders between image visuals
37 class ImageVisualShaderFactory
43 ImageVisualShaderFactory();
48 ~ImageVisualShaderFactory();
51 * @brief Get the standard image rendering shader.
52 * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
53 * @param[in] featureBuilder Collection of current image shader's features
54 * @return The standard image rendering shader with features.
56 Shader GetShader(VisualFactoryCache& factoryCache, ImageVisualShaderFeatureBuilder& featureBuilder);
59 * @brief Request the default vertex shader source.
60 * @return The default vertex shader source.
62 std::string_view GetVertexShaderSource();
65 * @brief Request the default fragment shader source.
66 * @return The default fragment shader source.
68 std::string_view GetFragmentShaderSource();
72 * Undefined copy constructor.
74 ImageVisualShaderFactory(const ImageVisualShaderFactory&);
77 * Undefined assignment operator.
79 ImageVisualShaderFactory& operator=(const ImageVisualShaderFactory& rhs);
83 * @brief Cached information whether native image should change fragment shader.
84 * Default it is ChangeFragmentShader::UNDECIDED.
85 * If we have any chance to check native image source apply fragment shader,
86 * this vaule will be changed one of these : ChangeFragmentShader::DONT_CHANGE or ChangeFragmentShader::NEED_CHANGE
88 * After result cached, this value will not be changed.
90 * If value is DONT_CHANGE, ImageVisualShaderFactory::GetShader never call ApplyNativeFragmentShader.
91 * Else, ImageVisualShaderFactory::GetShader will call ApplyNativeFragmentShader if native image source texture come.
93 ImageVisualShaderFeature::ChangeFragmentShader::Type mFragmentShaderNeedChange : 3;
96 } // namespace Internal
98 } // namespace Toolkit
102 #endif // DALI_TOOLKIT_IMAGE_VISUAL_SHADER_FACTORY_H