Skip to content

libobs: Port obs_bounds_fit_scale to Rust - #1486

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

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

Conversation

@nathan-v

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

Copy link
Copy Markdown
Contributor

Fixes #1468. Characterization landed in #1469. This is the port.

Description

obs_bounds_fit_scale moves into obs-scene-bounds. libobs-with-rust links the shim. obs-scene.c calls it inside libobs. The C file has no EXPORT, so the symbol stays hidden.

None and any other type leave the scale unchanged. Max-only becomes scale-inner only when a scaled side is past the box, and that path does not flip the axis. A zero size on the axis a fit would divide by leaves the scale unchanged. vec2_mulf stays the header inline.

No intentional differences.

Motivation and Context

Phase 6 libobs port of libobs/obs-scene-bounds.c.h. The C file stays, so the C libobs and the cmocka test still compile it. The public header is unchanged.

How Has This Been Tested?

macOS 27.0.1, aarch64. Rust toolchain from rust-toolchain.toml, soldr, SOLDR_RUSTC_WRAPPER=none.

RED → GREEN

  • RED commit: 215a0420c. soldr cargo test -p obs-data --test obs-tests-core scene_bounds:: panicked in 11 tests with not yet implemented: obs_bounds_fit_scale. bounds_type_values_match_obs_h passed.
  • GREEN: 6a727105d. The same filter passed 14 tests: the 12 Tier 1 cases and the two oracle comparisons (cmocka_cases_match_oracle, random_inputs_match_oracle). soldr cargo test --workspace --locked passed. Those runs were this patch. It was rebased onto master afterwards, with no conflict.
  • Mutation: flipping the outer axis onto scale-inner failed tall_source_uses_the_other_axis with ScaleInner: 100x200 at (1, 1) gives (8, 8), expected (3, 3). Reverted.
  • Tier 2 on this Mac is the arm64 Ubuntu 26.04 image obs-rust-linux-validate. The GitHub runner is x86_64. Export sets match, 1766 symbols. OFF loads /build/tree/libobs/libobs.so.30. ON loads /build/tree/libobs-with-rust/libobs.so.30. test_scene_bounds_fit passed OFF. It compiles the C file into the test, so it does not see the swap.
  • OFF ctest: 307 passed, 2 failed, 3 skipped, out of 312. The failures are test_group_empty_bounds (a dragged item at (642, 360)-(843, 460.5), expected (640, 360)-(840, 460)) and test_scene_dup_group_children (the grouped item moved). Both ran against the C libobs. The same two showed up on obs-missing-files: port the missing-file list (Refs #1459) #1465. The lane exits on that ctest status, so ON was run on the same build tree with OBS_TIER2_STAGE=test OBS_TIER2_MODES=ON.
  • ON ctest: 307 passed, the same 2 failed, the same 3 skipped. Same messages. No ON-only failure. test_scene_bounds_fit, test_ws_screenshot_srgb, test_ws_batch_order, test_ws_current_scene_removed, and test_vlc_playlist_gap passed.
  • test_ws_screenshot_srgb does not compile on this Mac until utils is a system include. The Docker mount is case-insensitive, so <obs.h> opens plugins/obs-websocket/src/utils/Obs.h. That change is not in the branch. With it, the test passed OFF. Linux CI checks out a case-sensitive tree, where Obs.h is not obs.h.
  • Host gate pieces: clang-format 22.1.3, ci/test_build_groups.py, ci/test_naming.py, ci/test_ported_sources.py, the test-binary inventory, the platform ratchet, perf guards, soldr cargo fmt --all --check, workspace clippy -D warnings, dylint, and soldr cargo test --workspace --locked. The aarch64-apple-darwin cross lane (clippy, dylint, test --no-run) passed. x86_64-pc-windows-gnu is refused by soldr on macOS aarch64. The msvc cross dies in cc (windows.h and stdio.h not found). ci-lint local-gate run cannot finish here. The ci/ self-tests hit /private/var, a missing readelf, and Apple clang (ci/test_appimage_build_script.py, ci/test_tier2_xvfb_lifetime.py, ci/test_windows_package_arguments.py, ci/test_app_config_identity.py, ci/test_tier2_run.py), and that death comes before rustfmt. Those checks were run on their own. No stamp. The Debug panic=abort check did not run: the lane stops when the pre-existing cmocka failures return.

Types of changes

  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist

Tier 1 mirrors of test_scene_bounds_fit call
bounds_fit_scale, which is still todo!(). Eleven
tests panic with "not yet implemented".

Refs obs-rust#1468
The safe core follows the C branches, including the
max-only strict edge and the outer flip of the
original type. libobs-with-rust links the shim.
The symbol stays hidden. Tier 1 and the oracle
comparison pass. Flipping the outer axis fails
tall_source_uses_the_other_axis.

Refs obs-rust#1468
@nathan-v
nathan-v requested a review from zackees as a code owner October 20, 2026 02:12
@zackees
zackees added this pull request to the merge queue Oct 20, 2026
Merged via the queue into obs-rust:master with commit 57411e8 Oct 20, 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 obs-scene-bounds.c to obs-scene-bounds

2 participants