• 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_TaskGraph_DEFINED
9 #define skgpu_graphite_TaskGraph_DEFINED
10 
11 #include <vector>
12 #include "src/gpu/graphite/Task.h"
13 
14 namespace skgpu::graphite {
15 class CommandBuffer;
16 class Context;
17 class ResourceProvider;
18 
19 class TaskGraph {
20 public:
21     TaskGraph();
22     ~TaskGraph();
23 
24     void add(sk_sp<Task>);
25     void prepend(sk_sp<Task>);
26 
27     // Returns true on success; false on failure
28     bool prepareResources(ResourceProvider*, const RuntimeEffectDictionary*);
29     bool addCommands(Context*, CommandBuffer*, Task::ReplayTargetData);
30 
31     void reset();
32 
33 #ifdef GRAPHITE_TEST_UTILS
hasTasks()34     bool hasTasks() const { return !fTasks.empty(); }
35 #endif
36 
37 protected:
38 private:
39     std::vector<sk_sp<Task>> fTasks;
40 };
41 
42 } // namespace skgpu::graphite
43 
44 #endif // skgpu_graphite_TaskGraph_DEFINED
45