Skia
2D Graphics Library
GrDirectContext.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Google Inc.
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 GrDirectContext_DEFINED
9 #define GrDirectContext_DEFINED
10 
12 
14 
15 // We shouldn't need this but currently Android is relying on this being include transitively.
17 
18 class GrAtlasManager;
19 class GrBackendSemaphore;
20 class GrClientMappedBufferManager;
21 class GrDirectContextPriv;
23 struct GrD3DBackendContext;
24 class GrFragmentProcessor;
25 class GrGpu;
26 struct GrGLInterface;
27 struct GrMtlBackendContext;
28 struct GrMockOptions;
29 class GrPath;
30 class GrResourceCache;
31 class GrSmallPathAtlasMgr;
32 class GrSurfaceDrawContext;
33 class GrResourceProvider;
34 class GrStrikeCache;
35 class GrSurfaceProxy;
36 class GrSwizzle;
37 class GrTextureProxy;
38 struct GrVkBackendContext;
39 
40 class SkImage;
41 class SkString;
43 class SkSurfaceProps;
44 class SkTaskGroup;
45 class SkTraceMemoryDump;
46 
48 public:
49 #ifdef SK_GL
50 
56  static sk_sp<GrDirectContext> MakeGL(const GrContextOptions&);
57  static sk_sp<GrDirectContext> MakeGL();
58 #endif
59 
60 #ifdef SK_VULKAN
61 
68  static sk_sp<GrDirectContext> MakeVulkan(const GrVkBackendContext&, const GrContextOptions&);
69  static sk_sp<GrDirectContext> MakeVulkan(const GrVkBackendContext&);
70 #endif
71 
72 #ifdef SK_METAL
73 
80  static sk_sp<GrDirectContext> MakeMetal(const GrMtlBackendContext&, const GrContextOptions&);
81  static sk_sp<GrDirectContext> MakeMetal(const GrMtlBackendContext&);
90  static sk_sp<GrDirectContext> MakeMetal(void* device, void* queue, const GrContextOptions&);
91  static sk_sp<GrDirectContext> MakeMetal(void* device, void* queue);
92 #endif
93 
94 #ifdef SK_DIRECT3D
95 
99  static sk_sp<GrDirectContext> MakeDirect3D(const GrD3DBackendContext&, const GrContextOptions&);
100  static sk_sp<GrDirectContext> MakeDirect3D(const GrD3DBackendContext&);
101 #endif
102 
103 #ifdef SK_DAWN
104  static sk_sp<GrDirectContext> MakeDawn(const wgpu::Device&,
105  const GrContextOptions&);
106  static sk_sp<GrDirectContext> MakeDawn(const wgpu::Device&);
107 #endif
108 
109  static sk_sp<GrDirectContext> MakeMock(const GrMockOptions*, const GrContextOptions&);
110  static sk_sp<GrDirectContext> MakeMock(const GrMockOptions*);
111 
112  ~GrDirectContext() override;
113 
122  void resetContext(uint32_t state = kAll_GrBackendState);
123 
134 
152  void abandonContext() override;
153 
160  bool abandoned() override;
161 
162  // TODO: Remove this from public after migrating Chrome.
164 
180  bool oomed();
181 
195 
197  // Resource Cache
198 
206  void getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) const;
207 
211  size_t getResourceCacheLimit() const;
212 
221  void getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const;
222 
227 
236  void setResourceCacheLimits(int maxResources, size_t maxResourceBytes);
237 
245  void setResourceCacheLimit(size_t maxResourceBytes);
246 
252 
257  void performDeferredCleanup(std::chrono::milliseconds msNotUsed);
258 
259  // Temporary compatibility API for Android.
260  void purgeResourcesNotUsedInMs(std::chrono::milliseconds msNotUsed) {
261  this->performDeferredCleanup(msNotUsed);
262  }
263 
274  void purgeUnlockedResources(size_t bytesToPurge, bool preferScratchResources);
275 
289  void purgeUnlockedResources(bool scratchResourcesOnly);
290 
295 
300 
305 
311 
318 
320  // Misc.
321 
333  bool wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores,
334  bool deleteSemaphoresAfterWait = true);
335 
341  void flushAndSubmit(bool syncCpu = false) {
342  this->flush(GrFlushInfo());
343  this->submit(syncCpu);
344  }
345 
371 
372  void flush() { this->flush({}); }
373 
388  bool submit(bool syncCpu = false);
389 
394 
396  // Chrome is using this!
397  void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
398 
400 
402 
411 
433  GrBackendTexture createBackendTexture(int width, int height,
434  const GrBackendFormat&,
435  GrMipmapped,
436  GrRenderable,
438 
447  GrBackendTexture createBackendTexture(int width, int height,
448  SkColorType,
449  GrMipmapped,
450  GrRenderable,
452 
462  GrBackendTexture createBackendTexture(int width, int height,
463  const GrBackendFormat&,
464  const SkColor4f& color,
465  GrMipmapped,
466  GrRenderable,
468  GrGpuFinishedProc finishedProc = nullptr,
469  GrGpuFinishedContext finishedContext = nullptr);
470 
482  GrBackendTexture createBackendTexture(int width, int height,
483  SkColorType,
484  const SkColor4f& color,
485  GrMipmapped,
486  GrRenderable,
488  GrGpuFinishedProc finishedProc = nullptr,
489  GrGpuFinishedContext finishedContext = nullptr);
490 
511  int numLevels,
513  GrRenderable,
514  GrProtected,
515  GrGpuFinishedProc finishedProc = nullptr,
516  GrGpuFinishedContext finishedContext = nullptr);
517 
522  GrSurfaceOrigin textureOrigin,
523  GrRenderable renderable,
524  GrProtected isProtected,
525  GrGpuFinishedProc finishedProc = nullptr,
526  GrGpuFinishedContext finishedContext = nullptr) {
527  return this->createBackendTexture(&srcData, 1, textureOrigin, renderable, isProtected,
528  finishedProc, finishedContext);
529  }
530 
531  // Deprecated versions that do not take origin and assume top-left.
533  int numLevels,
534  GrRenderable renderable,
535  GrProtected isProtected,
536  GrGpuFinishedProc finishedProc = nullptr,
537  GrGpuFinishedContext finishedContext = nullptr) {
538  return this->createBackendTexture(srcData,
539  numLevels,
541  renderable,
542  isProtected,
543  finishedProc,
544  finishedContext);
545  }
547  GrRenderable renderable,
548  GrProtected isProtected,
549  GrGpuFinishedProc finishedProc = nullptr,
550  GrGpuFinishedContext finishedContext = nullptr) {
551  return this->createBackendTexture(&srcData,
552  1,
553  renderable,
554  isProtected,
555  finishedProc,
556  finishedContext);
557  }
558 
569  const SkColor4f& color,
570  GrGpuFinishedProc finishedProc,
571  GrGpuFinishedContext finishedContext);
572 
585  SkColorType skColorType,
586  const SkColor4f& color,
587  GrGpuFinishedProc finishedProc,
588  GrGpuFinishedContext finishedContext);
589 
609  const SkPixmap srcData[],
610  int numLevels,
612  GrGpuFinishedProc finishedProc = nullptr,
613  GrGpuFinishedContext finishedContext = nullptr);
614 
619  const SkPixmap& srcData,
621  GrGpuFinishedProc finishedProc = nullptr,
622  GrGpuFinishedContext finishedContext = nullptr) {
623  return this->updateBackendTexture(texture,
624  &srcData,
625  1,
626  textureOrigin,
627  finishedProc,
628  finishedContext);
629  }
630 
631  // Deprecated version that does not take origin and assumes top-left.
633  const SkPixmap srcData[],
634  int numLevels,
635  GrGpuFinishedProc finishedProc,
636  GrGpuFinishedContext finishedContext) {
637  return this->updateBackendTexture(texture,
638  srcData,
639  numLevels,
641  finishedProc,
642  finishedContext);
643  }
644 
651  using GrRecordingContext::compressedBackendFormat;
652 
663  const GrBackendFormat&,
664  const SkColor4f& color,
665  GrMipmapped,
667  GrGpuFinishedProc finishedProc = nullptr,
668  GrGpuFinishedContext finishedContext = nullptr);
669 
672  const SkColor4f& color,
673  GrMipmapped,
675  GrGpuFinishedProc finishedProc = nullptr,
676  GrGpuFinishedContext finishedContext = nullptr);
677 
691  const GrBackendFormat&,
692  const void* data, size_t dataSize,
693  GrMipmapped,
695  GrGpuFinishedProc finishedProc = nullptr,
696  GrGpuFinishedContext finishedContext = nullptr);
697 
700  const void* data, size_t dataSize,
701  GrMipmapped,
703  GrGpuFinishedProc finishedProc = nullptr,
704  GrGpuFinishedContext finishedContext = nullptr);
705 
717  const SkColor4f& color,
718  GrGpuFinishedProc finishedProc,
719  GrGpuFinishedContext finishedContext);
720 
734  const void* data,
735  size_t dataSize,
736  GrGpuFinishedProc finishedProc,
737  GrGpuFinishedContext finishedContext);
738 
759  GrBackendSurfaceMutableState* previousState = nullptr,
760  GrGpuFinishedProc finishedProc = nullptr,
761  GrGpuFinishedContext finishedContext = nullptr);
764  GrBackendSurfaceMutableState* previousState = nullptr,
765  GrGpuFinishedProc finishedProc = nullptr,
766  GrGpuFinishedContext finishedContext = nullptr);
767 
769 
770  // This interface allows clients to pre-compile shaders and populate the runtime program cache.
771  // The key and data blobs should be the ones passed to the PersistentCache, in SkSL format.
772  //
773  // Steps to use this API:
774  //
775  // 1) Create a GrDirectContext as normal, but set fPersistentCache on GrContextOptions to
776  // something that will save the cached shader blobs. Set fShaderCacheStrategy to kSkSL. This
777  // will ensure that the blobs are SkSL, and are suitable for pre-compilation.
778  // 2) Run your application, and save all of the key/data pairs that are fed to the cache.
779  //
780  // 3) Switch over to shipping your application. Include the key/data pairs from above.
781  // 4) At startup (or any convenient time), call precompileShader for each key/data pair.
782  // This will compile the SkSL to create a GL program, and populate the runtime cache.
783  //
784  // This is only guaranteed to work if the context/device used in step #2 are created in the
785  // same way as the one used in step #4, and the same GrContextOptions are specified.
786  // Using cached shader blobs on a different device or driver are undefined.
787  bool precompileShader(const SkData& key, const SkData& data);
788 
789 #ifdef SK_ENABLE_DUMP_GPU
790 
791  SkString dump() const;
792 #endif
793 
794  // Provides access to functions that aren't part of the public API.
795  GrDirectContextPriv priv();
796  const GrDirectContextPriv priv() const; // NOLINT(readability-const-return-type)
797 
798 protected:
800 
801  bool init() override;
802 
803  GrAtlasManager* onGetAtlasManager() { return fAtlasManager.get(); }
804  GrSmallPathAtlasMgr* onGetSmallPathAtlasMgr();
805 
806  GrDirectContext* asDirectContext() override { return this; }
807 
808 private:
809  // This call will make sure out work on the GPU is finished and will execute any outstanding
810  // asynchronous work (e.g. calling finished procs, freeing resources, etc.) related to the
811  // outstanding work on the gpu. The main use currently for this function is when tearing down or
812  // abandoning the context.
813  //
814  // When we finish up work on the GPU it could trigger callbacks to the client. In the case we
815  // are abandoning the context we don't want the client to be able to use the GrDirectContext to
816  // issue more commands during the callback. Thus before calling this function we set the
817  // GrDirectContext's state to be abandoned. However, we need to be able to get by the abaonded
818  // check in the call to know that it is safe to execute this. The shouldExecuteWhileAbandoned
819  // bool is used for this signal.
820  void syncAllOutstandingGpuWork(bool shouldExecuteWhileAbandoned);
821 
822  // fTaskGroup must appear before anything that uses it (e.g. fGpu), so that it is destroyed
823  // after all of its users. Clients of fTaskGroup will generally want to ensure that they call
824  // wait() on it as they are being destroyed, to avoid the possibility of pending tasks being
825  // invoked after objects they depend upon have already been destroyed.
826  std::unique_ptr<SkTaskGroup> fTaskGroup;
827  std::unique_ptr<GrStrikeCache> fStrikeCache;
828  sk_sp<GrGpu> fGpu;
829  std::unique_ptr<GrResourceCache> fResourceCache;
830  std::unique_ptr<GrResourceProvider> fResourceProvider;
831 
832  bool fDidTestPMConversions;
833  // true if the PM/UPM conversion succeeded; false otherwise
834  bool fPMUPMConversionsRoundTrip;
835 
836  GrContextOptions::PersistentCache* fPersistentCache;
837  GrContextOptions::ShaderErrorHandler* fShaderErrorHandler;
838 
839  std::unique_ptr<GrClientMappedBufferManager> fMappedBufferManager;
840  std::unique_ptr<GrAtlasManager> fAtlasManager;
841 
842  std::unique_ptr<GrSmallPathAtlasMgr> fSmallPathAtlasMgr;
843 
844  friend class GrDirectContextPriv;
845 
847 };
848 
849 
850 #endif
GrRecordingContext
Definition: GrRecordingContext.h:35
GrDirectContext::createBackendTexture
GrBackendTexture createBackendTexture(int width, int height, SkColorType, GrMipmapped, GrRenderable, GrProtected=GrProtected::kNo)
If possible, create an uninitialized backend texture.
GrDirectContext::MakeMock
static sk_sp< GrDirectContext > MakeMock(const GrMockOptions *, const GrContextOptions &)
GrRecordingContext::maxSurfaceSampleCountForColorType
SK_API int maxSurfaceSampleCountForColorType(SkColorType) const
Gets the maximum supported sample count for a color type.
GrRecordingContext::defaultBackendFormat
SK_API GrBackendFormat defaultBackendFormat(SkColorType ct, GrRenderable renderable) const
Definition: GrRecordingContext.h:39
GrDirectContext::resetGLTextureBindings
void resetGLTextureBindings()
If the backend is GrBackendApi::kOpenGL, then all texture unit/target combinations for which the cont...
GrSemaphoresSubmitted
GrSemaphoresSubmitted
Enum used as return value when flush with semaphores so the client knows whether the valid semaphores...
Definition: GrTypes.h:284
SkImage
Definition: SkImage.h:61
GrDirectContext::getResourceCachePurgeableBytes
size_t getResourceCachePurgeableBytes() const
Gets the number of bytes in the cache consumed by purgeable (e.g.
GrContextOptions
Definition: GrContextOptions.h:314
SkTraceMemoryDump
Interface for memory tracing.
Definition: SkTraceMemoryDump.h:20
GrDirectContext::checkAsyncWorkCompletion
void checkAsyncWorkCompletion()
Checks whether any asynchronous work is complete and if so calls related callbacks.
GrDirectContext::getResourceCacheLimit
size_t getResourceCacheLimit() const
Return the current GPU resource cache limit in bytes.
GrDirectContext::createBackendTexture
GrBackendTexture createBackendTexture(int width, int height, const GrBackendFormat &, const SkColor4f &color, GrMipmapped, GrRenderable, GrProtected=GrProtected::kNo, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
If possible, create a backend texture initialized to a particular color.
GrDirectContext::getResourceCacheUsage
void getResourceCacheUsage(int *resourceCount, size_t *resourceBytes) const
Gets the current GPU resource cache usage.
kTopLeft_GrSurfaceOrigin
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:199
GrDirectContext::purgeUnlockedResources
void purgeUnlockedResources(bool scratchResourcesOnly)
This entry point is intended for instances where an app has been backgrounded or suspended.
GrSurfaceOrigin
GrSurfaceOrigin
GPU SkImage and SkSurfaces can be stored such that (0, 0) in texture space may correspond to either t...
Definition: GrTypes.h:198
GrRecordingContext.h
SkColor4f
GrDirectContext::createBackendTexture
GrBackendTexture createBackendTexture(const SkPixmap &srcData, GrSurfaceOrigin textureOrigin, GrRenderable renderable, GrProtected isProtected, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
Convenience version createBackendTexture() that takes just a base level pixmap.
Definition: GrDirectContext.h:521
GrProtected
GrProtected
Definition: GrTypes.h:187
SkUnPreMultiply.h
GrRecordingContext::colorTypeSupportedAsImage
SK_API bool colorTypeSupportedAsImage(SkColorType) const
Can a SkImage be created with the given color type.
GrDirectContext::updateCompressedBackendTexture
bool updateCompressedBackendTexture(const GrBackendTexture &, const SkColor4f &color, GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
If possible, updates a backend texture filled with the provided color.
GrBackendRenderTarget
Definition: GrBackendSurface.h:61
GrDirectContext::precompileShader
bool precompileShader(const SkData &key, const SkData &data)
SkData
SkData holds an immutable data buffer.
Definition: SkData.h:22
GrDirectContext::updateCompressedBackendTexture
bool updateCompressedBackendTexture(const GrBackendTexture &, const void *data, size_t dataSize, GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
If possible, updates a backend texture filled with the provided raw data.
GrContextOptions::PersistentCache
Definition: GrContextOptions.h:315
GrRecordingContext::colorTypeSupportedAsSurface
SK_API bool colorTypeSupportedAsSurface(SkColorType colorType) const
Definition: GrRecordingContext.h:55
GrDirectContext::deleteBackendTexture
void deleteBackendTexture(GrBackendTexture)
GrDirectContext::~GrDirectContext
~GrDirectContext() override
GrDirectContext::createCompressedBackendTexture
GrBackendTexture createCompressedBackendTexture(int width, int height, SkImage::CompressionType, const SkColor4f &color, GrMipmapped, GrProtected=GrProtected::kNo, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
GrMipmapped
GrMipmapped
Used to say whether a texture has mip levels allocated or not.
Definition: GrTypes.h:169
sk_sp
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:215
GrBackendSurface.h
GrDirectContext::getResourceCacheLimits
void getResourceCacheLimits(int *maxResources, size_t *maxResourceBytes) const
DEPRECATED Return the current GPU resource cache limits.
GrDirectContext::createCompressedBackendTexture
GrBackendTexture createCompressedBackendTexture(int width, int height, const GrBackendFormat &, const void *data, size_t dataSize, GrMipmapped, GrProtected=GrProtected::kNo, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
If possible, create a backend texture initialized with the provided raw data.
GrFlushInfo
Struct to supply options to flush calls.
Definition: GrTypes.h:271
GrDirectContext::priv
const GrDirectContextPriv priv() const
GrDirectContext::createBackendTexture
GrBackendTexture createBackendTexture(int width, int height, SkColorType, const SkColor4f &color, GrMipmapped, GrRenderable, GrProtected=GrProtected::kNo, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
If possible, create a backend texture initialized to a particular color.
GrRecordingContext::GrRecordingContext
GrRecordingContext(sk_sp< GrContextThreadSafeProxy >)
GrBackendFormat
Definition: GrBackendSurface.h:48
GrDirectContext::onGetSmallPathAtlasMgr
GrSmallPathAtlasMgr * onGetSmallPathAtlasMgr()
GrDirectContext::setBackendRenderTargetState
bool setBackendRenderTargetState(const GrBackendRenderTarget &, const GrBackendSurfaceMutableState &, GrBackendSurfaceMutableState *previousState=nullptr, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
SK_API
#define SK_API
Definition: SkTypes.h:181
GrDirectContext::oomed
bool oomed()
Checks if the underlying 3D API reported an out-of-memory error.
GrDirectContext::abandonContext
void abandonContext() override
Abandons all GPU resources and assumes the underlying backend 3D API context is no longer usable.
GrDirectContext::updateBackendTexture
bool updateBackendTexture(const GrBackendTexture &, SkColorType skColorType, const SkColor4f &color, GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
If possible, updates a backend texture to be filled to a particular color.
SkSurfaceProps
Describes properties and constraints of a given SkSurface.
Definition: SkSurfaceProps.h:51
GrBackendSemaphore
Wrapper class for passing into and receiving data from Ganesh about a backend semaphore object.
Definition: GrBackendSemaphore.h:23
GrDirectContext::init
bool init() override
GrDirectContext::wait
bool wait(int numSemaphores, const GrBackendSemaphore *waitSemaphores, bool deleteSemaphoresAfterWait=true)
Inserts a list of GPU semaphores that the current GPU-backed API must wait on before executing any mo...
GrDirectContext::threadSafeProxy
sk_sp< GrContextThreadSafeProxy > threadSafeProxy()
GrRenderable
GrRenderable
Definition: GrTypes.h:179
GrDirectContext::setBackendTextureState
bool setBackendTextureState(const GrBackendTexture &, const GrBackendSurfaceMutableState &, GrBackendSurfaceMutableState *previousState=nullptr, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
Updates the state of the GrBackendTexture/RenderTarget to have the passed in GrBackendSurfaceMutableS...
GrDirectContext::createBackendTexture
GrBackendTexture createBackendTexture(int width, int height, const GrBackendFormat &, GrMipmapped, GrRenderable, GrProtected=GrProtected::kNo)
The explicitly allocated backend texture API allows clients to use Skia to create backend objects out...
GrDirectContext::updateBackendTexture
bool updateBackendTexture(const GrBackendTexture &texture, const SkPixmap srcData[], int numLevels, GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
Definition: GrDirectContext.h:632
GrDirectContext::MakeMock
static sk_sp< GrDirectContext > MakeMock(const GrMockOptions *)
GrDirectContext::createBackendTexture
GrBackendTexture createBackendTexture(const SkPixmap &srcData, GrRenderable renderable, GrProtected isProtected, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
Definition: GrDirectContext.h:546
GrDirectContext::createCompressedBackendTexture
GrBackendTexture createCompressedBackendTexture(int width, int height, SkImage::CompressionType, const void *data, size_t dataSize, GrMipmapped, GrProtected=GrProtected::kNo, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
GrDirectContext::resetContext
void resetContext(uint32_t state=kAll_GrBackendState)
The context normally assumes that no outsider is setting state within the underlying 3D API's context...
kAll_GrBackendState
static const uint32_t kAll_GrBackendState
This value translates to reseting all the context state for any backend.
Definition: GrTypes.h:228
GrDirectContext::setResourceCacheLimits
void setResourceCacheLimits(int maxResources, size_t maxResourceBytes)
DEPRECATED Specify the GPU resource cache limits.
GrBackendApi
GrBackendApi
Possible 3D APIs that may be used by Ganesh.
Definition: GrTypes.h:135
GrDirectContext::createCompressedBackendTexture
GrBackendTexture createCompressedBackendTexture(int width, int height, const GrBackendFormat &, const SkColor4f &color, GrMipmapped, GrProtected=GrProtected::kNo, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
If possible, create a compressed backend texture initialized to a particular color.
GrDirectContext::performDeferredCleanup
void performDeferredCleanup(std::chrono::milliseconds msNotUsed)
Purge GPU resources that haven't been used in the past 'msNotUsed' milliseconds or are otherwise mark...
GrDirectContext::updateBackendTexture
bool updateBackendTexture(const GrBackendTexture &, const SkColor4f &color, GrGpuFinishedProc finishedProc, GrGpuFinishedContext finishedContext)
If possible, updates a backend texture to be filled to a particular color.
GrDirectContext::dumpMemoryStatistics
void dumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump) const
Enumerates all cached GPU resources and dumps their memory to traceMemoryDump.
SkPixmap
Definition: SkPixmap.h:31
GrDirectContext
Definition: GrDirectContext.h:47
GrGpuFinishedContext
void * GrGpuFinishedContext
Definition: GrTypes.h:230
GrDirectContext::flush
GrSemaphoresSubmitted flush(const GrFlushInfo &info)
Call to ensure all drawing to the context has been flushed to underlying 3D API specific objects.
GrDirectContext::releaseResourcesAndAbandonContext
void releaseResourcesAndAbandonContext()
This is similar to abandonContext() however the underlying 3D context is not yet lost and the context...
GrDirectContext::updateBackendTexture
bool updateBackendTexture(const GrBackendTexture &, const SkPixmap srcData[], int numLevels, GrSurfaceOrigin=kTopLeft_GrSurfaceOrigin, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
If possible, updates a backend texture filled with the provided pixmap data.
GrDirectContext::supportsDistanceFieldText
bool supportsDistanceFieldText() const
GrDirectContext::freeGpuResources
void freeGpuResources()
Frees GPU created by the context.
GrDirectContext::purgeResourcesNotUsedInMs
void purgeResourcesNotUsedInMs(std::chrono::milliseconds msNotUsed)
Definition: GrDirectContext.h:260
SkSurfaceCharacterization
Definition: SkSurfaceCharacterization.h:207
GrDirectContext::onGetAtlasManager
GrAtlasManager * onGetAtlasManager()
Definition: GrDirectContext.h:803
SkString
Definition: SkString.h:116
GrBackendTexture
Definition: GrBackendSurface.h:54
GrDirectContext::asDirectContext
GrDirectContext * asDirectContext() override
Definition: GrDirectContext.h:806
GrDirectContext::updateBackendTexture
bool updateBackendTexture(const GrBackendTexture &texture, const SkPixmap &srcData, GrSurfaceOrigin textureOrigin=kTopLeft_GrSurfaceOrigin, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
Convenience version of updateBackendTexture that takes just a base level pixmap.
Definition: GrDirectContext.h:618
GrProtected::kNo
@ kNo
GrContextThreadSafeProxy
Definition: GrContextThreadSafeProxy.h:145
GrRecordingContext::maxRenderTargetSize
SK_API int maxRenderTargetSize() const
Gets the maximum supported render target size.
GrRecordingContext::maxTextureSize
SK_API int maxTextureSize() const
Gets the maximum supported texture size.
GrDirectContext::submit
bool submit(bool syncCpu=false)
Submit outstanding work to the gpu from all previously un-submitted flushes.
GrBackendSurfaceMutableState
Since Skia and clients can both modify gpu textures and their connected state, Skia needs a way for c...
Definition: GrBackendSurfaceMutableState.h:27
SkColorType
SkColorType
Definition: SkImageInfo.h:64
GrDirectContext::purgeUnlockedResources
void purgeUnlockedResources(size_t bytesToPurge, bool preferScratchResources)
Purge unlocked resources from the cache until the the provided byte count has been reached or we have...
GrGpuFinishedProc
void(* GrGpuFinishedProc)(GrGpuFinishedContext finishedContext)
Definition: GrTypes.h:231
GrDirectContext::storeVkPipelineCacheData
void storeVkPipelineCacheData()
GrDirectContext::GrDirectContext
GrDirectContext(GrBackendApi backend, const GrContextOptions &options)
GrDirectContext::flushAndSubmit
void flushAndSubmit(bool syncCpu=false)
Call to ensure all drawing to the context has been flushed and submitted to the underlying 3D API.
Definition: GrDirectContext.h:341
GrDirectContext::priv
GrDirectContextPriv priv()
GrDirectContext::abandoned
bool abandoned() override
Returns true if the context was abandoned or if the if the backend specific context has gotten into a...
GrDirectContext::flush
void flush()
Definition: GrDirectContext.h:372
GrDirectContext::setResourceCacheLimit
void setResourceCacheLimit(size_t maxResourceBytes)
Specify the GPU resource cache limit.
GrDirectContext::createBackendTexture
GrBackendTexture createBackendTexture(const SkPixmap srcData[], int numLevels, GrRenderable renderable, GrProtected isProtected, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
Definition: GrDirectContext.h:532
SkImage::CompressionType
CompressionType
Definition: SkImage.h:197
GrDirectContext::createBackendTexture
GrBackendTexture createBackendTexture(const SkPixmap srcData[], int numLevels, GrSurfaceOrigin, GrRenderable, GrProtected, GrGpuFinishedProc finishedProc=nullptr, GrGpuFinishedContext finishedContext=nullptr)
If possible, create a backend texture initialized with the provided pixmap data.