Skip to content

rust: Port libobs/graphics/graphics-shader-matrix-queries.c.h to obs-graphics #5185

Closed

Description

@zackees

Phase 6, graphics: replace the complete C extraction libobs/graphics/graphics-shader-matrix-queries.c.h with safe Rust in the existing obs-graphics crate after prerequisite PR #5184 (Refs #5132) merges. The prerequisite PR is #5184; its verified GREEN source is ff16e5fd3, signed/pushed as 612fe68.

The unit is gs_shader_get_viewproj_matrix and gs_shader_get_world_matrix. Preserve the public C signatures and diagnostics, context-before-shader validation, exact shader pointer and callback ordering, and borrowed backend result identity, including NULL. TLS context storage, field access, validators and graphics backend ownership remain behind a private C boundary. No GPU, shader compiler or matrix setter behavior belongs in this unit.

The prerequisite adds test/cmocka/test_shader_matrix_queries.c: no-context rejection, NULL-shader rejection inside a context, distinct viewproj/world dispatch with exact shader and parameter pointers, and silent NULL callback results. Keep this C test and all public headers unchanged. Port each assertion 1:1 into safe Rust Tier 1 RED tests in Graphics / obs-tests-graphics, then implement GREEN. Add original-C Tier 3 differential coverage and demonstrate a killed mutant. Run unchanged C tests against C-reference and hybrid libobs and verify exact dynamic export parity. Tier 4 does not apply; preserve the C++ WebSocket plugin.

Use the existing graphics PCH family, per-unit ported-source/export/oracle fragments and current source inventories; maintain sorted unity and test metadata. Register modules in the existing obs-graphics category, adding no Rust test executable. Link any real C adapter into every standalone Rust-static consumer via tests.d link support, never an aborting stub. Check Rust NULL handles before field-accessor calls. Avoid platform-width conversions on c_long (i32 on Windows, i64 on Linux/macOS), max_align_t and out-of-range enum sentinels.

Before publishing run the complete native_build:: module, a focused Linux Tier 2 build of two unrelated *_rust cmocka targets, Windows MSVC linkage and one full ./lint. Follow testing-policy.md, BUILD.md and coordination.md; Rust through soldr, Python through uv, publishing through ./push. Serialize shared graphics/test-graph edits with queued siblings.

Activity

  1. added
    port
    ready
    P2
    size:S
    on Nov 19, 2026
  2. rdoupe commented on Nov 19, 2026

    @rdoupe
    Collaborator

    Claiming: #5185 (swap gs_shader_get_viewproj_matrix and gs_shader_get_world_matrix to safe Rust in obs-graphics).

    Plan, one PR:

    1. RED: mirror test_shader_matrix_queries.c 1:1 as Tier 1 tests in the Graphics binary against todo!() stubs.
    2. GREEN: safe core + thin FFI exports, private C adapters for TLS/validation/dispatch, original-C oracle differential (Tier 3) with a killed mutant, unchanged C test against C-reference and hybrid libobs, export parity.

    First PR expected within a few hours.

  3. rdoupe commented on Nov 19, 2026

    @rdoupe
    Collaborator

    PR is up: #5194 (RED db341b9, GREEN c7dfcbd; Tier 1/2/3 evidence in the body). Auto-merge is armed, so it queues once PR CI is green.

  4. rdoupe commented on Nov 20, 2026

    @rdoupe
    Collaborator

    Done in #5194 (merged): graphics/graphics-shader-matrix-queries.c.h now builds only in its ported group and the entry points are Rust on master. The PR said Refs, so closing by hand.

  5. moved this from In progress to Done in obs-rust Multiviewon Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2portreadysize:S

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions