Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
gpu
graphite
dawn
DawnAsyncWait.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2022 Google LLC
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
src/gpu/graphite/dawn/DawnAsyncWait.h
"
9
10
#include "
src/gpu/graphite/Caps.h
"
11
#include "
src/gpu/graphite/dawn/DawnSharedContext.h
"
12
#include "
src/gpu/graphite/dawn/DawnUtilsPriv.h
"
13
14
namespace
skgpu::graphite
{
15
16
DawnAsyncWait::DawnAsyncWait
(
const
DawnSharedContext
* sharedContext)
17
: fSharedContext(sharedContext)
18
, fSignaled(false) {}
19
20
bool
DawnAsyncWait::yieldAndCheck
()
const
{
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
}
30
31
bool
DawnAsyncWait::mayBusyWait
()
const
{
return
fSharedContext->
caps
()->
allowCpuSync
(); }
32
33
void
DawnAsyncWait::busyWait
()
const
{
34
SkASSERT
(fSharedContext->
hasTick
());
35
while
(!this->
yieldAndCheck
()) {}
36
}
37
38
}
// namespace skgpu::graphite
Caps.h
DawnAsyncWait.h
DawnSharedContext.h
DawnUtilsPriv.h
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
skgpu::graphite::Caps::allowCpuSync
bool allowCpuSync() const
Definition
Caps.h:225
skgpu::graphite::DawnAsyncWait::yieldAndCheck
bool yieldAndCheck() const
Definition
DawnAsyncWait.cpp:20
skgpu::graphite::DawnAsyncWait::DawnAsyncWait
DawnAsyncWait(const DawnSharedContext *)
Definition
DawnAsyncWait.cpp:16
skgpu::graphite::DawnAsyncWait::busyWait
void busyWait() const
Definition
DawnAsyncWait.cpp:33
skgpu::graphite::DawnAsyncWait::mayBusyWait
bool mayBusyWait() const
Definition
DawnAsyncWait.cpp:31
skgpu::graphite::DawnSharedContext
Definition
DawnSharedContext.h:22
skgpu::graphite::DawnSharedContext::hasTick
bool hasTick() const
Definition
DawnSharedContext.h:36
skgpu::graphite::DawnSharedContext::tick
void tick() const
Definition
DawnSharedContext.h:38
skgpu::graphite::SharedContext::caps
const Caps * caps() const
Definition
SharedContext.h:39
skgpu::graphite
Definition
BoundsManagerBench.cpp:27
Generated on Fri Apr 26 2024 06:17:16 for Flutter Engine by
1.9.8