Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Friends | List of all members
GrDirectContextPriv Class Reference

#include <GrDirectContextPriv.h>

Inheritance diagram for GrDirectContextPriv:
GrRecordingContextPriv GrImageContextPriv GrBaseContextPriv

Public Member Functions

GrDirectContextcontext ()
 
const GrDirectContextcontext () const
 
sktext::gpu::StrikeCachegetStrikeCache ()
 
GrSemaphoresSubmitted flushSurfaces (SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess=SkSurfaces::BackendSurfaceAccess::kNoAccess, const GrFlushInfo &={}, const skgpu::MutableTextureState *newState=nullptr)
 
GrSemaphoresSubmitted flushSurface (GrSurfaceProxy *proxy, SkSurfaces::BackendSurfaceAccess access=SkSurfaces::BackendSurfaceAccess::kNoAccess, const GrFlushInfo &info={}, const skgpu::MutableTextureState *newState=nullptr)
 
bool validPMUPMConversionExists ()
 
std::unique_ptr< GrFragmentProcessorcreatePMToUPMEffect (std::unique_ptr< GrFragmentProcessor >)
 
std::unique_ptr< GrFragmentProcessorcreateUPMToPMEffect (std::unique_ptr< GrFragmentProcessor >)
 
SkTaskGroupgetTaskGroup ()
 
GrResourceProviderresourceProvider ()
 
const GrResourceProviderresourceProvider () const
 
GrResourceCachegetResourceCache ()
 
GrGpugetGpu ()
 
const GrGpugetGpu () const
 
GrAtlasManagergetAtlasManager ()
 
skgpu::ganesh::SmallPathAtlasMgrgetSmallPathAtlasMgr ()
 
void createDDLTask (sk_sp< const GrDeferredDisplayList >, sk_sp< GrRenderTargetProxy > newDest)
 
bool compile (const GrProgramDesc &, const GrProgramInfo &)
 
GrContextOptions::PersistentCachegetPersistentCache ()
 
GrClientMappedBufferManagerclientMappedBufferManager ()
 
void setInsideReleaseProc (bool inside)
 
- Public Member Functions inherited from GrRecordingContextPriv
GrRecordingContextcontext ()
 
const GrRecordingContextcontext () const
 
GrProxyProviderproxyProvider ()
 
const GrProxyProviderproxyProvider () const
 
GrDrawingManagerdrawingManager ()
 
SkArenaAllocrecordTimeAllocator ()
 
sktext::gpu::SubRunAllocatorrecordTimeSubRunAllocator ()
 
GrRecordingContext::Arenas arenas ()
 
GrRecordingContext::OwnedArenas && detachArenas ()
 
void recordProgramInfo (const GrProgramInfo *programInfo)
 
void detachProgramData (skia_private::TArray< GrRecordingContext::ProgramData > *dst)
 
sktext::gpu::TextBlobRedrawCoordinatorgetTextBlobCache ()
 
GrThreadSafeCachethreadSafeCache ()
 
void moveRenderTasksToDDL (GrDeferredDisplayList *)
 
void addOnFlushCallbackObject (GrOnFlushCallbackObject *)
 
GrAuditTrailauditTrail ()
 
void printWarningMessage (const char *msg) const
 
GrRecordingContext::Statsstats ()
 
sktext::gpu::SDFTControl getSDFTControl (bool useSDFTForSmallText) const
 
sk_sp< skgpu::ganesh::DevicecreateDevice (GrColorType, sk_sp< GrSurfaceProxy >, sk_sp< SkColorSpace >, GrSurfaceOrigin, const SkSurfaceProps &, skgpu::ganesh::Device::InitContents)
 
sk_sp< skgpu::ganesh::DevicecreateDevice (skgpu::Budgeted, const SkImageInfo &, SkBackingFit, int sampleCount, skgpu::Mipmapped, skgpu::Protected, GrSurfaceOrigin, const SkSurfaceProps &, skgpu::ganesh::Device::InitContents)
 
