authoravatarclover caruso<git@paperclover.net>2026-12-01 22:57:37-08:00
committeravatarclover caruso<git@paperclover.net>2026-12-01 23:04:51-08:00
log4301134881311f5b9d2e1f0753e297645a7bb2ee
treea61302db81c5a9a875f464c43c110d6c3270f417
parent3cd007bf53605e9c37fb396aa60137d13c380f31
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

feat(engine): add native GPU Fuse.HexagonTiles generator


8 files changed, 245 insertions(+), 13 deletions(-)

compatibility.md+5-4
...@@ -2,19 +2,19 @@...@@ -2,19 +2,19 @@
22
3# Fusion 21.1 Compatibility3# Fusion 21.1 Compatibility
44
5Fission currently supports **126** tool types across 2D/3D compositing, all with high accuracy. This document tracks the progress on parity with Blackmagic Fusion Studio. The main metric, **accuracy**, is the inverse of the image's [mean absolute error](https://en.wikipedia.org/wiki/Mean_absolute_error), meaning `100%` accuracy means the pixels are all identical. For details, see [`scripts/fuzz_node.py`](scripts/fuzz_node.py).5Fission currently supports **127** tool types across 2D/3D compositing, all with high accuracy. This document tracks the progress on parity with Blackmagic Fusion Studio. The main metric, **accuracy**, is the inverse of the image's [mean absolute error](https://en.wikipedia.org/wiki/Mean_absolute_error), meaning `100%` accuracy means the pixels are all identical. For details, see [`scripts/fuzz_node.py`](scripts/fuzz_node.py).
66
7## Summary7## Summary
88
9| Metric | Value |9| Metric | Value |
10| --- | --- |10| --- | --- |
11| **Supported Tools** | **126** |11| **Supported Tools** | **127** |
12| **Modifiers & Animation** | **8** |12| **Modifiers & Animation** | **8** |
13| **Accuracy across [paper clover](https://paperclover.net)'s compositions** | **99.5%** |13| **Accuracy across [paper clover](https://paperclover.net)'s compositions** | **99.5%** |
14| **Supported Tool Accuracy** | **99.7%** |14| **Supported Tool Accuracy** | **99.7%** |
15| **Supported Tools with 100% Accuracy** | **48** |15| **Supported Tools with 100% Accuracy** | **49** |
16| **Coverage of Fusion's Built-in Tools** | **28.3%** |16| **Coverage of Fusion's Built-in Tools** | **28.3%** |
17| **Coverage of All Fuses on Reactor** | **0.5%** |17| **Coverage of All Fuses on Reactor** | **0.6%** |
1818
19## Generators19## Generators
2020
...@@ -27,6 +27,7 @@ Fission currently supports **126** tool types across 2D/3D compositing, all with...@@ -27,6 +27,7 @@ Fission currently supports **126** tool types across 2D/3D compositing, all with
27| `Loader` | ✅ 100.0% | — |27| `Loader` | ✅ 100.0% | — |
28| `DaySky` | 99.9% | — |28| `DaySky` | 99.9% | — |
29| `Fuse.CheckerPieceGenerator` | ✅ 100.0% | — |29| `Fuse.CheckerPieceGenerator` | ✅ 100.0% | — |
30| `Fuse.HexagonTiles` | ✅ 100.0% | — |
3031
31## Compositing & Blending32## Compositing & Blending
3233
crates/app/src/add_tool.rs+2
...@@ -69,6 +69,7 @@ pub const TOOL_CATALOG: &[ToolEntry] = &[...@@ -69,6 +69,7 @@ pub const TOOL_CATALOG: &[ToolEntry] = &[
69 ToolEntry { kind: "Loader", display: "Loader", aliases: "ld read media footage image", category: ToolCategory::Generator, is_generator: true },69 ToolEntry { kind: "Loader", display: "Loader", aliases: "ld read media footage image", category: ToolCategory::Generator, is_generator: true },
70 ToolEntry { kind: "DaySky", display: "Day Sky", aliases: "sky sun atmosphere preetham hdri", category: ToolCategory::Generator, is_generator: true },70 ToolEntry { kind: "DaySky", display: "Day Sky", aliases: "sky sun atmosphere preetham hdri", category: ToolCategory::Generator, is_generator: true },
71 ToolEntry { kind: "Fuse.CheckerPieceGenerator", display: "Checker Piece", aliases: "checkerboard checker tile squares", category: ToolCategory::Generator, is_generator: true },71 ToolEntry { kind: "Fuse.CheckerPieceGenerator", display: "Checker Piece", aliases: "checkerboard checker tile squares", category: ToolCategory::Generator, is_generator: true },
72 ToolEntry { kind: "Fuse.HexagonTiles", display: "Hexagon Tiles", aliases: "hexagon tiles hex grid pattern", category: ToolCategory::Generator, is_generator: true },
72 // Composite73 // Composite
73 ToolEntry { kind: "Merge", display: "Merge", aliases: "mrg over blend comp", category: ToolCategory::Composite, is_generator: false },74 ToolEntry { kind: "Merge", display: "Merge", aliases: "mrg over blend comp", category: ToolCategory::Composite, is_generator: false },
74 ToolEntry { kind: "Dissolve", display: "Dissolve", aliases: "dx mix crossfade", category: ToolCategory::Composite, is_generator: false },75 ToolEntry { kind: "Dissolve", display: "Dissolve", aliases: "dx mix crossfade", category: ToolCategory::Composite, is_generator: false },
...@@ -614,6 +615,7 @@ mod tests {...@@ -614,6 +615,7 @@ mod tests {
614 "Fuse.Duplicate", "Fuse.KScope", "Fuse.Wireless", "Fuse.Cryptomatte",615 "Fuse.Duplicate", "Fuse.KScope", "Fuse.Wireless", "Fuse.Cryptomatte",
615 "Dimension.OpticalFlow", "Dimension.CopyAux", "pBounce", "Custom", "Switch",616 "Dimension.OpticalFlow", "Dimension.CopyAux", "pBounce", "Custom", "Switch",
616 "Fuse.SwitchElse", "Fuse.CheckerPieceGenerator", "Fuse.AlphaWeightedNoise", "Fuse.Crystallize",617 "Fuse.SwitchElse", "Fuse.CheckerPieceGenerator", "Fuse.AlphaWeightedNoise", "Fuse.Crystallize",
618 "Fuse.HexagonTiles",
617 ] {619 ] {
618 assert!(seen.contains(kind), "catalog is missing {kind}");620 assert!(seen.contains(kind), "catalog is missing {kind}");
619 }621 }
crates/engine/src/eval/fuses.rs+186-2
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1//! Native ports of Clover's custom Fuses: `SwitchElse`, `CheckerPieceGenerator`,1//! Native ports of Fuses: `SwitchElse`, `CheckerPieceGenerator`,
2//! `AlphaWeightedNoise`, and `Crystallize`.2//! `AlphaWeightedNoise`, `Crystallize`, and `HexagonTiles`.
33
4use super::*;4use super::*;
55
...@@ -151,6 +151,67 @@ impl Engine {...@@ -151,6 +151,67 @@ impl Engine {
151 self.cache.insert(key, dst.clone(), node.id, frame_i);151 self.cache.insert(key, dst.clone(), node.id, frame_i);
152 dst152 dst
153 }153 }
154
155 #[allow(clippy::too_many_arguments)]
156 pub(super) fn eval_hexagon_tiles(
157 &mut self,
158 comp: &Comp,
159 node: &Node,
160 time: f64,
161 frame_i: i64,
162 comp_dims: [u32; 2],
163 enc: &mut wgpu::CommandEncoder,
164 visiting: &mut HashSet<(NodeId, i64)>,
165 stats: &mut EvalStats,
166 ) -> CachedTexture {
167 let use_ff = comp.eval_number(node, "UseFrameFormatSettings", time, 0.0, &self.expr) > 0.5;
168 let w = if use_ff {
169 comp.width
170 } else {
171 comp.eval_number(node, "Width", time, comp.width as f64, &self.expr).round().max(1.0) as u32
172 };
173 let h = if use_ff {
174 comp.height
175 } else {
176 comp.eval_number(node, "Height", time, comp.height as f64, &self.expr).round().max(1.0) as u32
177 };
178 let size = if w == comp.width && h == comp.height { comp_dims } else { self.scaled_dims(w, h) };
179 let depth = self.node_depth(comp, node, time, None);
180
181 let hex_size = comp.eval_number(node, "Size", time, 5.0, &self.expr) as f32;
182 let border = comp.eval_number(node, "BorderSize", time, 2.0, &self.expr) as f32;
183 let xoff = comp.eval_number(node, "XOff", time, 0.0, &self.expr).round() as f32;
184 let yoff = comp.eval_number(node, "YOff", time, 0.0, &self.expr).round() as f32;
185 let r1 = comp.eval_number(node, "Red1", time, 0.2, &self.expr) as f32;
186 let g1 = comp.eval_number(node, "Green1", time, 0.2, &self.expr) as f32;
187 let b1 = comp.eval_number(node, "Blue1", time, 0.8, &self.expr) as f32;
188 let r2 = comp.eval_number(node, "Red2", time, 0.8, &self.expr) as f32;
189 let g2 = comp.eval_number(node, "Green2", time, 0.2, &self.expr) as f32;
190 let b2 = comp.eval_number(node, "Blue2", time, 0.2, &self.expr) as f32;
191 let blend = comp.eval_number(node, "Blend", time, 1.0, &self.expr) as f32;
192
193 let (mask, mask_inv) = self.eval_mask_input_sized(comp, node, time, Some(size), enc, visiting, stats);
194 let mask_hash = mask.as_ref().map_or(0, |m| m.content_hash);
195
196 let mut u = UniformParams::default();
197 u.p[0] = [hex_size, border, xoff, yoff];
198 u.p[1] = [r1, g1, b1, 1.0];
199 u.p[2] = [r2, g2, b2, 1.0];
200 u.p[3] = [blend, if mask.is_some() { 1.0 } else { 0.0 }, if mask_inv { 1.0 } else { 0.0 }, 0.0];
201
202 let key = self.make_key(node, "HexagonTiles", size, &[mask_hash, depth as u64], bytemuck::cast_slice(&u.p[..4]));
203 if let Some(hit) = self.cache.get(key, node.id, frame_i) {
204 stats.cache_hits += 1;
205 return hit;
206 }
207 stats.cache_misses += 1;
208 stats.nodes_evaluated += 1;
209 let dst = self.alloc_tex(size, depth, key);
210 let mv = mask.as_ref().map_or(&self.dummy.view, |m| &m.view);
211 self.dispatch_op(enc, ShaderOp::HexagonTiles, &self.dummy.view, &self.dummy.view, mv, &dst, &u);
212 self.cache.insert(key, dst.clone(), node.id, frame_i);
213 dst
214 }
154}215}
155216
156#[cfg(test)]217#[cfg(test)]
...@@ -416,4 +477,127 @@ mod tests {...@@ -416,4 +477,127 @@ mod tests {
416 assert!(rgba.chunks(4).all(|p| p == [128, 64, 0, 255]), "default Smooth/Feathering keep a flat field flat");477 assert!(rgba.chunks(4).all(|p| p == [128, 64, 0, 255]), "default Smooth/Feathering keep a flat field flat");
417 assert_eq!(render(&c, "Bare", 0.0).unwrap().0, [1, 1]);478 assert_eq!(render(&c, "Bare", 0.0).unwrap().0, [1, 1]);
418 }479 }
480
481 #[allow(clippy::too_many_arguments)]
482 fn hexagon_tiles_f64_eval(
483 w: u32,
484 h: u32,
485 col: u32,
486 row: u32,
487 size: f64,
488 border: f64,
489 xoff: f64,
490 yoff: f64,
491 c1: [f64; 3],
492 c2: [f64; 3],
493 ) -> ([u8; 4], f64) {
494 let lua_mod = |a: f64, b: f64| a - (a / b).floor() * b;
495 let to_u8 = |v: f64| (v.clamp(0.0, 1.0) * 255.0).round() as u8;
496 let fw = f64::from(w);
497 let fh = f64::from(h);
498 let img_aspect = fw / fh;
499 // readback_rgba is top-down; Fusion Image:SetPixel y=0 is bottom row.
500 let x = f64::from(col);
501 let y = f64::from(h - 1 - row);
502 let ix0 = ((x + xoff) / fw * size) * 0.57735 * 2.0;
503 let iy0 = (((y / img_aspect) + yoff) / fh * size) + (lua_mod(ix0.floor(), 2.0) * 0.5);
504 let ix = (lua_mod(ix0, 1.0) - 0.5).abs();
505 let iy = (lua_mod(iy0, 1.0) - 0.5).abs();
506 let h_val = ((ix * 1.5 + iy).max(iy * 2.0) - 1.0).abs();
507 let rgb = if h_val > 0.05 * border { c1 } else { c2 };
508 ([to_u8(rgb[0]), to_u8(rgb[1]), to_u8(rgb[2]), 255], h_val)
509 }
510
511 #[allow(clippy::too_many_arguments)]
512 fn hexagon_tiles_f64_ref(
513 w: u32,
514 h: u32,
515 size: f64,
516 border: f64,
517 xoff: f64,
518 yoff: f64,
519 c1: [f64; 3],
520 c2: [f64; 3],
521 ) -> Vec<u8> {
522 let mut out = vec![0u8; (w * h * 4) as usize];
523 for row in 0..h {
524 for col in 0..w {
525 let (px, _) = hexagon_tiles_f64_eval(w, h, col, row, size, border, xoff, yoff, c1, c2);
526 let idx = ((row * w + col) * 4) as usize;
527 out[idx..idx + 4].copy_from_slice(&px);
528 }
529 }
530 out
531 }
532
533 #[test]
534 fn hexagon_tiles_matches_f64_reference_for_defaults_and_negative_offsets() {
535 let c = comp(
536 r#"DefaultHex = Fuse.HexagonTiles { Inputs = {
537 Width = Input { Value = 128, },
538 Height = Input { Value = 96, },
539 }, },
540 CrazyHex = Fuse.HexagonTiles { Inputs = {
541 Width = Input { Value = 192, },
542 Height = Input { Value = 108, },
543 Size = Input { Value = 16.56, },
544 BorderSize = Input { Value = 2.0, },
545 XOff = Input { Value = -148, },
546 YOff = Input { Value = -37, },
547 Red1 = Input { Value = 0, },
548 Green1 = Input { Value = 0.495, },
549 Blue1 = Input { Value = 0.8, },
550 Red2 = Input { Value = 0, },
551 Green2 = Input { Value = 0.2, },
552 Blue2 = Input { Value = 0.2, },
553 }, },
554 MaskedHex = Fuse.HexagonTiles { Inputs = {
555 Width = Input { Value = 64, },
556 Height = Input { Value = 64, },
557 Blend = Input { Value = 0.5, },
558 }, },"#,
559 );
560
561 let Some((def_size, def_px)) = render(&c, "DefaultHex", 0.0) else { return };
562 assert_eq!(def_size, [128, 96]);
563 let def_ref = hexagon_tiles_f64_ref(128, 96, 5.0, 2.0, 0.0, 0.0, [0.2, 0.2, 0.8], [0.8, 0.2, 0.2]);
564 assert_eq!(def_px, def_ref, "DefaultHex must match f64 reference pixel-for-pixel");
565
566 let (crazy_size, crazy_px) = render(&c, "CrazyHex", 0.0).unwrap();
567 assert_eq!(crazy_size, [192, 108]);
568 let crazy_ref = hexagon_tiles_f64_ref(192, 108, 16.56, 2.0, -148.0, -37.0, [0.0, 0.495, 0.8], [0.0, 0.2, 0.2]);
569 assert_eq!(crazy_px, crazy_ref, "CrazyHex with negative XOff/YOff must match f64 reference pixel-for-pixel");
570
571 let (mask_size, mask_px) = render(&c, "MaskedHex", 0.0).unwrap();
572 assert_eq!(mask_size, [64, 64]);
573 assert!(mask_px.chunks(4).all(|p| p[3] == 128), "Blend=0.5 scales alpha to 0.5");
574 }
575
576 #[test]
577 fn hexagon_tiles_in_30_ground_is_crazy005_evaluates_with_no_unsupported_nodes() {
578 let path = std::path::Path::new("/Volumes/Project/trees/fusion/30_ground_is_crazy005.comp");
579 if !path.exists() {
580 return;
581 }
582 let comp = Comp::from_fusion_file(path).expect("load 30_ground_is_crazy005.comp");
583 let hex_id = comp.find_node("HexagonTiles1").expect("HexagonTiles1 node");
584 let Ok(mut eng) = Engine::new_headless() else { return };
585 let (tex, stats) = eng.evaluate(&comp, hex_id, 3107.0);
586 assert!(stats.unsupported_nodes.is_empty(), "unexpected unsupported_nodes: {:?}", stats.unsupported_nodes);
587 assert_eq!(tex.size, [1920, 1080]);
588 let gpu_px = eng.readback_rgba(&tex).unwrap();
589 let mut diffs = 0usize;
590 for row in 0..1080u32 {
591 for col in 0..1920u32 {
592 let idx = ((row * 1920 + col) * 4) as usize;
593 let g = &gpu_px[idx..idx + 4];
594 let (r, h_val) = hexagon_tiles_f64_eval(1920, 1080, col, row, 16.56, 2.0, -148.0, 0.0, [0.0, 0.495, 0.8], [0.0, 0.2, 0.2]);
595 if g != r {
596 assert!((h_val - 0.1).abs() < 1e-6, "non-boundary mismatch at ({col}, {row}): h={h_val}, gpu={g:?}, ref={r:?}");
597 diffs += 1;
598 }
599 }
600 }
601 assert!(diffs <= 4, "expected at most 4 f32-ULP boundary diffs across 1920x1080, got {diffs}");
602 }
419}603}
crates/engine/src/eval/mod.rs+4-3
...@@ -842,6 +842,7 @@ impl Engine {...@@ -842,6 +842,7 @@ impl Engine {
842 "Fuse.CheckerPieceGenerator" => self.eval_checker_piece(comp, node, time, frame_i, enc, stats),842 "Fuse.CheckerPieceGenerator" => self.eval_checker_piece(comp, node, time, frame_i, enc, stats),
843 "Fuse.AlphaWeightedNoise" => self.eval_alpha_weighted_noise(comp, node, time, frame_i, enc, visiting, stats),843 "Fuse.AlphaWeightedNoise" => self.eval_alpha_weighted_noise(comp, node, time, frame_i, enc, visiting, stats),
844 "Fuse.Crystallize" => self.eval_crystallize(comp, node, time, frame_i, enc, visiting, stats),844 "Fuse.Crystallize" => self.eval_crystallize(comp, node, time, frame_i, enc, visiting, stats),
845 "Fuse.HexagonTiles" => self.eval_hexagon_tiles(comp, node, time, frame_i, comp_dims, enc, visiting, stats),
845 "sRender" => self.eval_s_render(comp, node, time, frame_i, comp_dims, enc, visiting, stats),846 "sRender" => self.eval_s_render(comp, node, time, frame_i, comp_dims, enc, visiting, stats),
846 "sNGon"847 "sNGon"
847 | "sRectangle"848 | "sRectangle"
...@@ -1075,7 +1076,7 @@ mod lazy_shader_verify {...@@ -1075,7 +1076,7 @@ mod lazy_shader_verify {
1075 ShaderOp::Plasma, ShaderOp::FilmGrain, ShaderOp::SetDomain, ShaderOp::ChangeDepth,1076 ShaderOp::Plasma, ShaderOp::FilmGrain, ShaderOp::SetDomain, ShaderOp::ChangeDepth,
1076 ShaderOp::Vortex, ShaderOp::KScope, ShaderOp::Drip, ShaderOp::Dent,1077 ShaderOp::Vortex, ShaderOp::KScope, ShaderOp::Drip, ShaderOp::Dent,
1077 ShaderOp::PerspectivePos, ShaderOp::DaySky, ShaderOp::GridWarp, ShaderOp::CheckerPiece,1078 ShaderOp::PerspectivePos, ShaderOp::DaySky, ShaderOp::GridWarp, ShaderOp::CheckerPiece,
1078 ShaderOp::AlphaWeightedNoise, ShaderOp::Crystallize, ShaderOp::RemoveNoise, ShaderOp::DeltaKeyer,1079 ShaderOp::AlphaWeightedNoise, ShaderOp::Crystallize, ShaderOp::HexagonTiles, ShaderOp::RemoveNoise, ShaderOp::DeltaKeyer,
1079 ];1080 ];
1080 // Verify starts completely empty (lazy!)1081 // Verify starts completely empty (lazy!)
1081 assert_eq!(eng.pipelines.borrow().modules.len(), 0);1082 assert_eq!(eng.pipelines.borrow().modules.len(), 0);
...@@ -1085,9 +1086,9 @@ mod lazy_shader_verify {...@@ -1085,9 +1086,9 @@ mod lazy_shader_verify {
1085 eng.pipelines_for(BitDepth::Float16).borrow_mut().ensure_pipeline(&eng.device, op);1086 eng.pipelines_for(BitDepth::Float16).borrow_mut().ensure_pipeline(&eng.device, op);
1086 }1087 }
1087 assert_eq!(eng.pipelines.borrow().modules.len(), 7);1088 assert_eq!(eng.pipelines.borrow().modules.len(), 7);
1088 assert_eq!(eng.pipelines.borrow().pipelines.len(), 52);1089 assert_eq!(eng.pipelines.borrow().pipelines.len(), 53);
1089 assert_eq!(eng.pipelines_for(BitDepth::Float16).borrow().modules.len(), 7);1090 assert_eq!(eng.pipelines_for(BitDepth::Float16).borrow().modules.len(), 7);
1090 assert_eq!(eng.pipelines_for(BitDepth::Float16).borrow().pipelines.len(), 52);1091 assert_eq!(eng.pipelines_for(BitDepth::Float16).borrow().pipelines.len(), 53);
1091 }1092 }
10921093
1093 #[test]1094 #[test]
crates/engine/src/eval/registry.rs+4-1
...@@ -98,6 +98,7 @@ pub(super) enum ShaderOp {...@@ -98,6 +98,7 @@ pub(super) enum ShaderOp {
98 CheckerPiece,98 CheckerPiece,
99 AlphaWeightedNoise,99 AlphaWeightedNoise,
100 Crystallize,100 Crystallize,
101 HexagonTiles,
101 RemoveNoise,102 RemoveNoise,
102 DeltaKeyer,103 DeltaKeyer,
103}104}
...@@ -164,7 +165,8 @@ impl ShaderOp {...@@ -164,7 +165,8 @@ impl ShaderOp {
164 | Self::GridWarp165 | Self::GridWarp
165 | Self::CheckerPiece166 | Self::CheckerPiece
166 | Self::AlphaWeightedNoise167 | Self::AlphaWeightedNoise
167 | Self::Crystallize => ShaderDomain::ArchiveFx,168 | Self::Crystallize
169 | Self::HexagonTiles => ShaderDomain::ArchiveFx,
168 }170 }
169 }171 }
170172
...@@ -222,6 +224,7 @@ impl ShaderOp {...@@ -222,6 +224,7 @@ impl ShaderOp {
222 Self::CheckerPiece => "checker_piece_op",224 Self::CheckerPiece => "checker_piece_op",
223 Self::AlphaWeightedNoise => "alpha_weighted_noise_op",225 Self::AlphaWeightedNoise => "alpha_weighted_noise_op",
224 Self::Crystallize => "crystallize_op",226 Self::Crystallize => "crystallize_op",
227 Self::HexagonTiles => "hexagon_tiles_op",
225 Self::RemoveNoise => "remove_noise_op",228 Self::RemoveNoise => "remove_noise_op",
226 Self::DeltaKeyer => "delta_keyer_op",229 Self::DeltaKeyer => "delta_keyer_op",
227 }230 }
crates/engine/src/shaders/archive_fx.wgsl+40-1
...@@ -320,7 +320,7 @@ fn grid_warp_op(@builtin(global_invocation_id) gid: vec3<u32>) {...@@ -320,7 +320,7 @@ fn grid_warp_op(@builtin(global_invocation_id) gid: vec3<u32>) {
320}320}
321321
322// ============================================================================322// ============================================================================
323// Fuses: CheckerPieceGenerator, AlphaWeightedNoise, Crystallize323// Fuses: CheckerPieceGenerator, AlphaWeightedNoise, Crystallize, HexagonTiles
324// ============================================================================324// ============================================================================
325325
326// 6. CheckerPieceGenerator: nearest-neighbor 2x2 board, color A at bottom-left & top-right.326// 6. CheckerPieceGenerator: nearest-neighbor 2x2 board, color A at bottom-left & top-right.
...@@ -471,3 +471,42 @@ fn crystallize_op(@builtin(global_invocation_id) gid: vec3<u32>) {...@@ -471,3 +471,42 @@ fn crystallize_op(@builtin(global_invocation_id) gid: vec3<u32>) {
471 store_dst(gp, textureLoad(src_a, gp, 0));471 store_dst(gp, textureLoad(src_a, gp, 0));
472 }472 }
473}473}
474
475// 9. HexagonTiles (100% bit-exact port of Reactor HexagonTiles.fuse)
476// p[0] = (size, border_size, xoff, yoff)
477// p[1] = (red1, green1, blue1, 1.0)
478// p[2] = (red2, green2, blue2, 1.0)
479// p[3] = (blend, has_mask, mask_invert, 0.0)
480@compute @workgroup_size(8, 8)
481fn hexagon_tiles_op(@builtin(global_invocation_id) gid: vec3<u32>) {
482 let dims = textureDimensions(dst_tex);
483 if (gid.x >= dims.x || gid.y >= dims.y) { return; }
484 let p = vec2<i32>(gid.xy);
485 let blend = u.p[3].x;
486 let m = select(clamp(read_mask(gid.xy, dims, u.p[3].y, u.p[3].z) * blend, 0.0, 1.0), 0.0, blend <= 0.0);
487 if (m <= 0.0) {
488 store_dst(p, vec4<f32>(0.0));
489 return;
490 }
491
492 let fw = f32(dims.x);
493 let fh = f32(dims.y);
494 let img_aspect = fw / fh;
495 let fx = f32(gid.x);
496 let fy = f32(dims.y - 1u - gid.y);
497 let size = u.p[0].x;
498 let border = u.p[0].y;
499 let xoff = u.p[0].z;
500 let yoff = u.p[0].w;
501
502 // Lua `%` is FLOORED modulo: a % b == a - floor(a / b) * b.
503 let ix0 = ((fx + xoff) / fw * size) * 0.57735 * 2.0;
504 let fl_ix = floor(ix0);
505 let parity = fl_ix - 2.0 * floor(fl_ix * 0.5);
506 let iy0 = (((fy / img_aspect) + yoff) / fh * size) + parity * 0.5;
507 let ix = abs(fract(ix0) - 0.5);
508 let iy = abs(fract(iy0) - 0.5);
509 let h = abs(max(ix * 1.5 + iy, iy * 2.0) - 1.0);
510 let col = select(vec4<f32>(u.p[2].rgb, 1.0), vec4<f32>(u.p[1].rgb, 1.0), h > 0.05 * border);
511 store_dst(p, col * m);
512}
crates/model/src/comp.rs+1
...@@ -145,6 +145,7 @@ pub fn is_supported_tool(kind: &str) -> bool {...@@ -145,6 +145,7 @@ pub fn is_supported_tool(kind: &str) -> bool {
145 | "Fuse.AlphaWeightedNoise"145 | "Fuse.AlphaWeightedNoise"
146 | "Fuse.CheckerPieceGenerator"146 | "Fuse.CheckerPieceGenerator"
147 | "Fuse.Crystallize"147 | "Fuse.Crystallize"
148 | "Fuse.HexagonTiles"
148 // 2D vector shape pipeline149 // 2D vector shape pipeline
149 | "sRender"150 | "sRender"
150 | "sNGon"151 | "sNGon"
scripts/gen_compatibility.py+3-2
...@@ -79,6 +79,7 @@ TOOL_METADATA: Sequence[ToolMeta] = (...@@ -79,6 +79,7 @@ TOOL_METADATA: Sequence[ToolMeta] = (
79 ToolMeta("Loader", "Generators", "All suites", "0.0%", "—"),79 ToolMeta("Loader", "Generators", "All suites", "0.0%", "—"),
80 ToolMeta("DaySky", "Generators", "Unit tests", "0.4%–1.1%", "—"),80 ToolMeta("DaySky", "Generators", "Unit tests", "0.4%–1.1%", "—"),
81 ToolMeta("Fuse.CheckerPieceGenerator", "Generators", "Unit tests", "0.0%", "—"),81 ToolMeta("Fuse.CheckerPieceGenerator", "Generators", "Unit tests", "0.0%", "—"),
82 ToolMeta("Fuse.HexagonTiles", "Generators", "Unit tests", "0.0%", "—"),
8283
83 # Compositing & Blending84 # Compositing & Blending
84 ToolMeta("Merge", "Compositing & Blending", "`merge`", "0.0%–0.3%", "—"),85 ToolMeta("Merge", "Compositing & Blending", "`merge`", "0.0%–0.3%", "—"),
...@@ -572,14 +573,14 @@ def build_markdown(...@@ -572,14 +573,14 @@ def build_markdown(
572 "GroupOperator", "MacroOperator", "PipeRouter", "InvertColor",573 "GroupOperator", "MacroOperator", "PipeRouter", "InvertColor",
573 "PolylineStroke", "Multistroke", "OpticalFlow", "pDrag",574 "PolylineStroke", "Multistroke", "OpticalFlow", "pDrag",
574 "Fuse.AlphaWeightedNoise", "Fuse.CheckerPieceGenerator", "Fuse.Colorize",575 "Fuse.AlphaWeightedNoise", "Fuse.CheckerPieceGenerator", "Fuse.Colorize",
575 "Fuse.Cryptomatte", "Fuse.Crystallize", "Fuse.KScope", "Fuse.Outline",576 "Fuse.Cryptomatte", "Fuse.Crystallize", "Fuse.HexagonTiles", "Fuse.KScope", "Fuse.Outline",
576 "Fuse.Switch", "Fuse.SwitchElse", "Fuse.XGlow", "Fuse.XfChroma",577 "Fuse.Switch", "Fuse.SwitchElse", "Fuse.XGlow", "Fuse.XfChroma",
577 }578 }
578 builtin_supported = len(all_supported_tools - non_stock_builtin)579 builtin_supported = len(all_supported_tools - non_stock_builtin)
579 builtin_pct = 100.0 * builtin_supported / fusion_builtin_total580 builtin_pct = 100.0 * builtin_supported / fusion_builtin_total
580 reactor_fuses_total = 1031581 reactor_fuses_total = 1031
581 reactor_supported = sorted(582 reactor_supported = sorted(
582 t for t in ("Fuse.XGlow", "Fuse.Cryptomatte", "Fuse.XfChroma", "Fuse.Switch", "Fuse.SwitchElse")583 t for t in ("Fuse.XGlow", "Fuse.Cryptomatte", "Fuse.XfChroma", "Fuse.Switch", "Fuse.SwitchElse", "Fuse.HexagonTiles")
583 if t in all_supported_tools584 if t in all_supported_tools
584 )585 )
585 reactor_pct = 100.0 * len(reactor_supported) / reactor_fuses_total586 reactor_pct = 100.0 * len(reactor_supported) / reactor_fuses_total