diff --git a/crates/app/src/add_tool.rs b/crates/app/src/add_tool.rs index 34926c7649c4073d3f0800ebaa634e0424493097..d1be3494212de03c0110a90485d3e83238fded5a 100644 --- a/crates/app/src/add_tool.rs +++ b/crates/app/src/add_tool.rs @@ -129,7 +129,7 @@ pub const TOOL_CATALOG: &[ToolEntry] = &[ ToolEntry { kind: "sEllipse", display: "Shape Ellipse", aliases: "sellipse vector circle oval", category: ToolCategory::Shape2D, is_generator: true }, ToolEntry { kind: "sRectangle", display: "Shape Rectangle", aliases: "srect vector box rounded", category: ToolCategory::Shape2D, is_generator: true }, ToolEntry { kind: "sNGon", display: "Shape NGon", aliases: "sngon vector polygon sides", category: ToolCategory::Shape2D, is_generator: true }, - ToolEntry { kind: "sGrid", display: "Shape Grid", aliases: "sgrid vector cells array", category: ToolCategory::Shape2D, is_generator: true }, + ToolEntry { kind: "sGrid", display: "Shape Grid", aliases: "sgrid vector cells array", category: ToolCategory::Shape2D, is_generator: false }, ToolEntry { kind: "sMerge", display: "Shape Merge", aliases: "smerge vector combine", category: ToolCategory::Shape2D, is_generator: false }, ToolEntry { kind: "sTransform", display: "Shape Transform", aliases: "stransform vector move scale rotate", category: ToolCategory::Shape2D, is_generator: false }, ToolEntry { kind: "sBoolean", display: "Shape Boolean", aliases: "sbool vector union subtract intersect xor", category: ToolCategory::Shape2D, is_generator: false }, diff --git a/crates/app/src/inspector/mod.rs b/crates/app/src/inspector/mod.rs index 3ed26df87126a09b624fc4f9df14a7653a78ba8b..be56416bbc8080c99ebef59081a609c9cf2be9db 100644 --- a/crates/app/src/inspector/mod.rs +++ b/crates/app/src/inspector/mod.rs @@ -482,8 +482,8 @@ mod tests { "TimeStretcher", "TimeSpeed", "Paint", "PaintMask", "WandMask", "BitmapMask", "Drip", "Dent", "DaySky", "GridWarp", "PerspectivePositioner", - "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sMerge", "sOutline", "sGrid", - "MtlBlinn", "MtlPhong", "MtlCookTorrance", "MtlWard", + "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sOutline", "sGrid", + "MtlBlinn", "MtlPhong", "MtlCookTorrance", "LightPoint", "LightSpot", "LightDirectional", "LightAmbient", "Cube3D", "SurfaceFBXMesh", "Custom", "ErodeDilate", "DirectionalBlur", "VariBlur", "Sharpen", "Shadow", diff --git a/crates/app/src/inspector/schemas.rs b/crates/app/src/inspector/schemas.rs index d57a82cf2178f7d5847233eb63d2b6421b7e20a9..03ed481e10c70e118c830ad75ff4ecf2696b8e5b 100644 --- a/crates/app/src/inspector/schemas.rs +++ b/crates/app/src/inspector/schemas.rs @@ -169,11 +169,11 @@ pub const CURATED_TOOL_KINDS: &[&str] = &[ // Paint & Masks "Paint", "PaintMask", "EllipseMask", "RectangleMask", "BitmapMask", "WandMask", // Vector Shapes - "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sMerge", "sOutline", "sGrid", + "sRender", "sEllipse", "sRectangle", "sNGon", "sBoolean", "sTransform", "sOutline", "sGrid", // 3D Scene, Lights & Materials "Camera3D", "Shape3D", "Cube3D", "SurfaceFBXMesh", "LightPoint", "LightSpot", "LightDirectional", "LightAmbient", - "MtlBlinn", "MtlPhong", "MtlCookTorrance", "MtlWard", + "MtlBlinn", "MtlPhong", "MtlCookTorrance", ]; /// Curated Fusion 21.1 parameter schemas for major compositor tools. @@ -528,11 +528,8 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] { boolean("Reverse", "Reverse", false), ] }, "Saver" => const { &[ - boolean("CreateDir", "Create Dir", true), boolean("SetSequenceStart", "Seq Start", false), flt("SequenceStartFrame", "Start Frame", 0.0, 10000.0, 0.0), - boolean("ProcessWhenBlendIs00", "Proc Blend 0", false), - flt("Blend", "Blend", 0.0, 1.0, 1.0), ] }, "TimeStretcher" => const { &[ flt("SourceTime", "Source Time", 0.0, 10000.0, 0.0), @@ -667,9 +664,6 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] { flt("YSize", "Y Size", 0.0, 5.0, 1.0), flt("ZRotation", "Rotation", -360.0, 360.0, 0.0), ] }, - "sMerge" => const { &[ - flt("Blend", "Blend", 0.0, 1.0, 1.0), - ] }, "sOutline" => const { &[ flt("Thickness", "Thickness", 0.0, 0.2, 0.01), int_enum("JoinStyle", "Join", JOIN_STYLES, 2), @@ -788,13 +782,6 @@ pub fn schema_for_kind(kind: &str) -> &'static [ParamSpec] { flt("Specular.Intensity", "Spec Int", 0.0, 4.0, 1.0), flt("Specular.Roughness", "Roughness", 0.05, 1.0, 0.6), ] }, - "MtlWard" => const { &[ - rgba("Diffuse", "Diffuse", "Diffuse.Color.Red", "Diffuse.Color.Green", "Diffuse.Color.Blue", Some("Diffuse.Opacity"), [1.0, 1.0, 1.0, 1.0]), - rgba("Specular", "Specular", "Specular.Color.Red", "Specular.Color.Green", "Specular.Color.Blue", None, [1.0, 1.0, 1.0, 1.0]), - flt("Specular.Intensity", "Spec Int", 0.0, 4.0, 1.0), - flt("Specular.SpreadU", "Spread U", 0.01, 1.0, 0.25), - flt("Specular.SpreadV", "Spread V", 0.01, 1.0, 0.25), - ] }, _ => &[], } } diff --git a/scripts/diff_fuzz/matrix.py b/scripts/diff_fuzz/matrix.py index 364b131ae2b92a2220d28f25ffff9bc600411615..e45df971413af1ca5909aee2747c3e206e880ed7 100644 --- a/scripts/diff_fuzz/matrix.py +++ b/scripts/diff_fuzz/matrix.py @@ -964,7 +964,7 @@ _ASPECT_SETUP = """\t\tBlackBG = Background { Inputs = { Width = Input { Value = _ASPECT_CASES = ( ("BG_Horizontal", 'Background { Inputs = { Width = Input { Value = @W@, }, Height = Input { Value = @H@, }, Type = Input { Value = FuID { "Horizontal" }, }, TopLeftRed = Input { Value = 0.9, }, TopLeftGreen = Input { Value = 0.2, }, TopLeftBlue = Input { Value = 0.1, }, TopLeftAlpha = Input { Value = 1, }, TopRightRed = Input { Value = 0.1, }, TopRightGreen = Input { Value = 0.3, }, TopRightBlue = Input { Value = 0.9, }, TopRightAlpha = Input { Value = 1, }, }, }'), ("BG_Vertical", 'Background { Inputs = { Width = Input { Value = @W@, }, Height = Input { Value = @H@, }, Type = Input { Value = FuID { "Vertical" }, }, TopLeftRed = Input { Value = 0.9, }, TopLeftGreen = Input { Value = 0.2, }, TopLeftBlue = Input { Value = 0.1, }, TopLeftAlpha = Input { Value = 1, }, BottomLeftRed = Input { Value = 0.1, }, BottomLeftGreen = Input { Value = 0.3, }, BottomLeftBlue = Input { Value = 0.9, }, BottomLeftAlpha = Input { Value = 1, }, }, }'), - ("BG_FourCorner", 'Background { Inputs = { Width = Input { Value = @W@, }, Height = Input { Value = @H@, }, Type = Input { Value = FuID { "Four Corner" }, }, TopLeftRed = Input { Value = 1, }, TopLeftAlpha = Input { Value = 1, }, TopRightGreen = Input { Value = 1, }, TopRightAlpha = Input { Value = 1, }, BottomLeftBlue = Input { Value = 1, }, BottomLeftAlpha = Input { Value = 1, }, BottomRightRed = Input { Value = 1, }, BottomRightGreen = Input { Value = 1, }, BottomRightAlpha = Input { Value = 1, }, }, }'), + ("BG_FourCorner", 'Background { Inputs = { Width = Input { Value = @W@, }, Height = Input { Value = @H@, }, Type = Input { Value = FuID { "Corner" }, }, TopLeftRed = Input { Value = 1, }, TopLeftAlpha = Input { Value = 1, }, TopRightGreen = Input { Value = 1, }, TopRightAlpha = Input { Value = 1, }, BottomLeftBlue = Input { Value = 1, }, BottomLeftAlpha = Input { Value = 1, }, BottomRightRed = Input { Value = 1, }, BottomRightGreen = Input { Value = 1, }, BottomRightAlpha = Input { Value = 1, }, }, }'), ("EllipseMask_Circle", 'Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "@MASK@", Source = "Mask", }, }, }', 'EllipseMask { Inputs = { MaskWidth = Input { Value = @W@, }, MaskHeight = Input { Value = @H@, }, Width = Input { Value = 0.5, }, Height = Input { Value = 0.5, }, SoftEdge = Input { Value = 0.02, }, }, }'), ("EllipseMask_Rotated", 'Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "@MASK@", Source = "Mask", }, }, }', diff --git a/scripts/diff_fuzz/runner.py b/scripts/diff_fuzz/runner.py index bf80d6d383e42bbba3153bd26e74bea4f8a3c688..662557d1f75059b9960287f1553d704a7cf59c21 100644 --- a/scripts/diff_fuzz/runner.py +++ b/scripts/diff_fuzz/runner.py @@ -201,6 +201,11 @@ def run_multi_graph_batch( ) +def _exceeds_threshold(m: Dict[str, Any], threshold_pct: float) -> bool: + """Return True if either RGB MAE% or Alpha MAE% exceeds threshold_pct.""" + return m["mae_pct"] > threshold_pct or m.get("alpha_mae_pct", 0.0) > threshold_pct + + def bisect_failing_graph( graph: FuzzGraph, threshold_pct: float, @@ -218,7 +223,7 @@ def bisect_failing_graph( st_comp, st_prefix, [graph.eval_frame], {graph.eval_frame: f"seed_{seed}"}, render_gt=render_gt, timeout_sec=timeout_sec )[graph.eval_frame] orig_mae = st_res["mae_pct"] - if orig_mae <= threshold_pct: + if not _exceeds_threshold(st_res, threshold_pct): return { "seed": seed, "reproduced_standalone": False, @@ -238,7 +243,7 @@ def bisect_failing_graph( prefix_items, f"bisect_s{seed}_prefixes", render_gt=render_gt, timeout_sec=timeout_sec ) for idx, nd in enumerate(non_src): - if pref_res[idx]["mae_pct"] > threshold_pct: + if _exceeds_threshold(pref_res[idx], threshold_pct): cur = graph.prune_to(nd.name) print(f" [prefix] trimmed sink to {nd.name} ({len(cur.nodes)} nodes, MAE={pref_res[idx]['mae_pct']:.2f}%)", flush=True) break @@ -275,7 +280,7 @@ def bisect_failing_graph( failing: List[Tuple[Tuple[int, int, int], str, FuzzGraph, float]] = [] for idx, (desc, _act, cg) in enumerate(candidates): m = cand_res[idx] - if m["mae_pct"] > threshold_pct: + if _exceeds_threshold(m, threshold_pct): mask_cnt = sum(1 for x in cg.nodes if x.mask is not None) spline_cnt = sum( 1 for x in cg.nodes for v in x.params.values() if isinstance(v, SplineParam) @@ -328,7 +333,7 @@ def print_table(title: str, rows: List[Dict[str, Any]], threshold_pct: float) -> elif mae_pct > threshold_pct: status = "FAIL" elif a_pct > threshold_pct: - status = "PASS (ALPHA DIFF)" + status = "FAIL (ALPHA)" else: status = "PASS" print(f" {label:<44s} | {mae_pct:6.2f}% | {a_pct:6.2f}% | {mae:6.2f} | {rmse:6.2f} | {status}") diff --git a/scripts/gen_compatibility.py b/scripts/gen_compatibility.py index f0e54fcb1383540daa111121adc1220fcca083d4..e664928f14e66deec111b88df6bb039d9737cb8c 100755 --- a/scripts/gen_compatibility.py +++ b/scripts/gen_compatibility.py @@ -22,6 +22,7 @@ SCENE3D_DIR_LABEL = "crates/engine/src/scene3d/" SCENE3D_RS = REPO_ROOT / "crates" / "engine" / "src" / "scene3d" / "collect.rs" COMP_RS = REPO_ROOT / "crates" / "model" / "src" / "comp.rs" ADD_TOOL_RS = REPO_ROOT / "crates" / "app" / "src" / "add_tool.rs" +SCHEMAS_RS = REPO_ROOT / "crates" / "app" / "src" / "inspector" / "schemas.rs" PROBES_PY = REPO_ROOT / "scripts" / "fusion_probes.py" DEFAULT_OUTPUT = REPO_ROOT / "compatibility.md" @@ -195,7 +196,7 @@ TOOL_METADATA: Sequence[ToolMeta] = ( ToolMeta("Dimension.CopyAux", "Time, Routing & Utility", "Unit tests", "Visual*", "Passes the RGBA `Input` through unchanged in both `Mode`s. *The engine carries no auxiliary planes (`Z`, `Coverage`, `ObjectID`, `Vector`, ...), so `Channel` is ignored and aux-to-color output is not produced."), ToolMeta("TimeStretcher", "Time, Routing & Utility", "Suite comps", "0.0%–0.2%", "Keyframed/expression `SourceTime` remapping with `Nearest` (`0`), `Blend` (`1`), and GPU `OpticalFlow` (`2`) bidirectional warped interpolation."), ToolMeta("TimeSpeed", "Time, Routing & Utility", "Suite comps", "0.0%", "Constant/animated `Speed` and `Delay` time remapping."), - ToolMeta("Switch", "Time, Routing & Utility", "Suite comps", "0.0%", "Dynamic input routing by `Which` index (`Input1`..`InputN`)."), + ToolMeta("Switch", "Time, Routing & Utility", "Suite comps", "0.0%", "Dynamic input routing by `Source` index (`Input0`..`InputN`)."), ToolMeta("Fuse.Switch", "Time, Routing & Utility", "Suite comps", "0.0%", "Fuse variant of `Switch` routing `Input1`..`InputN` by `Which`."), ToolMeta("PipeRouter", "Time, Routing & Utility", "Suite comps", "0.0%", "Zero-cost graph routing node."), ToolMeta("Fuse.Wireless", "Time, Routing & Utility", "Suite comps", "0.0%", "Wireless link passthrough node."), @@ -311,6 +312,15 @@ def parse_add_tool_catalog(path: Path) -> Set[str]: return set(re.findall(r'ToolEntry\s*\{\s*kind:\s*"([^"]+)"', path.read_text(encoding="utf-8"))) +def parse_curated_tool_kinds(path: Path) -> Set[str]: + """Return every tool kind listed in CURATED_TOOL_KINDS of inspector/schemas.rs.""" + text = path.read_text(encoding="utf-8") + m = re.search(r"const CURATED_TOOL_KINDS:\s*&\[&str\]\s*=\s*&\[(.*?)\];", text, re.S) + if not m: + raise RuntimeError(f"Could not locate CURATED_TOOL_KINDS in {path}") + return set(re.findall(r'"([^"]+)"', re.sub(r"//[^\n]*", "", m.group(1)))) + + def parse_comp_rs_modifiers(path: Path) -> Tuple[List[str], Set[str]]: """Return (declared MODIFIER_TYPES, implemented modifier classes in parse_tools_table).""" text = path.read_text(encoding="utf-8") @@ -413,6 +423,7 @@ def build_markdown( impl_modifiers: Set[str], comp_supported: Set[str], catalog_kinds: Set[str], + curated_kinds: Set[str], probe_suites: Set[str], active_corpus: Optional[Tuple[int, Counter[str]]], archive_corpus: Optional[Tuple[int, Counter[str]]], @@ -470,6 +481,12 @@ def build_markdown( for name in sorted(catalog_kinds & ADD_TOOL_EXCLUDED): warnings.append(f"add_tool.rs TOOL_CATALOG lists {name} which ADD_TOOL_EXCLUDED omits") + # Inspector curated schemas must only reference supported tools in TOOL_METADATA. + for name in sorted(curated_kinds - comp_supported): + warnings.append(f"inspector/schemas.rs CURATED_TOOL_KINDS lists {name} which is not in is_supported_tool()") + for name in sorted(curated_kinds - meta_all_names): + warnings.append(f"inspector/schemas.rs CURATED_TOOL_KINDS lists {name} which is not in TOOL_METADATA") + all_supported_tools = live_engine_tools | non_render_tools all_supported_classes = all_supported_tools | impl_modifiers @@ -619,7 +636,8 @@ def main() -> int: parser.add_argument("-o", "--output", type=Path, default=DEFAULT_OUTPUT, help="Output markdown path.") parser.add_argument("--active-dir", type=Path, default=ACTIVE_CORPUS_DIR, help="Active Fusion .comp directory.") parser.add_argument("--archive-dir", type=Path, default=ARCHIVE_CORPUS_DIR, help="Archive Fusion .comp directory.") - parser.add_argument("--strict", action="store_true", help="Exit non-zero on any registry drift: engine vs TOOL_METADATA vs is_supported_tool vs add_tool.rs.") + parser.add_argument("--strict", action="store_true", help="Exit non-zero on any registry drift: engine vs TOOL_METADATA vs is_supported_tool vs add_tool.rs vs inspector/schemas.rs.") + parser.add_argument("--check", action="store_true", help="Check if compatibility.md is up to date without rewriting it; exit non-zero if out of date.") args = parser.parse_args() eval_tools = parse_eval_rs(EVAL_RS) @@ -636,13 +654,23 @@ def main() -> int: impl_modifiers=impl_modifiers, comp_supported=parse_is_supported_tool(COMP_RS), catalog_kinds=parse_add_tool_catalog(ADD_TOOL_RS), + curated_kinds=parse_curated_tool_kinds(SCHEMAS_RS), probe_suites=probe_suites, active_corpus=active_corpus, archive_corpus=archive_corpus, ) - args.output.write_text(md, encoding="utf-8") - print(f"Wrote {args.output} ({len(md.splitlines())} lines)") + out_of_date = False + if args.check: + existing = args.output.read_text(encoding="utf-8") if args.output.exists() else None + if existing == md: + print(f"{args.output} is up to date ({len(md.splitlines())} lines)") + else: + out_of_date = True + print(f"{args.output} is out of date; run python3 scripts/gen_compatibility.py to update.", file=sys.stderr) + else: + args.output.write_text(md, encoding="utf-8") + print(f"Wrote {args.output} ({len(md.splitlines())} lines)") if active_corpus is not None: print(f" Active corpus: {active_corpus[0]} comps, {sum(active_corpus[1].values()):,} entries") else: @@ -655,7 +683,7 @@ def main() -> int: for w in warnings: print(f"WARNING: {w}", file=sys.stderr) - if args.strict and warnings: + if (args.strict and warnings) or out_of_date: return 1 return 0