1 /*
2  * Copyright (c) 2024 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 #ifndef GLES_SPIRV_CROSS_HELPERS_H
16 #define GLES_SPIRV_CROSS_HELPERS_H
17 
18 #include <base/containers/string.h>
19 #include <base/containers/string_view.h>
20 #include <render/device/gpu_resource_desc.h>
21 #include <render/device/pipeline_state_desc.h>
22 
23 #include "spirv_cross_helper_structs_gles.h"
24 
RENDER_BEGIN_NAMESPACE()25 RENDER_BEGIN_NAMESPACE()
26 namespace Gles {
27 
28 bool DefineForSpec(BASE_NS::array_view<const ShaderSpecialization::Constant> reflectionInfo, uint32_t spcid,
29     uintptr_t offset, BASE_NS::string& result);
30 
31 BASE_NS::string InsertDefines(BASE_NS::string_view shaderIn, BASE_NS::string_view Defines);
32 
33 BASE_NS::string Specialize(ShaderStageFlags mask, BASE_NS::string_view shaderTemplate,
34     BASE_NS::array_view<const ShaderSpecialization::Constant> info, const ShaderSpecializationConstantDataView& data);
35 
36 int32_t FindConstant(
37     BASE_NS::array_view<const PushConstantReflection> reflections, const PushConstantReflection& reflection);
38 
39 } // namespace Gles
40 RENDER_END_NAMESPACE()
41 #endif // GLES_SPIRV_CROSS_HELPERS_H
42