Skip to content

rust: Characterize and port graphics/matrix4.c #150

Closed

Description

@zackees

No cmocka test exists. matrix4 uses SIMD (SIMDe), so the policy allows a per-function ULP tolerance: document it in the parity test file. Characterization test first, then the port after matrix3.

Acceptance: follows docs/rust-port/testing-policy.md. RED commit (Tier 1 on a todo!() core, plus the C characterization test if missing) then GREEN; Tier 2 passes with ENABLE_RUST_LIBOBS OFF and ON with identical exports; Tier 3 parity against the C oracle; intentional differences listed in the parity test header and rust/README.md.

Claim before coding: comment on this issue and add the claimed label (or ask a maintainer to). Check open PRs first (gh pr list --search "<unit>").

Activity

  1. added
    enhancement
    port
    on Oct 10, 2026
  2. nathan-v commented on Oct 11, 2026

    @nathan-v
    Contributor

    Claiming: graphics/matrix4.c (#150).

    Plan, one PR (port/matrix4), three commits:

    1. Characterization cmocka test test/cmocka/test_matrix4.c (fragment tests.d/test_matrix4.cmake). Pins the current C behavior, including the singular matrix4_inv leaving dst unchanged and matrix4_*_i taking the translation row from the right-hand matrix.
    2. RED: Tier 1 tests in rust/obs-graphics/tests/matrix4.rs against stubs that return an all-zero matrix, 0.0, or Some(zero) for try_inv.
    3. GREEN: safe core in obs-graphics::matrix4, C shims for the EXPORT symbols (not matrix4_mul_4x3_only, which is file-local), layout test, bit-exact Tier 3 parity (SSE transpose and vec4_dot only move or sum lanes; no ULP slack), ENABLE_RUST_LIBOBS guard, and rust-exports.d/obs-graphics-matrix4.txt.

    matrix3 is already on master. Header-inline helpers stay in matrix4.h. First PR today.

    Docker is not available on this machine, so Tier 2 OFF/ON runs in CI.

  3. zackees commented on Oct 11, 2026

    @zackees
    MemberAuthor

    Done in #227 (merged). graphics/matrix4.c is ported to obs-graphics::matrix4 and swapped under ENABLE_RUST_LIBOBS, with characterization, Tier 1, layout and parity tests. Tier 2 passed 73 of 73 with ENABLE_RUST_LIBOBS OFF and 73 of 73 with it ON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementport

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions