• 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_Recorder_DEFINED
9 #define skgpu_Recorder_DEFINED
10 
11 #include "experimental/graphite/src/TaskGraph.h"
12 #include "include/core/SkRefCnt.h"
13 
14 namespace skgpu {
15 
16 class Context;
17 class DrawBufferManager;
18 class ProgramCache;
19 class Recording;
20 class UniformCache;
21 
22 class Recorder final : public SkRefCnt {
23 public:
24     Recorder(sk_sp<Context>);
25     ~Recorder() override;
26 
27     void add(sk_sp<Task>);
28 
29     Context* context() const;
30     ProgramCache* programCache();
31     UniformCache* uniformCache();
32     DrawBufferManager* drawBufferManager();
33 
34     std::unique_ptr<Recording> snap();
35 
36 protected:
37 private:
38     sk_sp<Context> fContext;
39     TaskGraph fGraph;
40     std::unique_ptr<ProgramCache> fProgramCache;
41     std::unique_ptr<UniformCache> fUniformCache;
42     std::unique_ptr<DrawBufferManager> fDrawBufferManager;
43 };
44 
45 } // namespace skgpu
46 
47 #endif // skgpu_Recorder_DEFINED
48