8#ifndef GrDirectContext_DEFINED
9#define GrDirectContext_DEFINED
48 class MutableTextureState;
49#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
50 namespace ganesh {
class SmallPathAtlasMgr; }
54namespace wgpu {
class Device; }
95 void resetGLTextureBindings();
166 void releaseResourcesAndAbandonContext();
178 void getResourceCacheLimits(
int* maxResources,
size_t* maxResourceBytes)
const;
183 size_t getResourceCacheLimit()
const;
193 void getResourceCacheUsage(
int* resourceCount,
size_t* resourceBytes)
const;
198 size_t getResourceCachePurgeableBytes()
const;
208 void setResourceCacheLimits(
int maxResources,
size_t maxResourceBytes);
217 void setResourceCacheLimit(
size_t maxResourceBytes);
223 void freeGpuResources();
238 void performDeferredCleanup(
239 std::chrono::milliseconds msNotUsed,
244 this->performDeferredCleanup(msNotUsed);
257 void purgeUnlockedResources(
size_t bytesToPurge,
bool preferScratchResources);
325 bool deleteSemaphoresAfterWait =
true);
490 void checkAsyncWorkCompletion();
496 bool supportsDistanceFieldText()
const;
498 void storeVkPipelineCacheData();
536 std::string_view label = {});
552 std::string_view label = {});
572 std::string_view label = {});
594 std::string_view label = {});
622 std::string_view label = {});
633 std::string_view label = {});
642 std::string_view label = {});
649 std::string_view label = {});
715 return this->updateBackendTexture(
texture,
881#ifdef SK_ENABLE_DUMP_GPU
914 bool init()
override;
917#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
935 void syncAllOutstandingGpuWork(
bool shouldExecuteWhileAbandoned);
941 class DeleteCallbackHelper {
947 ~DeleteCallbackHelper() {
957 std::unique_ptr<DeleteCallbackHelper> fDeleteCallbackHelper;
959 const DirectContextID fDirectContextID;
964 std::unique_ptr<SkTaskGroup> fTaskGroup;
965 std::unique_ptr<sktext::gpu::StrikeCache> fStrikeCache;
966 std::unique_ptr<GrGpu> fGpu;
967 std::unique_ptr<GrResourceCache> fResourceCache;
968 std::unique_ptr<GrResourceProvider> fResourceProvider;
974 int fInsideReleaseProcCnt = 0;
976 bool fDidTestPMConversions;
978 bool fPMUPMConversionsRoundTrip;
982 std::unique_ptr<GrClientMappedBufferManager> fMappedBufferManager;
983 std::unique_ptr<GrAtlasManager> fAtlasManager;
985#if !defined(SK_ENABLE_OPTIMIZE_SIZE)
986 std::unique_ptr<skgpu::ganesh::SmallPathAtlasMgr> fSmallPathAtlasMgr;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kTopLeft_GrSurfaceOrigin
static const uint32_t kAll_GrBackendState
void * GrDirectContextDestroyedContext
void * GrGpuFinishedContext
void(* GrDirectContextDestroyedProc)(GrDirectContextDestroyedContext destroyedContext)
void(* GrGpuFinishedProc)(GrGpuFinishedContext finishedContext)
static constexpr uint32_t SK_InvalidUniqueID
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
sk_sp< GrContextThreadSafeProxy > threadSafeProxy()
SK_API GrBackendFormat defaultBackendFormat(SkColorType, GrRenderable) const
SK_API GrBackendFormat compressedBackendFormat(SkTextureCompressionType) const
bool operator!=(const DirectContextID &that) const
bool operator==(const DirectContextID &that) const
void purgeResourcesNotUsedInMs(std::chrono::milliseconds msNotUsed)
GrDirectContext * asDirectContext() override
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
bool updateBackendTexture(const GrBackendTexture &texture, const SkPixmap &srcData, GrSurfaceOrigin textureOrigin=kTopLeft_GrSurfaceOrigin, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
DirectContextID directContextID() const
GrAtlasManager * onGetAtlasManager()
GrRecordingContextPriv priv()
bool abandoned() override
SK_API bool colorTypeSupportedAsSurface(SkColorType colorType) const
SK_API bool colorTypeSupportedAsImage(SkColorType) const
SK_API int maxSurfaceSampleCountForColorType(SkColorType colorType) const
SK_API int maxTextureSize() const
SK_API bool supportsProtectedContent() const
SK_API int maxRenderTargetSize() const
void abandonContext() override
sk_sp< const SkImage > image
std::shared_ptr< const fml::Mapping > data