Flutter Engine
The Flutter Engine
|
#include <PatchWriter.h>
PatchWriter writes out tessellation patches, formatted with their specific attribs, to a GPU buffer.
PatchWriter is a template class that takes traits to configure both its compile-time and runtime behavior for the different tessellation rendering algorithms and GPU backends. The complexity of this system is worthwhile because the attribute writing operations and math already require heavy inlining for performance, and the algorithmic variations tend to only differ slightly, but do so in the inner most loops. Additionally, Graphite and Ganesh use the same fundamental algorithms, but Graphite's architecture and higher required hardware level mean that its attribute configurations can be determined entirely at compile time.
Traits are specified in PatchWriter's single var-args template pack. Traits come in two main categories: PatchAttribs configuration and feature/processing configuration. A given PatchAttrib can be always enabled, enabled at runtime, or always disabled. A feature can be either enabled or disabled and are coupled more closely with the control points of the curve. Across the two GPU backends and different path rendering strategies, a "patch" has the following structure:
Currently PatchWriter supports the following traits:
In addition to variable traits, PatchWriter's first template argument defines the type used for allocating the GPU instance data. The templated "PatchAllocator" can be any type that provides: // A GPU-backed vertex writer for a single instance worth of data. The provided // LinearTolerances value represents the tolerances for the curve that will be written to the // returned vertex space. skgpu::VertexWriter append(const LinearTolerances&);
Additionally, it must have a constructor that takes the stride as its first argument. PatchWriter forwards any additional constructor args from its ctor to the allocator after computing the necessary stride for its PatchAttribs configuration.
Definition at line 88 of file PatchWriter.h.