std::unique_ptr< skgpu::ganesh::SurfaceContextmakeSC (GrSurfaceProxyView readView, const GrColorInfo &)
 
std::unique_ptr< skgpu::ganesh::SurfaceContextmakeSC (const GrImageInfo &, const GrBackendFormat &, std::string_view label, SkBackingFit=SkBackingFit::kExact, GrSurfaceOrigin=kTopLeft_GrSurfaceOrigin, skgpu::Renderable=skgpu::Renderable::kNo, int renderTargetSampleCnt=1, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Protected=skgpu::Protected::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)
 
std::unique_ptr< skgpu::ganesh::SurfaceFillContextmakeSFC (GrImageInfo, std::string_view label, SkBackingFit=SkBackingFit::kExact, int sampleCount=1, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Protected=skgpu::Protected::kNo, GrSurfaceOrigin=kTopLeft_GrSurfaceOrigin, skgpu::Budgeted=skgpu::Budgeted::kYes)
 
std::unique_ptr< skgpu::ganesh::SurfaceFillContextmakeSFC (SkAlphaType, sk_sp< SkColorSpace >, SkISize dimensions, SkBackingFit, const GrBackendFormat &, int sampleCount, skgpu::Mipmapped, skgpu::Protected, skgpu::Swizzle readSwizzle, skgpu::Swizzle writeSwizzle, GrSurfaceOrigin, skgpu::Budgeted, std::string_view label)
 
std::unique_ptr< skgpu::ganesh::SurfaceFillContextmakeSFCWithFallback (GrImageInfo, SkBackingFit, int sampleCount, skgpu::Mipmapped, skgpu::Protected, GrSurfaceOrigin=kTopLeft_GrSurfaceOrigin, skgpu::Budgeted=skgpu::Budgeted::kYes)
 
std::unique_ptr< skgpu::ganesh::SurfaceFillContextmakeSFCFromBackendTexture (GrColorInfo, const GrBackendTexture &, int sampleCount, GrSurfaceOrigin, sk_sp< skgpu::RefCntedCallback > releaseHelper)
 
- Public Member Functions inherited from GrImageContextPriv
GrImageContextcontext ()
 
const GrImageContextcontext () const
 
bool abandoned ()
 
 SkDEBUGCODE (skgpu::SingleOwner *singleOwner() const { return this->context() ->singleOwner();}) protected
 
- Public Member Functions inherited from GrBaseContextPriv
GrContext_Basecontext ()
 
const GrContext_Basecontext () const
 
uint32_t contextID () const
 
bool matches (GrContext_Base *candidate) const
 
const GrContextOptionsoptions () const
 
const GrCapscaps () const
 
sk_sp< const GrCapsrefCaps () const
 
GrImageContextasImageContext ()
 
GrRecordingContextasRecordingContext ()
 
GrDirectContextasDirectContext ()
 
GrContextOptions::ShaderErrorHandlergetShaderErrorHandler () const
 

Static Public Member Functions

static sk_sp< GrDirectContextMake (GrBackendApi backend, const GrContextOptions &options, sk_sp< GrContextThreadSafeProxy > proxy)
 
static bool Init (const sk_sp< GrDirectContext > &ctx)
 
static void SetGpu (const sk_sp< GrDirectContext > &ctx, std::unique_ptr< GrGpu > gpu)
 
- Static Public Member Functions inherited from GrRecordingContextPriv
static sk_sp< GrRecordingContextMakeDDL (sk_sp< GrContextThreadSafeProxy >)
 
- Static Public Member Functions inherited from GrImageContextPriv
static sk_sp< GrImageContextMakeForPromiseImage (sk_sp< GrContextThreadSafeProxy > tsp)
 

Friends

class GrDirectContext
 

Additional Inherited Members

- Protected Member Functions inherited from GrRecordingContextPriv
 GrRecordingContextPriv (GrRecordingContext *rContext)
 
- Protected Member Functions inherited from GrBaseContextPriv
 GrBaseContextPriv (GrContext_Base *context)
 
