Skip to main content

euv_chart/backend/common/
enum.rs

1/// The rendering backend a chart is running on.
2///
3/// The backend is chosen at run time: the chart asks for WebGPU, falls
4/// back to WebGL2, and falls back again to Canvas2D. From the outside the
5/// three look identical, because they all replay the same display list.
6#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
7pub enum BackendKind {
8    /// WebGPU: the fastest backend, and the one the chart prefers.
9    ///
10    /// Vector geometry is tessellated into triangle batches and uploaded
11    /// to the GPU once; a steady-state frame issues a handful of draw
12    /// calls and touches no JavaScript.
13    WebGpu,
14    /// WebGL2: the GPU fallback for browsers without WebGPU.
15    ///
16    /// The same batches as WebGPU, drawn through WebGL2 instancing.
17    WebGl2,
18    /// Canvas2D: the universal fallback.
19    ///
20    /// The display list is replayed as immediate-mode canvas calls. Slower
21    /// than the GPU backends, but it works everywhere.
22    #[default]
23    Canvas2D,
24}