41 TestSkTraceMemoryDump(
bool shouldDumpWrappedObjects)
42 : fShouldDumpWrappedObjects(shouldDumpWrappedObjects) {}
43 ~TestSkTraceMemoryDump()
override { }
45 void dumpNumericValue(
const char* dumpName,
const char* valueName,
const char* units,
46 uint64_t value)
override {
50 fDumpedObjectsSize +=
value;
54 const char* backingObjectId)
override { }
63 size_t numDumpedObjects()
const {
return fNumDumpedObjects; }
64 size_t dumpedObjectsSize()
const {
return fDumpedObjectsSize; }
67 bool fShouldDumpWrappedObjects;
68 size_t fNumDumpedObjects = 0;
69 size_t fDumpedObjectsSize = 0;
73 size_t numDumpedObjects,
size_t size,
bool isOwned) {
75 TestSkTraceMemoryDump dump_with_wrapped(
true );
80 TestSkTraceMemoryDump dump_no_wrapped(
false );
95 auto dContext = ctxInfo.directContext();
97 const size_t kMemorySize = 1024;
101 ValidateMemoryDumps(
reporter, dContext, 2, kMemorySize,
true );
108 auto dContext = ctxInfo.directContext();
116 desc.fIsProtected = skgpu::Protected::kNo;
119 auto texture = sk_make_sp<GrGLTexture>(gpu,
123 "SkTraceMemoryDump_ownedGLTexture");
125 ValidateMemoryDumps(
reporter, dContext, 2,
texture->gpuMemorySize(),
true );
132 auto dContext = ctxInfo.directContext();
141 desc.fIsProtected = skgpu::Protected::kNo;
143 auto params = sk_make_sp<GrGLTextureParameters>();
153 ValidateMemoryDumps(
reporter, dContext, 2,
texture->gpuMemorySize(),
false );
160 auto dContext = ctxInfo.directContext();
178 skgpu::Protected::kNo,
181 ValidateMemoryDumps(
reporter, dContext, 2, rt->gpuMemorySize(),
true );
188 auto dContext = ctxInfo.directContext();
206 skgpu::Protected::kNo,
209 ValidateMemoryDumps(
reporter, dContext, 2, rt->gpuMemorySize(),
false );
216 auto dContext = ctxInfo.directContext();
236 auto texRT = sk_make_sp<GrGLTextureRenderTarget>(
243 "SkTraceMemoryDump_ownedGLTextureRenderTarget");
245 ValidateMemoryDumps(
reporter, dContext, 3, texRT->gpuMemorySize(),
true );
@ kDynamic_GrAccessPattern
#define REPORTER_ASSERT(r, cond,...)
#define DEF_GANESH_TEST_FOR_GL_CONTEXT(name, reporter, context_info, ctsEnforcement)
void dumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump) const
GrDirectContextPriv priv()
static sk_sp< GrGLBuffer > Make(GrGLGpu *, size_t size, GrGpuBufferType intendedType, GrAccessPattern)
static sk_sp< GrGLRenderTarget > MakeWrapped(GrGLGpu *, const SkISize &, GrGLFormat, int sampleCount, const IDs &, int stencilBits, skgpu::Protected, std::string_view label)
static sk_sp< GrGLTexture > MakeWrapped(GrGLGpu *, GrMipmapStatus, const Desc &, sk_sp< GrGLTextureParameters >, GrWrapCacheable, GrIOType, std::string_view label)
virtual void setMemoryBacking(const char *dumpName, const char *backingType, const char *backingObjectId)=0
virtual void setDiscardableMemoryBacking(const char *dumpName, const SkDiscardableMemory &discardableMemoryObject)=0
virtual LevelOfDetail getRequestedDetails() const =0
@ kObjectsBreakdowns_LevelOfDetail
virtual bool shouldDumpWrappedObjects() const
virtual void dumpNumericValue(const char *dumpName, const char *valueName, const char *units, uint64_t value)=0
static constexpr int kSize
const EmbeddedViewParams * params
static const uint8_t buffer[]
int fTotalMemorySamplesPerPixel
GrGLuint fMultisampleFBOID
GrBackendObjectOwnership fRTFBOOwnership
GrGLuint fSingleSampleFBOID
GrGLuint fMSColorRenderbufferID
skgpu::Protected fIsProtected
GrBackendObjectOwnership fOwnership
static constexpr SkISize Make(int32_t w, int32_t h)