- Protected Attributes inherited from GrBaseContextPriv
GrContext_BasefContext
 

Detailed Description

Class that adds methods to GrDirectContext that are only intended for use internal to Skia. This class is purely a privileged window into GrDirectContext. It should never have additional data members or virtual methods.

Definition at line 35 of file GrDirectContextPriv.h.

Member Function Documentation

◆ clientMappedBufferManager()

GrClientMappedBufferManager * GrDirectContextPriv::clientMappedBufferManager ( )
inline

Definition at line 129 of file GrDirectContextPriv.h.

129 {
130 return this->context()->fMappedBufferManager.get();
131 }
GrDirectContext * context()

◆ compile()

bool GrDirectContextPriv::compile ( const GrProgramDesc desc,
const GrProgramInfo info 
)

Definition at line 75 of file GrDirectContextPriv.cpp.

75 {
76 GrGpu* gpu = this->getGpu();
77 if (!gpu) {
78 return false;
79 }
80
81 return gpu->compile(desc, info);
82}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
Definition: GrGpu.h:62
virtual bool compile(const GrProgramDesc &, const GrProgramInfo &)=0

◆ context() [1/2]

GrDirectContext * GrDirectContextPriv::context ( )
inline

Definition at line 53 of file GrDirectContextPriv.h.

53{ return static_cast<GrDirectContext*>(fContext); }
GrContext_Base * fContext

◆ context() [2/2]

const GrDirectContext * GrDirectContextPriv::context ( ) const
inline

Definition at line 54 of file GrDirectContextPriv.h.

54{ return static_cast<const GrDirectContext*>(fContext); }

◆ createDDLTask()

void GrDirectContextPriv::createDDLTask ( sk_sp< const GrDeferredDisplayList ddl,
sk_sp< GrRenderTargetProxy newDest 
)

Definition at line 70 of file GrDirectContextPriv.cpp.

71 {
72 this->context()->drawingManager()->createDDLTask(std::move(ddl), std::move(newDest));
73}
void createDDLTask(sk_sp< const GrDeferredDisplayList >, sk_sp< GrRenderTargetProxy > newDest)
GrDrawingManager * drawingManager()

◆ createPMToUPMEffect()

std::unique_ptr< GrFragmentProcessor > GrDirectContextPriv::createPMToUPMEffect ( std::unique_ptr< GrFragmentProcessor fp)

These functions create premul <-> unpremul effects, using specialized round-trip effects.

Definition at line 330 of file GrDirectContextPriv.cpp.

331 {
333 // We should have already called this->priv().validPMUPMConversionExists() in this case
334 SkASSERT(this->context()->fDidTestPMConversions);
335 // ...and it should have succeeded
337
338 return make_unpremul_effect(std::move(fp));
339}
static std::unique_ptr< GrFragmentProcessor > make_unpremul_effect(std::unique_ptr< GrFragmentProcessor > fp)
#define ASSERT_SINGLE_OWNER
#define SkASSERT(cond)
Definition: SkAssert.h:116
const uint32_t fp

◆ createUPMToPMEffect()

std::unique_ptr< GrFragmentProcessor > GrDirectContextPriv::createUPMToPMEffect ( std::unique_ptr< GrFragmentProcessor fp)

Definition at line 341 of file GrDirectContextPriv.cpp.

342 {
344 // We should have already called this->priv().validPMUPMConversionExists() in this case
345 SkASSERT(this->context()->fDidTestPMConversions);
346 // ...and it should have succeeded
348
349 return make_premul_effect(std::move(fp));
350}
static std::unique_ptr< GrFragmentProcessor > make_premul_effect(std::unique_ptr< GrFragmentProcessor > fp)

◆ flushSurface()

GrSemaphoresSubmitted GrDirectContextPriv::flushSurface ( GrSurfaceProxy proxy,
SkSurfaces::BackendSurfaceAccess  access = SkSurfaces::BackendSurfaceAccess::kNoAccess,
const GrFlushInfo info = {},
const skgpu::MutableTextureState newState = nullptr 
)
inline

