Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
skiatest::graphite::GraphiteTestContext Class Referenceabstract

#include <GraphiteTestContext.h>

Inheritance diagram for skiatest::graphite::GraphiteTestContext:
skiatest::graphite::DawnTestContext skiatest::graphite::MtlTestContext skiatest::graphite::VulkanTestContext

Public Member Functions

 GraphiteTestContext (const GraphiteTestContext &)=delete
 
GraphiteTestContextoperator= (const GraphiteTestContext &)=delete
 
virtual ~GraphiteTestContext ()
 
virtual skgpu::BackendApi backend ()=0
 
virtual skgpu::ContextType contextType ()=0
 
virtual std::unique_ptr< skgpu::graphite::ContextmakeContext (const TestOptions &)=0
 
bool getMaxGpuFrameLag (int *maxFrameLag) const
 
void submitRecordingAndWaitOnSync (skgpu::graphite::Context *, skgpu::graphite::Recording *)
 
virtual void tick ()
 
void syncedSubmit (skgpu::graphite::Context *)
 

Protected Member Functions

 GraphiteTestContext ()
 

Protected Attributes

sk_sp< sk_gpu_test::FlushFinishTrackerfFinishTrackers [kMaxFrameLag - 1]
 
int fCurrentFlushIdx = 0
 

Static Protected Attributes

static constexpr int kMaxFrameLag = 3
 

Detailed Description

An offscreen 3D context. This class is intended for Skia's internal testing needs and not for general use.

Definition at line 34 of file GraphiteTestContext.h.

Constructor & Destructor Documentation

◆ GraphiteTestContext() [1/2]

skiatest::graphite::GraphiteTestContext::GraphiteTestContext ( const GraphiteTestContext )
delete

◆ ~GraphiteTestContext()

skiatest::graphite::GraphiteTestContext::~GraphiteTestContext ( )
virtual

Definition at line 22 of file GraphiteTestContext.cpp.

22{}

◆ GraphiteTestContext() [2/2]

skiatest::graphite::GraphiteTestContext::GraphiteTestContext ( )
protected

Definition at line 20 of file GraphiteTestContext.cpp.

20{}

Member Function Documentation

◆ backend()

virtual skgpu::BackendApi skiatest::graphite::GraphiteTestContext::backend ( )
pure virtual

◆ contextType()

virtual skgpu::ContextType skiatest::graphite::GraphiteTestContext::contextType ( )
pure virtual

◆ getMaxGpuFrameLag()

bool skiatest::graphite::GraphiteTestContext::getMaxGpuFrameLag ( int maxFrameLag) const
inline

Definition at line 47 of file GraphiteTestContext.h.

47 {
48 *maxFrameLag = kMaxFrameLag;
49 return true;
50 }

◆ makeContext()

virtual std::unique_ptr< skgpu::graphite::Context > skiatest::graphite::GraphiteTestContext::makeContext ( const TestOptions )
pure virtual

◆ operator=()

GraphiteTestContext & skiatest::graphite::GraphiteTestContext::operator= ( const GraphiteTestContext )
delete

◆ submitRecordingAndWaitOnSync()

void skiatest::graphite::GraphiteTestContext::submitRecordingAndWaitOnSync ( skgpu::graphite::Context context,
skgpu::graphite::Recording recording 
)

This will insert a Recording and submit work to the GPU. Additionally, we will add a finished callback to our insert recording call. We allow ourselves to have kMaxFrameLag number of unfinished flushes active on the GPU at a time. If we have 2 outstanding flushes then we will wait on the CPU until one has finished.

Definition at line 24 of file GraphiteTestContext.cpp.

25 {
26 TRACE_EVENT0("skia.gpu", TRACE_FUNC);
27 SkASSERT(context);
28 SkASSERT(recording);
29
32 }
33
35
36 // We add an additional ref to the current flush tracker here. This ref is owned by the finish
37 // callback on the flush call. The finish callback will unref the tracker when called.
39
41 info.fRecording = recording;
42 info.fFinishedContext = fFinishTrackers[fCurrentFlushIdx].get();
44 context->insertRecording(info);
45
47
49}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define TRACE_FUNC
Definition: SkTraceEvent.h:30
void ref() const
Definition: SkRefCnt.h:62
static void FlushFinishedResult(void *finishedContext, skgpu::CallbackResult)
void waitTillFinished(std::function< void()> tick={})
T * get() const
Definition: SkRefCnt.h:303
void reset(T *ptr=nullptr)
Definition: SkRefCnt.h:310
bool submit(SyncToCpu=SyncToCpu::kNo)
Definition: Context.cpp:162
bool insertRecording(const InsertRecordingInfo &)
Definition: Context.cpp:156
sk_sp< sk_gpu_test::FlushFinishTracker > fFinishTrackers[kMaxFrameLag - 1]
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
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:131

◆ syncedSubmit()

void skiatest::graphite::GraphiteTestContext::syncedSubmit ( skgpu::graphite::Context context)

If the context supports CPU/GPU sync'ing this calls submit with skgpu::SyncToCpu::kYes. Otherwise it calls it with kNo in a busy loop.

Definition at line 51 of file GraphiteTestContext.cpp.

51 {
55 context->submit(sync);
57 while (context->hasUnfinishedGpuWork()) {
58 this->tick();
59 context->checkAsyncWorkCompletion();
60 }
61 }
62}
bool allowCpuSync() const
Definition: Caps.h:232
const Caps * caps() const
Definition: ContextPriv.h:32
bool hasUnfinishedGpuWork() const
Definition: Context.cpp:175

◆ tick()

virtual void skiatest::graphite::GraphiteTestContext::tick ( )
inlinevirtual

Allow the GPU API to make or detect forward progress on submitted work. For most APIs this is a no-op as the API can do this on another thread.

Reimplemented in skiatest::graphite::DawnTestContext.

Definition at line 64 of file GraphiteTestContext.h.

64{}

Member Data Documentation

◆ fCurrentFlushIdx

int skiatest::graphite::GraphiteTestContext::fCurrentFlushIdx = 0
protected

Definition at line 76 of file GraphiteTestContext.h.

◆ fFinishTrackers

sk_sp<sk_gpu_test::FlushFinishTracker> skiatest::graphite::GraphiteTestContext::fFinishTrackers[kMaxFrameLag - 1]
protected

Definition at line 75 of file GraphiteTestContext.h.

◆ kMaxFrameLag

constexpr int skiatest::graphite::GraphiteTestContext::kMaxFrameLag = 3
staticconstexprprotected

Definition at line 73 of file GraphiteTestContext.h.


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