Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
DM::GPUPersistentCacheTestingSink Class Reference

#include <DMSrcSink.h>

Inheritance diagram for DM::GPUPersistentCacheTestingSink:
DM::GPUSink DM::Sink

Public Member Functions

 GPUPersistentCacheTestingSink (const SkCommandLineConfigGpu *, const GrContextOptions &)
 
Result draw (const Src &, SkBitmap *, SkWStream *, SkString *) const override
 
const char * fileExtension () const override
 
- Public Member Functions inherited from DM::GPUSink
 GPUSink (const SkCommandLineConfigGpu *, const GrContextOptions &)
 
Result draw (const Src &, SkBitmap *, SkWStream *, SkString *) const override
 
Result onDraw (const Src &, SkBitmap *, SkWStream *, SkString *, const GrContextOptions &baseOptions, std::function< void(GrDirectContext *)> initContext=nullptr, std::function< SkCanvas *(SkCanvas *)> wrapCanvas=nullptr) const
 
skgpu::ContextType contextType () const
 
const sk_gpu_test::GrContextFactory::ContextOverridescontextOverrides () const
 
SkCommandLineConfigGpu::SurfType surfType () const
 
bool serial () const override
 
const char * fileExtension () const override
 
SinkFlags flags () const override
 
const GrContextOptionsbaseContextOptions () const
 
void setColorSpace (sk_sp< SkColorSpace > colorSpace) override
 
SkColorInfo colorInfo () const override
 
- Public Member Functions inherited from DM::Sink
virtual ~Sink ()
 
virtual Result draw (const Src &, SkBitmap *, SkWStream *, SkString *log) const =0
 
virtual void setColorSpace (sk_sp< SkColorSpace >)
 
virtual bool serial () const
 
virtual const char * fileExtension () const =0
 
virtual SinkFlags flags () const =0
 
virtual SkColorInfo colorInfo () const
 

Additional Inherited Members

- Protected Member Functions inherited from DM::GPUSink
sk_sp< SkSurfacecreateDstSurface (GrDirectContext *, SkISize size) const
 
bool readBack (SkSurface *, SkBitmap *dst) const
 

Detailed Description

Definition at line 435 of file DMSrcSink.h.

Constructor & Destructor Documentation

◆ GPUPersistentCacheTestingSink()

DM::GPUPersistentCacheTestingSink::GPUPersistentCacheTestingSink ( const SkCommandLineConfigGpu config,
const GrContextOptions grCtxOptions 
)

Definition at line 1705 of file DMSrcSink.cpp.

1707 : INHERITED(config, grCtxOptions)
1708 , fCacheType(config->getTestPersistentCache()) {}
int getTestPersistentCache() const

Member Function Documentation

◆ draw()

Result DM::GPUPersistentCacheTestingSink::draw ( const Src src,
SkBitmap dst,
SkWStream wStream,
SkString log 
) const
overridevirtual

Reimplemented from DM::GPUSink.

Definition at line 1710 of file DMSrcSink.cpp.

1711 {
1712 // Draw twice, once with a cold cache, and again with a warm cache. Verify that we get the same
1713 // result.
1714 sk_gpu_test::MemoryCache memoryCache;
1715 GrContextOptions contextOptions = this->baseContextOptions();
1716 contextOptions.fPersistentCache = &memoryCache;
1717 if (fCacheType == 2) {
1719 }
1720
1721 Result result = this->onDraw(src, dst, wStream, log, contextOptions);
1722 if (!result.isOk() || !dst) {
1723 return result;
1724 }
1725
1726 SkBitmap reference;
1727 SkString refLog;
1728 SkDynamicMemoryWStream refStream;
1729 memoryCache.resetCacheStats();
1730 Result refResult = this->onDraw(src, &reference, &refStream, &refLog, contextOptions);
1731 if (!refResult.isOk()) {
1732 return refResult;
1733 }
1734 SkASSERT(!memoryCache.numCacheMisses());
1735 SkASSERT(!memoryCache.numCacheStores());
1736
1737 return compare_bitmaps(reference, *dst);
1738}
#define SkASSERT(cond)
Definition: SkAssert.h:116
Result onDraw(const Src &, SkBitmap *, SkWStream *, SkString *, const GrContextOptions &baseOptions, std::function< void(GrDirectContext *)> initContext=nullptr, std::function< SkCanvas *(SkCanvas *)> wrapCanvas=nullptr) const
Definition: DMSrcSink.cpp:1584
const GrContextOptions & baseContextOptions() const
Definition: DMSrcSink.h:389
int numCacheMisses() const
Definition: MemoryCache.h:37
int numCacheStores() const
Definition: MemoryCache.h:38
GAsyncResult * result
static Result compare_bitmaps(const SkBitmap &reference, const SkBitmap &bitmap)
Definition: DMSrcSink.cpp:1481
dst
Definition: cp.py:12
PersistentCache * fPersistentCache
ShaderCacheStrategy fShaderCacheStrategy

◆ fileExtension()

const char * DM::GPUPersistentCacheTestingSink::fileExtension ( ) const
inlineoverridevirtual

Reimplemented from DM::GPUSink.

Definition at line 441 of file DMSrcSink.h.

441 {
442 // Suppress writing out results from this config - we just want to do our matching test
443 return nullptr;
444 }

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