Skip to content

rust: port scene bounds placement to obs-scene - #1661

Merged
zackees merged 2 commits into
obs-rust:masterfrom
nathan-v:port/scene-bounds-place
Oct 22, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
nathan-v:port/scene-bounds-place

Conversation

@nathan-v

@nathan-v nathan-v commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1637

Ports the characterized placement half of scene bounds into obs-scene::bounds_place: scale fitting, alignment, optional crop and flip adjustment. Absolute/relative bounds resolution stays in the scene. obs_bounds_place and add_alignment retain their internal C signatures and hidden visibility. No public headers or existing C tests change, and no user-visible behavior change is intended.

The original C source remains in a reference-only unity group and the renamed oracle. The unchanged test_scene_bounds_place.c still characterizes the C implementation, and a second executable links the same source directly against the Rust archive to test the private Rust symbols without exporting them.

RED and GREEN

  • RED d6c45b532 (original published RED 3b9c0ae73): soldr cargo test -p obs-data --test obs-tests-core scene::bounds_place --locked — 0 passed, 16 failed on safe-core stubs. All existing cmocka assertions are mirrored in Tier 1.
  • GREEN 8b90c9d22 (rebased from 2baade1d8): safe implementation plus thin ABI shims, real obs.h crop layout measurements (size, alignment, every field offset), and exact C differential checks. The existing graphics suite covers vec2 ABI layout.
  • Focused tests: 20 passed. Differential properties run 2,048 cases each, plus deterministic threshold, rounding, flip, alignment-mask and zero-dimension coverage.
  • Mutation check: changing flipped-center origin multiplication from 2 to 3 makes thresholds_flips_and_rounding_match_c fail. Restored core: 20 passed.
  • No intentional differences for C-defined inputs. Differential inputs exclude undefined nonfinite/out-of-range float-to-integer conversions; Rust saturates those conversions. This boundary is recorded in the tests, Rust README and issue.

Validation

  • Current rebased head: native workspace 2,020 tests passed, 1 existing ignored, plus doctests; the remaining lint lane passed again. Earlier full native/macOS/Linux local runs below preceded the conflict-only rebase. git range-diff confirms unchanged RED tests and unchanged placement implementation; only shared symbol-list context changed.
  • Workspace Clippy -D warnings, Dylints, rustfmt, pinned clang-format/gersemi, test inventory (eight category binaries), platform/performance ratchets and relevant source-group/registration/policy checks pass.
  • Full ./lint --fix was attempted. macOS host-sensitive CI self-tests fail on Linux-tool assumptions, host/Windows facade compilation and /var versus /private/var paths. An alphabetical registration failure introduced here was fixed; the source-group check passes after staging the new group. The remaining lint lane passes with OBS_GATE_SKIP_SELF_TEST=1.
  • ./unittest passes native workspace tests but cannot cross-link Windows-GNU from this Apple Silicon host. The cross lane fails because its Windows-MSVC compiler cannot find stdio.h. No local attestation is claimed.
  • Native macOS Tier 2: both C-reference and current hybrid framework pass all 199 registered tests (198 passed, 1 existing codec skip) per mode; current exports are identical (1,877 symbols). Homebrew cmocka required a temporary local ENABLE_HARDENED_RUNTIME=NO xcconfig, with no committed signing change. The runner's grep -q/pipefail probe and a stale legacy libobs-with-rust directory required capturing the loader output and selecting the current build_rust/libobs/RelWithDebInfo framework explicitly. The stale framework's unrelated failures disappear on both a separately built master baseline and the current production framework.
  • Linux Docker Tier 2: C-reference mode completed all 352 tests, with 2 scene-geometry failures (test_group_empty_bounds, test_scene_dup_group_children) and 3 existing PulseAudio skips. Both C and Rust-linked placement executables pass. Exports are identical (1,766 symbols). Hybrid mode completed all 352 tests: all scene tests passed, including both geometry cases that failed in C-reference mode. Two timing-sensitive tests (test_output_delay_restart, with 72.9% rendering lag, and test_vlc_audio_pacing) failed in the full run, then both passed in one isolated rerun (48 seconds). Three PulseAudio tests skip in both modes. The full Linux run is therefore not reported as unconditionally green.
  • The pinned local gate was attempted after committing GREEN; it refused to stamp because of the pre-existing plugins/obs-browser worktree difference, which was preserved.
  • Current GREEN head 8b90c9d2205ff8913248d5ab63dbfa455e055632: all selected CI passed, including CI Gate ✅, Fast Gate, repository self-tests, macOS/Windows Rust tests, cross lint, and Tier 2 on Linux/macOS/Windows. Linux OFF and ON each completed 355 registered tests: 352 passed, 3 existing PulseAudio skips, zero failures. macOS completed its 200-test registries and Windows its 175-test registries with zero failures in every reported mode; both placement executables passed throughout. No fixes were needed after the conflict-only rebase. Marked ready after verifying the completed workflow matches this exact head.
  • Tier 4 does not apply to this internal scene math. No feature ledger line is needed for a behavior-preserving port.

@nathan-v
nathan-v force-pushed the port/scene-bounds-place branch from 2baade1 to 8b90c9d Compare October 22, 2026 03:38
@nathan-v

Copy link
Copy Markdown
Contributor Author

Rebased the conflicting head 2baade1d8a23aecb69eed1b70b511da894addf6c onto current master. Preserved both effect-parser and scene-placement hidden symbols. RED is now d6c45b532; GREEN is 8b90c9d22. Range-diff confirms unchanged port logic. Current-head native workspace: 2,020 passed, one existing ignored; native lint/Clippy/Dylint passed. Earlier full local Tier 2 evidence and its limitations remain in the description. Waiting for fresh PR-head CI before marking ready.

@nathan-v
nathan-v marked this pull request as ready for review October 22, 2026 03:59
@nathan-v
nathan-v requested a review from zackees as a code owner October 22, 2026 03:59
@zackees
zackees added this pull request to the merge queue Oct 22, 2026
Merged via the queue into obs-rust:master with commit b095a83 Oct 22, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

rust: Port the scene bounds placement in obs-scene.c to obs-scene

2 participants