Repository navigation
feat(graphics): port vec2 math to Rust obs-graphics crate (#8) - #39
Merged
Merged
Conversation
Adds the obs-graphics crate with Vec2 abs/floor/ceil/len/close/norm, no_mangle vec2_* shims swapped in under ENABLE_RUST_LIBOBS, a C oracle for bit-exact parity, a cmocka test_vec2 characterization test, and export-list coverage of every crate. Refs #8
This was referenced Oct 9, 2026
Closed
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #8
Phase 5 (graphics math), vec2 slice.
rust/obs-graphicscrate: safeVec2core (abs/floor/ceil/len/close/norm) plus#[unsafe(no_mangle)]vec2_*C ABI shims. Each shim reads its input before writing dst, so aliasing dst and src works.libobs/CMakeLists.txt:graphics/vec2.cis compiled only whenENABLE_RUST_LIBOBSis OFF. The five symbols are added torust-exports.txt, andexport_listnow scans everyrust/*/src/ffi.oracle/vec2.cis the unmodifiedgraphics/vec2.cwith its symbols renamed. It is built with-ffp-contract=offon non-MSVC compilers so clang/aarch64 FMA fusion cannot break bit-exact parity.tests/vec2.rs, Tier 2tests/vec2_layout.rsand cmockatest/cmocka/test_vec2.c, Tier 3tests/vec2_parity.rs(proptest plus a deterministiccloseepsilon-boundary case).Verification (local):
soldr cargo test -p obs-graphics,soldr cargo test -p obs-util --test export_list,soldr cargo build -p obs-c-oracle: pass.normforced toSome(self)makesnorm_matches_c_oraclefail.<=changed to<inclosemakesclose_boundary_matches_c_oraclefail. Both reverted../lint(rustfmt, clippy -D warnings, clang-format, gersemi): ok../unittest: rust-test ok. tier2-linux ran test_vec2 with ENABLE_RUST_LIBOBS OFF and ON, and the libobs exported symbols are identical OFF vs ON (1752).-ffp-contract=offis checked by the Rust Tests (macos-26) CI job; it was not run locally.