Version of above that flushes for a single proxy. Null is allowed.

Definition at line 75 of file GrDirectContextPriv.h.

78 {},
79 const skgpu::MutableTextureState* newState = nullptr) {
80 size_t size = proxy ? 1 : 0;
81 return this->flushSurfaces({&proxy, size}, access, info, newState);
82 }
GrSemaphoresSubmitted flushSurfaces(SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess=SkSurfaces::BackendSurfaceAccess::kNoAccess, const GrFlushInfo &={}, const skgpu::MutableTextureState *newState=nullptr)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ flushSurfaces()

GrSemaphoresSubmitted GrDirectContextPriv::flushSurfaces ( SkSpan< GrSurfaceProxy * >  proxies,
SkSurfaces::BackendSurfaceAccess  access = SkSurfaces::BackendSurfaceAccess::kNoAccess,
const GrFlushInfo info = {},
const skgpu::MutableTextureState newState = nullptr 
)

Finalizes all pending reads and writes to the surfaces and also performs an MSAA resolves if necessary. The GrSurfaceProxy array is treated as a hint. If it is supplied the context will guarantee that the draws required for those proxies are flushed but it could do more. If no array is provided then all current work will be flushed.

It is not necessary to call this before reading the render target via Skia/GrContext. GrContext will detect when it must perform a resolve before reading pixels back from the surface or using it as a texture.

Definition at line 43 of file GrDirectContextPriv.cpp.

47 {
49 GR_CREATE_TRACE_MARKER_CONTEXT("GrDirectContextPriv", "flushSurfaces", this->context());
50
51 if (this->context()->abandoned()) {
52 if (info.fSubmittedProc) {
53 info.fSubmittedProc(info.fSubmittedContext, false);
54 }
55 if (info.fFinishedProc) {
56 info.fFinishedProc(info.fFinishedContext);
57 }
59 }
60
61#ifdef SK_DEBUG
62 for (GrSurfaceProxy* proxy : proxies) {
63 SkASSERT(proxy);
64 ASSERT_OWNED_PROXY(proxy);
65 }
66#endif
67 return this->context()->drawingManager()->flushSurfaces(proxies, access, info, newState);
68}
#define ASSERT_OWNED_PROXY(P)
#define GR_CREATE_TRACE_MARKER_CONTEXT(classname, op, context)
Definition: GrTracing.h:18
GrSemaphoresSubmitted flushSurfaces(SkSpan< GrSurfaceProxy * >, SkSurfaces::BackendSurfaceAccess, const GrFlushInfo &, const skgpu::MutableTextureState *newState)
GrGpuSubmittedProc fSubmittedProc
Definition: GrTypes.h:221

◆ getAtlasManager()

GrAtlasManager * GrDirectContextPriv::getAtlasManager ( )
inline

Definition at line 109 of file GrDirectContextPriv.h.

109 {
110 return this->context()->onGetAtlasManager();
111 }
GrAtlasManager * onGetAtlasManager()

◆ getGpu() [1/2]

GrGpu * GrDirectContextPriv::getGpu ( )
inline

Definition at line 105 of file GrDirectContextPriv.h.

105{ return this->context()->fGpu.get(); }

◆ getGpu() [2/2]

const GrGpu * GrDirectContextPriv::getGpu ( ) const
inline

Definition at line 106 of file GrDirectContextPriv.h.

106{ return this->context()->fGpu.get(); }

◆ getPersistentCache()

GrContextOptions::PersistentCache * GrDirectContextPriv::getPersistentCache ( )
inline

Definition at line 125 of file GrDirectContextPriv.h.

125 {
126 return this->context()->fPersistentCache;
127 }

◆ getResourceCache()

GrResourceCache * GrDirectContextPriv::getResourceCache ( )
inline

Definition at line 103 of file GrDirectContextPriv.h.

103{ return this->context()->fResourceCache.get(); }

