Flutter Engine
The Flutter Engine
third_party
skia
src
gpu
ganesh
GrDeferredDisplayList.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2023 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 "
include/private/chromium/GrDeferredDisplayList.h
"
9
10
#include "
include/gpu/GrDirectContext.h
"
11
#include "
src/gpu/ganesh/GrDirectContextPriv.h
"
12
#include "
src/gpu/ganesh/GrRenderTargetProxy.h
"
13
#include "
src/gpu/ganesh/GrRenderTask.h
"
14
#include "
src/gpu/ganesh/surface/SkSurface_Ganesh.h
"
15
#include "
src/image/SkSurface_Base.h
"
16
17
#include <utility>
18
19
GrDeferredDisplayList::GrDeferredDisplayList(
const
GrSurfaceCharacterization
& characterization,
20
sk_sp<GrRenderTargetProxy>
targetProxy,
21
sk_sp<LazyProxyData>
lazyProxyData)
22
: fCharacterization(characterization)
23
, fArenas(
true
)
24
, fTargetProxy(
std
::move(targetProxy))
25
, fLazyProxyData(
std
::move(lazyProxyData)) {
26
SkASSERT
(fTargetProxy->isDDLTarget());
27
}
28
29
GrDeferredDisplayList::~GrDeferredDisplayList
() {
30
#if defined(SK_DEBUG)
31
for
(
auto
& renderTask : fRenderTasks) {
32
SkASSERT
(renderTask->unique());
33
}
34
#endif
35
}
36
37
GrDeferredDisplayList::ProgramIterator::ProgramIterator
(
GrDirectContext
* dContext,
38
GrDeferredDisplayList
* ddl)
39
:
fDContext
(dContext)
40
, fProgramData(ddl->programData())
41
, fIndex(0) {
42
}
43
44
GrDeferredDisplayList::ProgramIterator::~ProgramIterator
() {}
45
46
bool
GrDeferredDisplayList::ProgramIterator::compile
() {
47
if
(!
fDContext
|| fIndex < 0 || fIndex >= (
int
) fProgramData.
size
()) {
48
return
false
;
49
}
50
51
return
fDContext
->
priv
().
compile
(fProgramData[fIndex].
desc
(), fProgramData[fIndex].
info
());
52
}
53
54
bool
GrDeferredDisplayList::ProgramIterator::done
()
const
{
55
return
fIndex >= (
int
) fProgramData.
size
();
56
}
57
58
void
GrDeferredDisplayList::ProgramIterator::next
() {
59
++fIndex;
60
}
61
62
namespace
skgpu::ganesh
{
63
64
bool
DrawDDL
(
SkSurface
*
surface
,
sk_sp<const GrDeferredDisplayList>
ddl) {
65
if
(!
surface
|| !ddl) {
66
return
false
;
67
}
68
auto
sb =
asSB
(
surface
);
69
if
(!sb->isGaneshBacked()) {
70
return
false
;
71
}
72
auto
gs =
static_cast<
SkSurface_Ganesh
*
>
(
surface
);
73
return
gs->
draw
(ddl);
74
}
75
76
bool
DrawDDL
(
sk_sp<SkSurface>
surface
,
sk_sp<const GrDeferredDisplayList>
ddl) {
77
return
DrawDDL
(
surface
.get(), ddl);
78
}
79
80
}
info
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition:
DM.cpp:213
GrDeferredDisplayList.h
GrDirectContextPriv.h
GrDirectContext.h
GrRenderTargetProxy.h
GrRenderTask.h
SkASSERT
#define SkASSERT(cond)
Definition:
SkAssert.h:116
SkSurface_Base.h
asSB
static SkSurface_Base * asSB(SkSurface *surface)
Definition:
SkSurface_Base.h:213
SkSurface_Ganesh.h
fDContext
GrDirectContext * fDContext
Definition:
SkiaMetalContext.mm:32
GrDeferredDisplayList::ProgramIterator::compile
bool compile()
Definition:
GrDeferredDisplayList.cpp:46
GrDeferredDisplayList::ProgramIterator::ProgramIterator
ProgramIterator(GrDirectContext *, GrDeferredDisplayList *)
Definition:
GrDeferredDisplayList.cpp:37
GrDeferredDisplayList::ProgramIterator::next
void next()
Definition:
GrDeferredDisplayList.cpp:58
GrDeferredDisplayList::ProgramIterator::done
bool done() const
Definition:
GrDeferredDisplayList.cpp:54
GrDeferredDisplayList::ProgramIterator::~ProgramIterator
~ProgramIterator()
Definition:
GrDeferredDisplayList.cpp:44
GrDeferredDisplayList
Definition:
GrDeferredDisplayList.h:27
GrDeferredDisplayList::~GrDeferredDisplayList
SK_API ~GrDeferredDisplayList()
Definition:
GrDeferredDisplayList.cpp:29
GrDirectContextPriv::compile
bool compile(const GrProgramDesc &, const GrProgramInfo &)
Definition:
GrDirectContextPriv.cpp:75
GrDirectContext
Definition:
GrDirectContext.h:60
GrDirectContext::priv
GrDirectContextPriv priv()
Definition:
GrDirectContextPriv.h:186
GrSurfaceCharacterization
Definition:
GrSurfaceCharacterization.h:34
SkSurface_Ganesh
Definition:
SkSurface_Ganesh.h:40
SkSurface_Ganesh::draw
bool draw(sk_sp< const GrDeferredDisplayList >)
Definition:
SkSurface_Ganesh.cpp:406
SkSurface
Definition:
SkSurface.h:161
sk_sp< GrRenderTargetProxy >
skia_private::TArray::size
int size() const
Definition:
SkTArray.h:421
surface
VkSurfaceKHR surface
Definition:
main.cc:49
import_conformance_tests.desc
desc
Definition:
import_conformance_tests.py:63
skgpu::ganesh
Definition:
TessellateBench.cpp:24
skgpu::ganesh::DrawDDL
SK_API bool DrawDDL(SkSurface *, sk_sp< const GrDeferredDisplayList > ddl)
Definition:
GrDeferredDisplayList.cpp:64
std
Definition:
ref_ptr.h:256
tools.skpbench.skpbench.int
int
Definition:
skpbench.py:49
true
true
Definition:
verylargebitmap.cpp:163
Generated on Sun Jun 23 2024 21:56:20 for Flutter Engine by
1.9.4