1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
use *;
/// Active adaptive spin-loop iterations performed by band workers during animation/scroll before parking (~30-60us).
pub const BAND_WORKER_SPIN_LIMIT_ACTIVE: u32 = 3_072;
/// Idle spin-loop iterations performed by band workers when no active animation/scroll is running (`0` = immediate park).
pub const BAND_WORKER_SPIN_LIMIT_IDLE: u32 = 0;
/// Half-domain extent in standard deviations covered by `GAUSSIAN_ERFC_LUT` (`[-3.2σ, +3.2σ]`).
pub const GAUSSIAN_LUT_RANGE: f32 = 3.2;
/// Number of intervals inside `GAUSSIAN_ERFC_LUT` (`512` intervals, `513` sample points).
pub const GAUSSIAN_LUT_SEGMENTS: usize = 512;
/// Inverse spacing `(512.0 / 6.4) = 80.0` mapping `u + 3.2` into table index space.
pub const GAUSSIAN_LUT_STEP_INV: f32 =
/ ;
/// Compile-time 2 KB analytical Gaussian `0.5 * erfc(u / sqrt(2))` lookup table eliminating per-pixel `exp()` calls.
pub const GAUSSIAN_ERFC_LUT: = build_gaussian_erfc_lut;
/// Maximum cached `TextLayoutResult` entries retained by `SoftwareRenderer` between frames.
pub const TEXT_LAYOUT_CACHE_LIMIT: usize = 512;
/// Default resident memory budget for `TextLayoutCache` (2 MiB) before LRU eviction trims cold entries.
pub const TEXT_LAYOUT_CACHE_BUDGET_BYTES: usize = 2 * 1024 * 1024;
/// Fixed per-entry metadata overhead counted toward `TextLayoutCache::resident_bytes`.
pub const TEXT_LAYOUT_ENTRY_OVERHEAD_BYTES: usize = 64;
/// Fixed per-line `TextLine` struct overhead counted toward `TextLayoutCache::resident_bytes`.
pub const TEXT_LINE_OVERHEAD_BYTES: usize = 32;
/// Initial power-of-two slot table size for `TextLayoutCache` (load factor `<= 0.5` at `TEXT_LAYOUT_CACHE_LIMIT`).
pub const TEXT_LAYOUT_CACHE_SLOTS: usize = 1024;
/// 64-bit FxHash mixing multiplier for fast SipHash-free cache hashing and slot indexing.
pub const FX_HASH_K64: u64 = 0x517C_C1B7_2722_0A95;
/// Sentinel empty slot for `TextLayoutCache` open-addressed probing.
pub const EMPTY_TEXT_LAYOUT_SLOT: TextLayoutSlot = TextLayoutSlot ;
/// Maximum cached `PositionedGlyphRun` entries retained across scroll/animation frames.
pub const POSITIONED_RUN_CACHE_LIMIT: usize = 512;
/// Initial power-of-two slot table size for `PositionedGlyphRunCache`.
pub const POSITIONED_RUN_CACHE_SLOTS: usize = 1024;
/// Maximum UTF-8 byte length eligible for whole-run `PositionedGlyphRun` caching (prevents rasterizing giant off-screen blocks).
pub const POSITIONED_RUN_MAX_TEXT_LEN: usize = 1024;
/// Fixed flat glyph slab capacity retained by `PositionedGlyphRunCache` for zero-allocation steady-state inserts and LRU compactions.
pub const POSITIONED_RUN_GLYPH_SLAB_CAP: usize = 16_384;
/// Sentinel empty slot for `PositionedGlyphRunCache` open-addressed probing.
pub const EMPTY_POSITIONED_RUN_SLOT: PositionedGlyphRunSlot = PositionedGlyphRunSlot ;
/// Maximum stack-cached width in physical pixels for precomputed 1D vertical rounded-rect edge strips.
pub const ROUNDED_EDGE_STRIP_CAP: usize = 16;
/// Maximum cached rounded-clip corner side length in physical pixels (`dim = ceil(r + 1)`).
pub const CORNER_MASK_MAX_DIM: u32 = 96;
/// Maximum cached quadrant corner coverage masks retained by `SoftwareRenderer` between frames.
pub const CORNER_MASK_CACHE_LIMIT: usize = 128;
/// Thread name prefix assigned to persistent horizontal-band rasterization workers.
pub const BAND_WORKER_THREAD_PREFIX: &str = "euv-band";
/// Background initializer thread name warming `BandWorkerPool` asynchronously after Frame 1.
pub const BAND_POOL_INIT_THREAD_NAME: &str = "euv-band-init";
/// Maximum total rasterizer threads (caller plus background workers) in `BandWorkerPool`.
pub const BAND_WORKER_MAX_THREADS: usize = 16;
/// Active spin-loop iterations performed by the calling thread before parking on `wake_caller`.
pub const BAND_CALLER_SPIN_LIMIT_ACTIVE: u32 = 3_072;
/// Idle spin-loop iterations performed by the calling thread before parking on `wake_caller`.
pub const BAND_CALLER_SPIN_LIMIT_IDLE: u32 = 64;
/// Atomic state value indicating `BAND_WORKER_POOL` has not yet been requested.
pub const BAND_POOL_UNINITIALIZED: usize = 0;
/// Atomic state value indicating `BAND_WORKER_POOL` is warming asynchronously on a background thread.
pub const BAND_POOL_SPAWNING: usize = 1;
/// Atomic state value indicating `BAND_WORKER_POOL` is warm and ready for lock-free dispatch.
pub const BAND_POOL_READY: usize = 2;
/// Maximum damaged pixel area executed directly on the calling thread without touching `BandWorkerPool`.
pub const SMALL_DAMAGE_SINGLE_THREAD_PIXELS: usize = 32_768;
/// Minimum prepared command count before waking `BandWorkerPool` for mid-sized single-row dirty rects.
pub const BAND_DISPATCH_MIN_CMDS: usize = 6;
/// Minimum damaged pixel area required before splitting horizontal bands across background worker threads.
pub const BAND_DISPATCH_MIN_PIXELS: usize = 65_536;
/// Minimum vertical height in physical rows required for multi-threaded band dispatch.
pub const BAND_DISPATCH_MIN_HEIGHT: u32 = 64;
/// Minimum blur area in physical pixels before splitting separable `BackdropBlur` passes across `BandWorkerPool`.
pub const BLUR_PARALLEL_MIN_PIXELS: usize = 16_384;
/// Minimum blur height in physical rows before splitting separable `BackdropBlur` passes across `BandWorkerPool`.
pub const BLUR_PARALLEL_MIN_HEIGHT: u32 = 32;
/// Lower bound in physical pixels for the adaptive serial-vs-parallel stripe threshold.
pub const ADAPTIVE_PARALLEL_MIN_PIXELS: usize = 32_768;
/// Default starting threshold in physical pixels before switching small dirty rects from serial to parallel stripes.
pub const ADAPTIVE_PARALLEL_DEFAULT_PIXELS: usize = 49_152;
/// Upper bound in physical pixels for the adaptive serial-vs-parallel stripe threshold.
pub const ADAPTIVE_PARALLEL_MAX_PIXELS: usize = 524_288;
/// Maximum opaque occluder rectangles tracked concurrently during order-preserving occlusion culling.
pub const OCCLUSION_MAX_OCCLUDERS: usize = 16;
/// Coarse 8x8 viewport tile grid dimension for 64-bit bitmask union occlusion tests.
pub const OCCLUSION_TILE_GRID_DIM: u32 = 8;