• 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_DEFINED
9 #define skgpu_graphite_Task_DEFINED
10 
11 #include "include/core/SkPoint.h"
12 #include "include/core/SkRefCnt.h"
13 
14 namespace skgpu::graphite {
15 
16 class CommandBuffer;
17 class Context;
18 class ResourceProvider;
19 class RuntimeEffectDictionary;
20 class Texture;
21 
22 class Task : public SkRefCnt {
23 public:
24     ~Task() override;
25 
26     // Holds a render target and translation to use in the task's work, if necessary.
27     struct ReplayTargetData {
28         const Texture* fTarget;
29         SkIVector fTranslation;
30     };
31 
32     // Instantiate and prepare any Resources that must happen while the Task is still on the
33     // Recorder.
34     virtual bool prepareResources(ResourceProvider*, const RuntimeEffectDictionary*) = 0;
35 
36     // Returns true on success; false on failure.
37     virtual bool addCommands(Context*, CommandBuffer*, ReplayTargetData) = 0;
38 
39 protected:
40     Task();
41 
42 private:
43 };
44 
45 } // namespace skgpu::graphite
46 
47 #endif // skgpu_graphite_Task_DEFINED
48