1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef RUNTIME_SHADER_BUILDER_IMPL_H
17 #define RUNTIME_SHADER_BUILDER_IMPL_H
18 
19 #include "base_impl.h"
20 
21 #include "utils/matrix.h"
22 #include "utils/matrix44.h"
23 
24 namespace OHOS {
25 namespace Rosen {
26 namespace Drawing {
27 class RuntimeEffect;
28 class Image;
29 class ShaderEffect;
30 class GPUContext;
31 class ImageInfo;
32 class RuntimeShaderBuilderImpl : public BaseImpl {
33 public:
RuntimeShaderBuilderImpl()34     RuntimeShaderBuilderImpl() {}
~RuntimeShaderBuilderImpl()35     ~RuntimeShaderBuilderImpl() override {}
36 
37     virtual std::shared_ptr<ShaderEffect> MakeShader(const Matrix* localMatrix, bool isOpaque) = 0;
38     virtual std::shared_ptr<Image> MakeImage(GPUContext* gpuContext,
39         const Matrix* localMatrix, ImageInfo resultInfo, bool mipmapped) = 0;
40 
41     virtual void SetChild(const std::string& name, std::shared_ptr<ShaderEffect> shader) = 0;
42     virtual void SetUniform(const std::string& name, float val) = 0;
43     virtual void SetUniform(const std::string& name, float x, float y) = 0;
44     virtual void SetUniform(const std::string& name, float x, float y, float z) = 0;
45     virtual void SetUniform(const std::string& name, float x, float y, float width, float height) = 0;
46     virtual void SetUniform(const std::string& name, const float values[], size_t size) = 0;
47     virtual void SetUniform(const std::string& name, const Matrix& uniformMatrix33) = 0;
48     virtual void SetUniform(const std::string& name, const Matrix44& uniformMatrix44) = 0;
49     virtual void SetUniformVec4(const std::string& name, float x, float y, float z, float w) = 0;
50 };
51 } // namespace Drawing
52 } // namespace Rosen
53 } // namespace OHOS
54 #endif