• 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_task_RenderPassTask_DEFINED
9 #define skgpu_graphite_task_RenderPassTask_DEFINED
10 
11 #include "src/gpu/graphite/CommandBuffer.h"
12 #include "src/gpu/graphite/RenderPassDesc.h"
13 #include "src/gpu/graphite/task/Task.h"
14 
15 namespace skgpu::graphite {
16 
17 class DrawPass;
18 
19 /**
20  * RenderPassTask handles preparing and recording DrawLists into a single render pass within a
21  * command buffer. If the backend supports subpasses, and the DrawLists/surfaces are compatible, a
22  * RenderPassTask can execute multiple DrawLists across different surfaces as subpasses nested
23  * within a single render pass. If there is no such support, a RenderPassTask is one-to-one with a
24  * "render pass" to specific surface.
25  */
26 class RenderPassTask final : public Task {
27 public:
28     using DrawPassList = skia_private::STArray<1, std::unique_ptr<DrawPass>>;
29 
30     static sk_sp<RenderPassTask> Make(DrawPassList,
31                                       const RenderPassDesc&,
32                                       sk_sp<TextureProxy> target);
33 
34     ~RenderPassTask() override;
35 
36     Status prepareResources(ResourceProvider*,
37                             ScratchResourceManager*,
38                             const RuntimeEffectDictionary*) override;
39 
40     Status addCommands(Context*, CommandBuffer*, ReplayTargetData) override;
41 
42 private:
43     RenderPassTask(DrawPassList, const RenderPassDesc&, sk_sp<TextureProxy> target);
44 
45     DrawPassList fDrawPasses;
46     RenderPassDesc fRenderPassDesc;
47     sk_sp<TextureProxy> fTarget;
48 };
49 
50 } // namespace skgpu::graphite
51 
52 #endif // skgpu_graphite_task_RenderPassTask_DEFINED
53