• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 Google LLC
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef skgpu_graphite_RenderPassTask_DEFINED
9 #define skgpu_graphite_RenderPassTask_DEFINED
10 
11 #include "src/gpu/graphite/CommandBuffer.h"
12 #include "src/gpu/graphite/Task.h"
13 
14 #include <vector>
15 
16 namespace skgpu::graphite {
17 
18 class DrawPass;
19 
20 /**
21  * RenderPassTask handles preparing and recording DrawLists into a single render pass within a
22  * command buffer. If the backend supports subpasses, and the DrawLists/surfaces are compatible, a
23  * RenderPassTask can execute multiple DrawLists across different surfaces as subpasses nested
24  * within a single render pass. If there is no such support, a RenderPassTask is one-to-one with a
25  * "render pass" to specific surface.
26  */
27 class RenderPassTask final : public Task {
28 public:
29     static sk_sp<RenderPassTask> Make(std::vector<std::unique_ptr<DrawPass>> passes,
30                                       const RenderPassDesc&,
31                                       sk_sp<TextureProxy> target);
32 
33     ~RenderPassTask() override;
34 
35     bool prepareResources(ResourceProvider*, const RuntimeEffectDictionary*) override;
36 
37     bool addCommands(Context*, CommandBuffer*, ReplayTargetData) override;
38 
39 private:
40     RenderPassTask(std::vector<std::unique_ptr<DrawPass>> passes,
41                    const RenderPassDesc&,
42                    sk_sp<TextureProxy> target);
43 
44     std::vector<std::unique_ptr<DrawPass>> fDrawPasses;
45     RenderPassDesc fRenderPassDesc;
46     sk_sp<TextureProxy> fTarget;
47 };
48 
49 } // namespace skgpu::graphite
50 
51 #endif // skgpu_graphite_RenderPassTask_DEFINED
52