• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef GLES_NODE_CONTEXT_DESCRIPTOR_SET_MANAGER_GLES_H
17 #define GLES_NODE_CONTEXT_DESCRIPTOR_SET_MANAGER_GLES_H
18 
19 #include <base/containers/array_view.h>
20 #include <base/containers/vector.h>
21 #include <render/device/pipeline_layout_desc.h>
22 #include <render/namespace.h>
23 #include <render/render_data_structures.h>
24 
25 #include "nodecontext/node_context_descriptor_set_manager.h"
26 
27 RENDER_BEGIN_NAMESPACE()
28 struct RenderPassBeginInfo;
29 class GpuResourceManager;
30 
31 class DescriptorSetManagerGles final : public DescriptorSetManager {
32 public:
33     explicit DescriptorSetManagerGles(Device& device);
34     ~DescriptorSetManagerGles() override = default;
35 
36     void BeginFrame() override;
37     void BeginBackendFrame();
38 
39     void UpdateDescriptorSetGpuHandle(const RenderHandle& handle) override;
40     void UpdateCpuDescriptorSetPlatform(const DescriptorSetLayoutBindingResources& bindingResources) override;
41 
42     void CreateDescriptorSets(const uint32_t arrayIndex, const uint32_t descriptorSetCount,
43         const BASE_NS::array_view<const DescriptorSetLayoutBinding> descriptorSetLayoutBindings) override;
44 
45 private:
46 };
47 
48 class NodeContextDescriptorSetManagerGles final : public NodeContextDescriptorSetManager {
49 public:
50     explicit NodeContextDescriptorSetManagerGles(Device& device);
51     ~NodeContextDescriptorSetManagerGles();
52 
53     void ResetAndReserve(const DescriptorCounts& descriptorCounts) override;
54     void BeginFrame() override;
55 
56     RenderHandle CreateDescriptorSet(
57         const BASE_NS::array_view<const DescriptorSetLayoutBinding> descriptorSetLayoutBindings) override;
58     RenderHandle CreateOneFrameDescriptorSet(
59         const BASE_NS::array_view<const DescriptorSetLayoutBinding> descriptorSetLayoutBindings) override;
60 
61     void UpdateDescriptorSetGpuHandle(const RenderHandle handle) override;
62     void UpdateCpuDescriptorSetPlatform(const DescriptorSetLayoutBindingResources& bindingResources) override;
63 
64 private:
65     Device& device_;
66 
67     uint32_t oneFrameDescSetGeneration_ { 0u };
68 #if (RENDER_VALIDATION_ENABLED == 1)
69     static constexpr uint32_t MAX_ONE_FRAME_GENERATION_IDX { 16u };
70 #endif
71 };
72 RENDER_END_NAMESPACE()
73 
74 #endif // GLES_NODE_CONTEXT_DESCRIPTOR_SET_MANAGER_GLES_H
75