8 #ifndef GrRecordingContext_DEFINED
9 #define GrRecordingContext_DEFINED
15 #include "include/private/base/SkTArray.h"
16 #include "include/private/gpu/ganesh/GrContext_Base.h"
17 #include "include/private/gpu/ganesh/GrImageContext.h"
26 class GrDrawingManager;
27 class GrOnFlushCallbackObject;
30 class GrProxyProvider;
31 class GrRecordingContextPriv;
32 class GrThreadSafeCache;
38 class SubRunAllocator;
39 class TextBlobRedrawCoordinator;
52 bool abandoned()
override {
return GrImageContext::abandoned(); }
97 return GrImageContext::maxSurfaceSampleCountForColorType(colorType);
110 Arenas(SkArenaAlloc*, sktext::gpu::SubRunAllocator*);
117 return fRecordTimeSubRunAllocator;
121 SkArenaAlloc* fRecordTimeAllocator;
122 sktext::gpu::SubRunAllocator* fRecordTimeSubRunAllocator;
142 std::unique_ptr<SkArenaAlloc> fRecordTimeAllocator;
143 std::unique_ptr<sktext::gpu::SubRunAllocator> fRecordTimeSubRunAllocator;
164 const GrProxyProvider*
proxyProvider()
const {
return fProxyProvider.get(); }
167 ProgramData(std::unique_ptr<const GrProgramDesc>,
const GrProgramInfo*);
172 const GrProgramDesc&
desc()
const {
return *fDesc; }
173 const GrProgramInfo&
info()
const {
return *fInfo; }
177 std::unique_ptr<const GrProgramDesc> fDesc;
180 const GrProgramInfo* fInfo =
nullptr;
215 void reset() { *
this = {}; }
217 int numPathMasksGenerated()
const {
return fNumPathMasksGenerated; }
220 int numPathMaskCacheHits()
const {
return fNumPathMaskCacheHits; }
223 #if defined(GR_TEST_UTILS)
225 void dumpKeyValuePairs(skia_private::TArray<SkString>* keys,
226 skia_private::TArray<double>* values)
const;
230 int fNumPathMasksGenerated{0};
231 int fNumPathMaskCacheHits{0};
237 #if defined(GR_TEST_UTILS)
239 void dumpKeyValuePairs(skia_private::TArray<SkString>* keys,
240 skia_private::TArray<double>* values)
const {}
245 #if GR_GPU_STATS && defined(GR_TEST_UTILS)
247 void dumpKeyValuePairs(skia_private::TArray<SkString>* keys,
248 skia_private::TArray<double>* values)
const;
250 void merge(
const DMSAAStats&);
251 int fNumRenderPasses = 0;
252 int fNumMultisampleRenderPasses = 0;
253 std::map<std::string, int> fTriggerCounts;
256 DMSAAStats fDMSAAStats;
270 std::unique_ptr<GrDrawingManager> fDrawingManager;
271 std::unique_ptr<GrProxyProvider> fProxyProvider;
273 #if defined(GR_TEST_UTILS)
274 int fSuppressWarningMessages = 0;
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
Safely cast a possibly-null base context to direct context.
Definition: GrRecordingContext.h:281
SkColorType
Describes how pixel bits encode color.
Definition: SkColorType.h:19
@ kR16G16B16A16_unorm_SkColorType
pixel with a little endian uint16_t for red, green, blue
Definition: SkColorType.h:49
@ kA16_unorm_SkColorType
pixel with a little endian uint16_t for alpha
Definition: SkColorType.h:47
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
Definition: SkColorType.h:34
@ kA16_float_SkColorType
pixel with a half float for alpha
Definition: SkColorType.h:44
@ kR16G16_unorm_SkColorType
pixel with a little endian uint16_t for red and green
Definition: SkColorType.h:48
@ kR16G16_float_SkColorType
pixel with a half float for red and green
Definition: SkColorType.h:45
Definition: GrContextThreadSafeProxy.h:166
Definition: GrDirectContext.h:62
GrDirectContext * asDirectContext() override
Definition: GrDirectContext.h:955
Definition: GrRecordingContext.h:108
sktext::gpu::SubRunAllocator * recordTimeSubRunAllocator()
Definition: GrRecordingContext.h:116
Arenas(SkArenaAlloc *, sktext::gpu::SubRunAllocator *)
SkArenaAlloc * recordTimeAllocator()
Definition: GrRecordingContext.h:113
Definition: GrRecordingContext.h:131
OwnedArenas(bool ddlRecording)
OwnedArenas & operator=(OwnedArenas &&)
Definition: GrRecordingContext.h:210
void incNumPathMasksGenerated()
Definition: GrRecordingContext.h:234
void incNumPathMasksCacheHits()
Definition: GrRecordingContext.h:235
Definition: GrRecordingContext.h:42
Arenas arenas()
Definition: GrRecordingContext.h:158
~GrRecordingContext() override
friend class GrDeferredDisplayList
Definition: GrRecordingContext.h:127
void dumpJSON(SkJSONWriter *) const
GrRecordingContextPriv priv()
virtual void detachProgramData(skia_private::TArray< ProgramData > *)
Definition: GrRecordingContext.h:192
bool abandoned() override
Reports whether the GrDirectContext associated with this GrRecordingContext is abandoned.
Definition: GrRecordingContext.h:52
SK_API bool colorTypeSupportedAsSurface(SkColorType colorType) const
Definition: GrRecordingContext.h:58
SK_API sk_sp< const SkCapabilities > skCapabilities() const
OwnedArenas && detachArenas()
class GrRecordingContext::Stats fStats
sktext::gpu::TextBlobRedrawCoordinator * getTextBlobRedrawCoordinator()
SK_API bool supportsProtectedContent() const
Does this context support protected content?
GrRecordingContext(sk_sp< GrContextThreadSafeProxy >, bool ddlRecording)
const GrThreadSafeCache * threadSafeCache() const
void addOnFlushCallbackObject(GrOnFlushCallbackObject *)
Registers an object for flush-related callbacks.
Stats * stats()
Definition: GrRecordingContext.h:259
virtual void recordProgramInfo(const GrProgramInfo *)
Definition: GrRecordingContext.h:186
GrProxyProvider * proxyProvider()
Definition: GrRecordingContext.h:163
SK_API int maxRenderTargetSize() const
Gets the maximum supported render target size.
SK_API int maxSurfaceSampleCountForColorType(SkColorType colorType) const
Gets the maximum supported sample count for a color type.
Definition: GrRecordingContext.h:96
const Stats * stats() const
Definition: GrRecordingContext.h:260
friend class GrRecordingContextPriv
Definition: GrRecordingContext.h:126
GrDrawingManager * drawingManager()
void destroyDrawingManager()
const sktext::gpu::TextBlobRedrawCoordinator * getTextBlobRedrawCoordinator() const
GrRecordingContext * asRecordingContext() override
Definition: GrRecordingContext.h:208
const GrRecordingContextPriv priv() const
const GrProxyProvider * proxyProvider() const
Definition: GrRecordingContext.h:164
std::unique_ptr< GrAuditTrail > fAuditTrail
Definition: GrRecordingContext.h:265
SK_API int maxTextureSize() const
Gets the maximum supported texture size.
void abandonContext() override
friend class GrDeferredDisplayListPriv
Definition: GrRecordingContext.h:128
GrThreadSafeCache * threadSafeCache()
SK_API bool colorTypeSupportedAsImage(SkColorType) const
Can a SkImage be created with the given color type.
Definition: SkCapabilities.h:21
Light weight class for managing strings.
Definition: SkString.h:118
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:220
Definition: SkCanvas.h:74
Definition: GrRecordingContext.h:166
const GrProgramDesc & desc() const
Definition: GrRecordingContext.h:172
ProgramData(std::unique_ptr< const GrProgramDesc >, const GrProgramInfo *)
ProgramData(ProgramData &&)
ProgramData(const ProgramData &)=delete
const GrProgramInfo & info() const
Definition: GrRecordingContext.h:173