◆ getSmallPathAtlasMgr()

skgpu::ganesh::SmallPathAtlasMgr * GrDirectContextPriv::getSmallPathAtlasMgr ( )
inline

Definition at line 115 of file GrDirectContextPriv.h.

115 {
116 return this->context()->onGetSmallPathAtlasMgr();
117 }
skgpu::ganesh::SmallPathAtlasMgr * onGetSmallPathAtlasMgr()

◆ getStrikeCache()

sktext::gpu::StrikeCache * GrDirectContextPriv::getStrikeCache ( )
inline

Definition at line 56 of file GrDirectContextPriv.h.

56{ return this->context()->fStrikeCache.get(); }

◆ getTaskGroup()

SkTaskGroup * GrDirectContextPriv::getTaskGroup ( )
inline

Definition at line 96 of file GrDirectContextPriv.h.

96{ return this->context()->fTaskGroup.get(); }

◆ Init()

static bool GrDirectContextPriv::Init ( const sk_sp< GrDirectContext > &  ctx)
inlinestatic

Definition at line 43 of file GrDirectContextPriv.h.

43 {
44 SkASSERT(ctx);
45 return ctx->init();
46 }
bool init() override

◆ Make()

static sk_sp< GrDirectContext > GrDirectContextPriv::Make ( GrBackendApi  backend,
const GrContextOptions options,
sk_sp< GrContextThreadSafeProxy proxy 
)
inlinestatic

Definition at line 37 of file GrDirectContextPriv.h.

39 {
40 return sk_sp<GrDirectContext>(new GrDirectContext(backend, options, std::move(proxy)));
41 }
const char * backend
const GrContextOptions & options() const

◆ resourceProvider() [1/2]

GrResourceProvider * GrDirectContextPriv::resourceProvider ( )
inline

Definition at line 98 of file GrDirectContextPriv.h.

98{ return this->context()->fResourceProvider.get(); }

◆ resourceProvider() [2/2]

const GrResourceProvider * GrDirectContextPriv::resourceProvider ( ) const
inline

Definition at line 99 of file GrDirectContextPriv.h.

99 {
100 return this->context()->fResourceProvider.get();
101 }

◆ SetGpu()

static void GrDirectContextPriv::SetGpu ( const sk_sp< GrDirectContext > &  ctx,
std::unique_ptr< GrGpu gpu 
)
inlinestatic

Definition at line 48 of file GrDirectContextPriv.h.

48 {
49 SkASSERT(ctx);
50 ctx->fGpu = std::move(gpu);
51 }

◆ setInsideReleaseProc()

void GrDirectContextPriv::setInsideReleaseProc ( bool  inside)
inline

Definition at line 133 of file GrDirectContextPriv.h.

133 {
134 if (inside) {
135 this->context()->fInsideReleaseProcCnt++;
136 } else {
137 SkASSERT(this->context()->fInsideReleaseProcCnt > 0);
138 this->context()->fInsideReleaseProcCnt--;
139 }
140 }

◆ validPMUPMConversionExists()

bool GrDirectContextPriv::validPMUPMConversionExists ( )

Returns true if createPMToUPMEffect and createUPMToPMEffect will succeed. In other words, did we find a pair of round-trip preserving conversion effects?

Definition at line 316 of file GrDirectContextPriv.cpp.

316 {
318
319 auto dContext = this->context();
320
321 if (!dContext->fDidTestPMConversions) {
322 dContext->fPMUPMConversionsRoundTrip = test_for_preserving_PM_conversions(dContext);
323 dContext->fDidTestPMConversions = true;
324 }
325
326 // The PM<->UPM tests fail or succeed together so we only need to check one.
327 return dContext->fPMUPMConversionsRoundTrip;
328}
static bool test_for_preserving_PM_conversions(GrDirectContext *dContext)

Friends And Related Function Documentation

◆ GrDirectContext

friend class GrDirectContext
friend

Definition at line 181 of file GrDirectContextPriv.h.


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