chromium/third_party/skia/src/gpu/tessellate/FixedCountBufferUtils.h

/*
 * Copyright 2022 Google LLC
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef skgpu_tessellate_FixedCountBufferUtils_DEFINED
#define skgpu_tessellate_FixedCountBufferUtils_DEFINED

#include "src/gpu/tessellate/LinearTolerances.h"
#include "src/gpu/tessellate/Tessellation.h"

#include <algorithm>
#include <cstddef>
#include <cstdint>

namespace skgpu { struct VertexWriter; }

namespace skgpu::tess {

/**
 * Fixed-count tessellation operates in three modes, two for filling paths, and one for stroking.
 * These modes may have additional sub-variations, but in terms of vertex buffer management, these
 * three categories are sufficient:
 *
 * - FixedCountCurves: for filling paths where just the curves are tessellated. Additional measures
 *     to fill space between the inner control points of the paths are needed.
 * - FixedCountWedges: for filling paths by tessellating the curves and adding an additional inline
 *     triangle with a shared vertex that all verbs connect to. Works with PatchAttribs::kFanPoint.
 * - FixedCountStrokes: for stroking a path. Likely paired with PatchAttribs::kJoinControlPoint and
 *     PatchAttribs::kStrokeParams.
 *
 * The three types defined below for these three modes provide utility functions for heuristics to
 * choose pre-allocation size when accumulating instance attributes with a PatchWriter, and
 * functions for creating static/GPU-private vertex and index buffers that are used as the template
 * for instanced rendering.
 */
class FixedCountCurves {};

class FixedCountWedges {};

class FixedCountStrokes {};

}  // namespace skgpu::tess

#endif // skgpu_tessellate_FixedCountBufferUtils