Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
skgpu::graphite::RecordingPriv Class Reference

#include <RecordingPriv.h>

Public Member Functions

bool hasVolatileLazyProxies () const
 
bool instantiateVolatileLazyProxies (ResourceProvider *)
 
void deinstantiateVolatileLazyProxies ()
 
bool hasNonVolatileLazyProxies () const
 
bool instantiateNonVolatileLazyProxies (ResourceProvider *)
 
void setFailureResultForFinishedProcs ()
 
bool addCommands (Context *, CommandBuffer *, Surface *targetSurface, SkIVector targetTranslation)
 
void addResourceRef (sk_sp< Resource > resource)
 
void addTask (sk_sp< Task > task)
 
void addTasks (TaskList &&tasks)
 
uint32_t recorderID () const
 
uint32_t uniqueID () const
 

Friends

class Recording
 

Detailed Description

Definition at line 19 of file RecordingPriv.h.

Member Function Documentation

◆ addCommands()

bool skgpu::graphite::RecordingPriv::addCommands ( Context context,
CommandBuffer commandBuffer,
Surface targetSurface,
SkIVector  targetTranslation 
)

Definition at line 124 of file Recording.cpp.

127 {
128 AutoDeinstantiateTextureProxy autoDeinstantiateTargetProxy(
129 fRecording->fTargetProxyData ? fRecording->fTargetProxyData->lazyProxy() : nullptr);
130
131 const Texture* replayTarget = nullptr;
132 ResourceProvider* resourceProvider = context->priv().resourceProvider();
133 SkASSERT(!SkToBool(fRecording->fTargetProxyData) || SkToBool(targetSurface));
134 if (fRecording->fTargetProxyData) {
135 if (!targetSurface) {
136 SKGPU_LOG_E("No surface provided to instantiate target texture proxy.");
137 return false;
138 }
139 TextureProxy* surfaceTexture = targetSurface->backingTextureProxy();
140 if (!surfaceTexture->instantiate(resourceProvider)) {
141 SKGPU_LOG_E("Could not instantiate target texture proxy.");
142 return false;
143 }
144 if (!fRecording->fTargetProxyData->lazyInstantiate(resourceProvider,
145 surfaceTexture->refTexture())) {
146 SKGPU_LOG_E("Could not instantiate deferred texture proxy.");
147 return false;
148 }
149 replayTarget = surfaceTexture->texture();
150 }
151
152 for (size_t i = 0; i < fRecording->fExtraResourceRefs.size(); ++i) {
153 commandBuffer->trackResource(fRecording->fExtraResourceRefs[i]);
154 }
155
156 // There's no need to differentiate kSuccess and kDiscard at the root list level; if every task
157 // is discarded, the Recording will automatically be a no-op on replay while still correctly
158 // notifying any finish procs the client may have added.
159 if (fRecording->fRootTaskList->addCommands(
160 context, commandBuffer, {replayTarget, targetTranslation}) == Task::Status::kFail) {
161 return false;
162 }
163 for (int i = 0; i < fRecording->fFinishedProcs.size(); ++i) {
164 commandBuffer->addFinishedProc(std::move(fRecording->fFinishedProcs[i]));
165 }
166 fRecording->fFinishedProcs.clear();
167
168 return true;
169}
#define SKGPU_LOG_E(fmt,...)
Definition: Log.h:38
#define SkASSERT(cond)
Definition: SkAssert.h:116
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35

◆ addResourceRef()

void skgpu::graphite::RecordingPriv::addResourceRef ( sk_sp< Resource resource)

Definition at line 171 of file Recording.cpp.

171 {
172 fRecording->fExtraResourceRefs.push_back(std::move(resource));
173}
static SkString resource(SkPDFResourceType type, int index)

◆ addTask()

void skgpu::graphite::RecordingPriv::addTask ( sk_sp< Task task)

Definition at line 175 of file Recording.cpp.

175 {
176 fRecording->fRootTaskList->add(std::move(task));
177}

◆ addTasks()

void skgpu::graphite::RecordingPriv::addTasks ( TaskList &&  tasks)

Definition at line 179 of file Recording.cpp.

179 {
180 fRecording->fRootTaskList->add(std::move(tasks));
181}

◆ deinstantiateVolatileLazyProxies()

void skgpu::graphite::RecordingPriv::deinstantiateVolatileLazyProxies ( )

Definition at line 106 of file Recording.cpp.

106 {
107 if (!this->hasVolatileLazyProxies()) {
108 return;
109 }
110
111 for (const auto& proxy : fRecording->fVolatileLazyProxies) {
112 SkASSERT(proxy->isVolatile());
113 proxy->deinstantiate();
114 }
115}
bool hasVolatileLazyProxies() const
Definition: Recording.cpp:90

◆ hasNonVolatileLazyProxies()

bool skgpu::graphite::RecordingPriv::hasNonVolatileLazyProxies ( ) const

Definition at line 71 of file Recording.cpp.

71 {
72 return !fRecording->fNonVolatileLazyProxies.empty();
73}

◆ hasVolatileLazyProxies()

bool skgpu::graphite::RecordingPriv::hasVolatileLazyProxies ( ) const

Definition at line 90 of file Recording.cpp.

90 {
91 return !fRecording->fVolatileLazyProxies.empty();
92}

◆ instantiateNonVolatileLazyProxies()

bool skgpu::graphite::RecordingPriv::instantiateNonVolatileLazyProxies ( ResourceProvider resourceProvider)

Definition at line 75 of file Recording.cpp.

75 {
77
78 for (const auto& proxy : fRecording->fNonVolatileLazyProxies) {
79 if (!proxy->lazyInstantiate(resourceProvider)) {
80 return false;
81 }
82 }
83
84 // Note: once all the lazy proxies have been instantiated, that's it - there are no more
85 // chances to instantiate.
86 fRecording->fNonVolatileLazyProxies.clear();
87 return true;
88}
bool hasNonVolatileLazyProxies() const
Definition: Recording.cpp:71

◆ instantiateVolatileLazyProxies()

bool skgpu::graphite::RecordingPriv::instantiateVolatileLazyProxies ( ResourceProvider resourceProvider)

Definition at line 94 of file Recording.cpp.

94 {
96
97 for (const auto& proxy : fRecording->fVolatileLazyProxies) {
98 if (!proxy->lazyInstantiate(resourceProvider)) {
99 return false;
100 }
101 }
102
103 return true;
104}

◆ recorderID()

uint32_t skgpu::graphite::RecordingPriv::recorderID ( ) const
inline

Definition at line 39 of file RecordingPriv.h.

39{ return fRecording->fRecorderID; }

◆ setFailureResultForFinishedProcs()

void skgpu::graphite::RecordingPriv::setFailureResultForFinishedProcs ( )

Definition at line 117 of file Recording.cpp.

117 {
118 for (int i = 0; i < fRecording->fFinishedProcs.size(); ++i) {
119 fRecording->fFinishedProcs[i]->setFailureResult();
120 }
121 fRecording->fFinishedProcs.clear();
122}

◆ uniqueID()

uint32_t skgpu::graphite::RecordingPriv::uniqueID ( ) const
inline

Definition at line 40 of file RecordingPriv.h.

40{ return fRecording->fUniqueID; }

Friends And Related Function Documentation

◆ Recording

friend class Recording
friend

Definition at line 59 of file RecordingPriv.h.


The documentation for this class was generated from the following files: