8#ifndef skgpu_graphite_Context_DEFINED
9#define skgpu_graphite_Context_DEFINED
31class ClientMappedBufferManager;
36class PlotUploadTracker;
60 bool hasUnfinishedGpuWork()
const;
78 void asyncRescaleAndReadPixelsYUV420(
const SkImage*,
88 void asyncRescaleAndReadPixelsYUV420(
const SkSurface*,
98 void asyncRescaleAndReadPixelsYUVA420(
const SkImage*,
108 void asyncRescaleAndReadPixelsYUVA420(
const SkSurface*,
121 void checkAsyncWorkCompletion();
140 void freeGpuResources();
147 void performDeferredCleanup(std::chrono::milliseconds msNotUsed);
153 size_t currentBudgetedBytes()
const;
158 size_t maxBudgetedBytes()
const;
170 bool isDeviceLost()
const;
175 int maxTextureSize()
const;
180 bool supportsProtectedContent()
const;
212 struct PixelTransferResult {
213 using ConversionFn = void(
void*
dst,
const void* mappedBuffer);
224 std::function<ConversionFn> fPixelConverter;
227 SingleOwner* singleOwner()
const {
return &fSingleOwner; }
231 bool finishInitialization();
235 std::unique_ptr<Recorder> makeInternalRecorder()
const;
237 template <
typename SrcPixels>
struct AsyncParams;
239 template <
typename ReadFn,
typename... ExtraArgs>
240 void asyncRescaleAndReadImpl(ReadFn
Context::* asyncRead,
243 const AsyncParams<SkImage>&,
248 void asyncReadPixels(std::unique_ptr<Recorder>,
const AsyncParams<SkImage>&);
249 void asyncReadPixelsYUV420(std::unique_ptr<Recorder>,
250 const AsyncParams<SkImage>&,
255 void asyncReadTexture(std::unique_ptr<Recorder>,
256 const AsyncParams<TextureProxy>&,
262 PixelTransferResult transferPixels(
Recorder*,
263 const TextureProxy* srcProxy,
270 void finalizeAsyncReadPixels(std::unique_ptr<Recorder>,
276 std::unique_ptr<ResourceProvider> fResourceProvider;
277 std::unique_ptr<QueueManager> fQueueManager;
278 std::unique_ptr<ClientMappedBufferManager> fMappedBufferManager;
284#if defined(GRAPHITE_TEST_UTILS)
286 bool fStoreContextRefInRecorder =
false;
289 std::vector<Recorder*> fTrackedRecorders;
293 const ContextID fContextID;
static constexpr uint32_t SK_InvalidUniqueID
void(ReadPixelsContext, std::unique_ptr< const AsyncReadResult >) ReadPixelsCallback
bool operator!=(const ContextID &that) const
bool operator==(const ContextID &that) const
ContextID contextID() const
Context & operator=(Context &&)=delete
Context(Context &&)=delete
Context & operator=(const Context &)=delete
Context(const Context &)=delete
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
FlPixelBufferTexturePrivate * priv
sk_sp< const SkImage > image