Skip to main content

euv_core/render/compute/
enum.rs

1use super::*;
2
3/// Layout solver mode encoded in the low 4 bits of `GpuLayoutNodeInput::flags_kind`.
4#[derive(
5    Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize,
6)]
7#[repr(u32)]
8pub enum GpuLayoutMode {
9    /// Fixed-column responsive grid with prefix-summed row heights.
10    #[default]
11    Grid = 0,
12    /// Horizontal single-line flex layout with Blelloch exclusive prefix-sum and `flex_grow`.
13    FlexRow = 1,
14    /// Vertical single-line flex layout with Blelloch exclusive prefix-sum and `flex_grow`.
15    FlexColumn = 2,
16    /// Vertical stacked block container stretching children across available width.
17    Block = 3,
18    /// Direct coordinate placement relative to parent content bounds.
19    Absolute = 4,
20    /// Direct GPU scale projection for bar charts, scatter plots, and heatmaps.
21    DataViz = 5,
22    /// Semi-implicit Verlet spring-damper physics integration executed on GPU.
23    Spring = 6,
24}
25
26/// Main-axis justification mode encoded in `GpuLayoutNodeInput::flags_kind` (`bits[4..7]`).
27#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
28#[repr(u32)]
29pub enum GpuJustifyMode {
30    /// Pack items at main-axis start.
31    #[default]
32    Start = 0,
33    /// Center items along main axis.
34    Center = 1,
35    /// Pack items at main-axis end.
36    End = 2,
37    /// Distribute remaining space evenly between items.
38    SpaceBetween = 3,
39}
40
41/// Cross-axis alignment mode encoded in `GpuLayoutNodeInput::flags_kind` (`bits[7..10]`).
42#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
43#[repr(u32)]
44pub enum GpuAlignMode {
45    /// Stretch items to fill cross axis.
46    #[default]
47    Stretch = 0,
48    /// Align items to cross-axis start.
49    Start = 1,
50    /// Center items along cross axis.
51    Center = 2,
52    /// Align items to cross-axis end.
53    End = 3,
54}
55
56/// Execution backend that ran a `GpuComputeLayoutEngine` dispatch.
57#[derive(
58    Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize,
59)]
60pub enum GpuComputeBackendKind {
61    /// Physical Apple Metal `MTLComputeCommandEncoder` + `drawPrimitives:indirectBuffer:`.
62    MetalHardware,
63    /// Bit-exact CPU reference compute parity engine for headless or non-Metal targets.
64    #[default]
65    CpuReferenceParity,
66}