Flutter Engine
The Flutter Engine
third_party
skia
src
gpu
ganesh
tessellate
VertexChunkPatchAllocator.h
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
#ifndef VertexChunkPatchAllocator_DEFINED
9
#define VertexChunkPatchAllocator_DEFINED
10
11
#include "
src/gpu/ganesh/GrVertexChunkArray.h
"
12
#include "
src/gpu/tessellate/LinearTolerances.h
"
13
14
namespace
skgpu::ganesh
{
15
16
// An adapter around GrVertexChunkBuilder that fits the API requirements of
17
// skgpu::tess::PatchWriter's PatchAllocator template parameter.
18
class
VertexChunkPatchAllocator
{
19
public
:
20
// 'stride' is provided by PatchWriter.
21
// 'worstCaseTolerances' is used to accumulate the LinearTolerances from each append().
22
// 'target', 'chunks', and 'minVerticesPerChunk' are forwarded from the PatchWriter's ctor and
23
// are used to construct a GrVertexChunkBuilder matching the PatchWriter's stride.
24
VertexChunkPatchAllocator
(
size_t
stride,
25
tess::LinearTolerances
* worstCaseTolerances,
26
GrMeshDrawTarget
*
target
,
27
GrVertexChunkArray
* chunks,
28
int
minVerticesPerChunk)
29
: fWorstCaseTolerances(worstCaseTolerances)
30
, fBuilder(
target
, chunks, stride, minVerticesPerChunk) {}
31
32
VertexWriter
append
(
const
tess::LinearTolerances
& tolerances) {
33
fWorstCaseTolerances->
accumulate
(tolerances);
34
return
fBuilder.
appendVertices
(1);
35
}
36
37
private
:
38
tess::LinearTolerances
* fWorstCaseTolerances;
39
GrVertexChunkBuilder
fBuilder;
40
};
41
42
}
// namespace skgpu::ganesh
43
44
#endif
// VertexChunkPatchAllocator_DEFINED
GrVertexChunkArray.h
LinearTolerances.h
GrMeshDrawTarget
Definition:
GrMeshDrawTarget.h:53
GrVertexChunkBuilder
Definition:
GrVertexChunkArray.h:41
GrVertexChunkBuilder::appendVertices
SK_ALWAYS_INLINE skgpu::VertexWriter appendVertices(int count)
Definition:
GrVertexChunkArray.h:58
skgpu::ganesh::VertexChunkPatchAllocator
Definition:
VertexChunkPatchAllocator.h:18
skgpu::ganesh::VertexChunkPatchAllocator::VertexChunkPatchAllocator
VertexChunkPatchAllocator(size_t stride, tess::LinearTolerances *worstCaseTolerances, GrMeshDrawTarget *target, GrVertexChunkArray *chunks, int minVerticesPerChunk)
Definition:
VertexChunkPatchAllocator.h:24
skgpu::ganesh::VertexChunkPatchAllocator::append
VertexWriter append(const tess::LinearTolerances &tolerances)
Definition:
VertexChunkPatchAllocator.h:32
skgpu::tess::LinearTolerances
Definition:
LinearTolerances.h:38
skgpu::tess::LinearTolerances::accumulate
void accumulate(const LinearTolerances &tolerances)
Definition:
LinearTolerances.h:109
skia_private::STArray< 1, GrVertexChunk >
target
uint32_t * target
Definition:
fl_texture_registrar_test.cc:40
skgpu::ganesh
Definition:
TessellateBench.cpp:24
skgpu::VertexWriter
Definition:
BufferWriter.h:123
Generated on Sun Jun 23 2024 21:56:24 for Flutter Engine by
1.9.4