Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
skgpu::graphite::DawnAsyncWait Class Reference

#include <DawnAsyncWait.h>

Public Member Functions

 DawnAsyncWait (const DawnSharedContext *)
 
bool yieldAndCheck () const
 
bool mayBusyWait () const
 
void busyWait () const
 
void signal ()
 
void reset ()
 

Detailed Description

Definition at line 22 of file DawnAsyncWait.h.

Constructor & Destructor Documentation

◆ DawnAsyncWait()

skgpu::graphite::DawnAsyncWait::DawnAsyncWait ( const DawnSharedContext sharedContext)

Definition at line 16 of file DawnAsyncWait.cpp.

17 : fSharedContext(sharedContext)
18 , fSignaled(false) {}

Member Function Documentation

◆ busyWait()

void skgpu::graphite::DawnAsyncWait::busyWait ( ) const

Definition at line 33 of file DawnAsyncWait.cpp.

33 {
34 SkASSERT(fSharedContext->hasTick());
35 while (!this->yieldAndCheck()) {}
36}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ mayBusyWait()

bool skgpu::graphite::DawnAsyncWait::mayBusyWait ( ) const

Definition at line 31 of file DawnAsyncWait.cpp.

31{ return fSharedContext->caps()->allowCpuSync(); }
bool allowCpuSync() const
Definition: Caps.h:232
const Caps * caps() const
Definition: SharedContext.h:39

◆ reset()

void skgpu::graphite::DawnAsyncWait::reset ( )
inline

Definition at line 45 of file DawnAsyncWait.h.

45{ fSignaled = false; }

◆ signal()

void skgpu::graphite::DawnAsyncWait::signal ( )
inline

Definition at line 42 of file DawnAsyncWait.h.

42{ fSignaled = true; }

◆ yieldAndCheck()

bool skgpu::graphite::DawnAsyncWait::yieldAndCheck ( ) const

Definition at line 20 of file DawnAsyncWait.cpp.

20 {
21 if (fSharedContext->hasTick()) {
22 if (fSignaled.load(std::memory_order_acquire)) {
23 return true;
24 }
25
26 fSharedContext->tick();
27 }
28 return fSignaled.load(std::memory_order_acquire);
29}

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