• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(std::shared_ptr<RuntimeEffect> runningTimeEffect)35     explicit RuntimeShaderBuilderImpl(std::shared_ptr<RuntimeEffect> runningTimeEffect) {}
~RuntimeShaderBuilderImpl()36     ~RuntimeShaderBuilderImpl() override {}
37 
38     virtual std::shared_ptr<ShaderEffect> MakeShader(const Matrix* localMatrix, bool isOpaque) = 0;
39     virtual std::shared_ptr<Image> MakeImage(GPUContext* gpuContext,
40         const Matrix* localMatrix, ImageInfo resultInfo, bool mipmapped) = 0;
41 
42     virtual void SetChild(const std::string& name, std::shared_ptr<ShaderEffect> shader) = 0;
43     virtual void SetUniform(const std::string& name, float val) = 0;
44     virtual void SetUniform(const std::string& name, float x, float y) = 0;
45     virtual void SetUniform(const std::string& name, float x, float y, float z) = 0;
46     virtual void SetUniform(const std::string& name, float x, float y, float width, float height) = 0;
47     virtual void SetUniform(const std::string& name, const Matrix44& uniformMatrix44) = 0;
48     virtual void SetUniformVec4(const std::string& name, float x, float y, float z, float w) = 0;
49 };
50 } // namespace Drawing
51 } // namespace Rosen
52 } // namespace OHOS
53 #endif