• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 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_RecordingPriv_DEFINED
9 #define skgpu_graphite_RecordingPriv_DEFINED
10 
11 #include "include/gpu/graphite/Recording.h"
12 
13 namespace skgpu::graphite {
14 
15 class Context;
16 class Task;
17 class Surface;
18 
19 class RecordingPriv {
20 public:
21     bool hasVolatileLazyProxies() const;
22     bool instantiateVolatileLazyProxies(ResourceProvider*);
23     void deinstantiateVolatileLazyProxies();
24 
25     bool hasNonVolatileLazyProxies() const;
26     bool instantiateNonVolatileLazyProxies(ResourceProvider*);
27 
28     void setFailureResultForFinishedProcs();
29 
30     bool addCommands(Context*, CommandBuffer*, Surface* targetSurface, SkIVector targetTranslation);
31     // This will eventually lead to adding a Usage Ref on the CommandBuffer. For now that is fine
32     // since the only Resource's we are reffing here are Buffers. However, if we ever want to track
33     // Textures or GPU only Buffers as well, we should keep a second list for Refs that we want to
34     // put CommandBuffer refs on.
35     void addResourceRef(sk_sp<Resource> resource);
36     void addTask(sk_sp<Task> task);
37     void addTasks(TaskList&& tasks);
38 
recorderID()39     uint32_t recorderID() const { return fRecording->fRecorderID; }
uniqueID()40     uint32_t uniqueID() const { return fRecording->fUniqueID; }
41 
42 #if defined(GRAPHITE_TEST_UTILS)
43     bool isTargetProxyInstantiated() const;
44     int numVolatilePromiseImages() const;
45     int numNonVolatilePromiseImages() const;
46     bool hasTasks() const;
47 #endif
48 
49 private:
RecordingPriv(Recording * recorder)50     explicit RecordingPriv(Recording* recorder) : fRecording(recorder) {}
51     RecordingPriv& operator=(const RecordingPriv&) = delete;
52 
53     // No taking addresses of this type.
54     const RecordingPriv* operator&() const = delete;
55     RecordingPriv* operator&() = delete;
56 
57     Recording* fRecording;
58 
59     friend class Recording;  // to construct/copy this type.
60 };
61 
priv()62 inline RecordingPriv Recording::priv() {
63     return RecordingPriv(this);
64 }
65 
66 } // namespace skgpu::graphite
67 
68 #endif // skgpu_graphite_RecordingPriv_DEFINED
69