Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
DM::GPUDDLSink Class Reference

#include <DMSrcSink.h>

Inheritance diagram for DM::GPUDDLSink:
DM::GPUSink DM::Sink

Public Member Functions

 GPUDDLSink (const SkCommandLineConfigGpu *, const GrContextOptions &)
 
Result draw (const Src &, SkBitmap *, SkWStream *, SkString *) 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 ()
 

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 475 of file DMSrcSink.h.

Constructor & Destructor Documentation

◆ GPUDDLSink()

DM::GPUDDLSink::GPUDDLSink ( const SkCommandLineConfigGpu config,
const GrContextOptions ctxOptions 
)

Definition at line 1792 of file DMSrcSink.cpp.

1793 : INHERITED(config, ctxOptions)
1794 , fRecordingExecutor(SkExecutor::MakeLIFOThreadPool(1))
1795 , fGPUExecutor(SkExecutor::MakeFIFOThreadPool(1, false)) {
1796}
static std::unique_ptr< SkExecutor > MakeFIFOThreadPool(int threads=0, bool allowBorrowing=true)
static std::unique_ptr< SkExecutor > MakeLIFOThreadPool(int threads=0, bool allowBorrowing=true)

Member Function Documentation

◆ draw()

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

Implements DM::Sink.

Definition at line 1900 of file DMSrcSink.cpp.

1900 {
1901 GrContextOptions contextOptions = this->baseContextOptions();
1902 src.modifyGrContextOptions(&contextOptions);
1903 contextOptions.fPersistentCache = nullptr;
1904 contextOptions.fExecutor = nullptr;
1905
1906 GrContextFactory factory(contextOptions);
1907
1908 // This captures the context destined to be the main gpu context
1909 ContextInfo mainCtxInfo = factory.getContextInfo(this->contextType(), this->contextOverrides());
1910 sk_gpu_test::TestContext* mainTestCtx = mainCtxInfo.testContext();
1911 auto mainCtx = mainCtxInfo.directContext();
1912 if (!mainCtx) {
1913 return Result::Fatal("Could not create context.");
1914 }
1915
1916 SkASSERT(mainCtx->priv().getGpu());
1917
1918 // TODO: make use of 'otherCtx' for uploads & compilation
1919#if 0
1920 // This captures the context destined to be the utility context. It is in a share group
1921 // with the main context
1922 ContextInfo otherCtxInfo = factory.getSharedContextInfo(mainCtx);
1923 sk_gpu_test::TestContext* otherTestCtx = otherCtxInfo.testContext();
1924 auto otherCtx = otherCtxInfo.directContext();
1925 if (!otherCtx) {
1926 return Result::Fatal("Cound not create shared context.");
1927 }
1928
1929 SkASSERT(otherCtx->priv().getGpu());
1930#endif
1931
1932 SkTaskGroup recordingTaskGroup(*fRecordingExecutor);
1933 SkTaskGroup gpuTaskGroup(*fGPUExecutor);
1934
1935 // Make sure 'mainCtx' is current
1936 mainTestCtx->makeCurrent();
1937
1938 sk_sp<SkSurface> surface = this->createDstSurface(mainCtx, src.size());
1939 if (!surface) {
1940 return Result::Fatal("Could not create a surface.");
1941 }
1942
1943 Result result = this->ddlDraw(src, surface, &recordingTaskGroup, &gpuTaskGroup,
1944 mainTestCtx, mainCtx);
1945 if (!result.isOk()) {
1946 return result;
1947 }
1948
1949 // 'ddlDraw' will have made 'mainCtx' not current on the gpuThread
1950 mainTestCtx->makeCurrent();
1951
1952 if (FLAGS_gpuStats) {
1953 mainCtx->priv().dumpCacheStats(log);
1954 mainCtx->priv().dumpGpuStats(log);
1955 mainCtx->priv().dumpContextStats(log);
1956
1957#if 0
1958 otherCtx->priv().dumpCacheStats(log);
1959 otherCtx->priv().dumpGpuStats(log);
1960 otherCtx->priv().dumpContextStats(log);
1961#endif
1962 }
1963
1964 if (!this->readBack(surface.get(), dst)) {
1965 return Result::Fatal("Could not readback from surface.");
1966 }
1967
1968 return Result::Ok();
1969}
#define SkASSERT(cond)
Definition SkAssert.h:116
const sk_gpu_test::GrContextFactory::ContextOverrides & contextOverrides() const
Definition DMSrcSink.h:378
skgpu::ContextType contextType() const
Definition DMSrcSink.h:377
const GrContextOptions & baseContextOptions() const
Definition DMSrcSink.h:389
bool readBack(SkSurface *, SkBitmap *dst) const
sk_sp< SkSurface > createDstSurface(GrDirectContext *, SkISize size) const
static Result Ok()
Definition DMSrcSink.h:50
GrDirectContext * directContext() const
TestContext * testContext() const
T * get() const
Definition SkRefCnt.h:303
VkSurfaceKHR surface
Definition main.cc:49
GAsyncResult * result
PersistentCache * fPersistentCache
SkExecutor * fExecutor

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