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 TextureProxy* deferredTargetProxy(); 22 const Texture* setupDeferredTarget(ResourceProvider*, 23 Surface* targetSurface, 24 SkIVector targetTranslation, 25 SkIRect targetClip); 26 27 bool hasVolatileLazyProxies() const; 28 bool instantiateVolatileLazyProxies(ResourceProvider*); 29 void deinstantiateVolatileLazyProxies(); 30 31 bool hasNonVolatileLazyProxies() const; 32 bool instantiateNonVolatileLazyProxies(ResourceProvider*); 33 34 void setFailureResultForFinishedProcs(); 35 36 bool addCommands(Context*, 37 CommandBuffer*, 38 const Texture* replayTarget, 39 SkIVector targetTranslation, 40 SkIRect targetClip); 41 // This will eventually lead to adding a Usage Ref on the CommandBuffer. For now that is fine 42 // since the only Resource's we are reffing here are Buffers. However, if we ever want to track 43 // Textures or GPU only Buffers as well, we should keep a second list for Refs that we want to 44 // put CommandBuffer refs on. 45 void addResourceRef(sk_sp<Resource> resource); 46 taskList()47 TaskList* taskList() { return fRecording->fRootTaskList.get(); } 48 recorderID()49 uint32_t recorderID() const { return fRecording->fRecorderID; } uniqueID()50 uint32_t uniqueID() const { return fRecording->fUniqueID; } 51 52 #if defined(GPU_TEST_UTILS) 53 bool isTargetProxyInstantiated() const; 54 int numVolatilePromiseImages() const; 55 int numNonVolatilePromiseImages() const; 56 bool hasTasks() const; 57 #endif 58 59 private: RecordingPriv(Recording * recorder)60 explicit RecordingPriv(Recording* recorder) : fRecording(recorder) {} 61 RecordingPriv& operator=(const RecordingPriv&) = delete; 62 63 // No taking addresses of this type. 64 const RecordingPriv* operator&() const = delete; 65 RecordingPriv* operator&() = delete; 66 67 Recording* fRecording; 68 69 friend class Recording; // to construct/copy this type. 70 }; 71 priv()72inline RecordingPriv Recording::priv() { 73 return RecordingPriv(this); 74 } 75 76 } // namespace skgpu::graphite 77 78 #endif // skgpu_graphite_RecordingPriv_DEFINED 79