Skip to content

rust: Port graphics/graphics-samplerstate-lifecycle.c.h to obs-graphics #5149

Closed

Description

@zackees

Unit

Port libobs/graphics/graphics-samplerstate-lifecycle.c.h to obs-graphics: gs_samplerstate_create and gs_samplerstate_destroy. Phase 6 graphics API boundary, following the C-only characterization and verbatim extraction in #5128. This is the whole-file Rust swap, not another extraction or sampler conversion/binding port.

Phase and position

Use the existing Graphics category binary obs-tests-graphics; add modules, never another Rust test executable. Keep the public libobs C API/ABI and unchanged C++ OBS WebSocket plugin compatible.

Dependencies and existing tests

Implementation waits for #5128's prerequisite PR #5148 (#5148) to merge. The new immutable Tier 2 baseline is test/cmocka/test_samplerstate_lifecycle.c, its tests.d pointer, and the sorted native graph entry. Retain all assertions unchanged against both C-reference and hybrid libobs. Existing sampler conversion and sampler binding/default binding ports cover different entry points.

Mirror all four characterization cases in safe Rust Tier 1, committing and running RED before GREEN. Pin exact LOG_DEBUG diagnostics and counts, context validation before argument validation and dispatch, NULL-info rejection, context-required but otherwise silent NULL destruction, original device/info/opaque-handle identity, unmodified settings, NULL and non-NULL creation results, exact callback counts/order, repeated destruction forwarding, and no wrapper-side allocation/free or lifecycle tracking.

Notes and acceptance

Keep TLS/context validation and backend-table access C-owned behind a minimal private adapter; Rust contains the behavior decisions. Add any required real-adapter link-support fragments to every affected Rust-static consumer, never placeholder stubs. Check NULL before field-accessor adapters. Preserve all original read/callback ordering and signatures. No public-header, existing-C-test, WebSocket plugin or workflow changes.

Add original-C Tier 3 differential coverage through an oracle with renamed symbols, and demonstrate a mutation is detected. Move this entire C source to the reference-only ported group using per-unit source metadata; retain the original C oracle/reference baseline. Preserve all inventories and sorted groups/test graph. Run unchanged Tier 2 against both libraries, compare dynamic exports, run the whole native_build:: module, lint, and applicable Windows MSVC linkage. Tier 4 is inapplicable to these non-protocol wrappers.

Use soldr for every Rust command, uv for Python, and ./push for publication. No intentional behavior differences. No user-visible behavior change or features-ledger entry is expected. Refs #5128; do not auto-close the prerequisite via a PR body.

Activity

  1. added
    portPort a C unit to Rust (four-tier policy)
    readyMeets the definition of Ready; claimable
    P2Normal priority
    on Nov 18, 2026
  2. zackees commented on Nov 18, 2026

    @zackees
    MemberAuthor

    Claiming: sampler-state lifecycle Rust swap in pool slot obs-studio5.

    1. Mirror the four immutable C cases in the Graphics category and commit/run RED.
    2. Add a safe Rust core, thin FFI/private C adapter, original-C differential coverage and sorted per-port registrations.
    3. Validate Tier 2 OFF/ON and exports, all Graphics/native_build tests, Windows linkage and lint; check overlap with graphics: port legacy image-file data orchestration to Rust (Refs #5145) #5155 before publication.
      First PR expected after local GREEN validation this session; Refs rust: Port graphics/graphics-samplerstate-lifecycle.c.h to obs-graphics #5149.
  3. zackees commented on Nov 19, 2026

    @zackees
    MemberAuthor

    Landed on master in #5164 (5fce766): the graphics sampler-state lifecycle entry points now run in safe Rust in obs-graphics, with the unchanged C characterization passing against the hybrid and a differential test against the oracle.

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

Metadata

Metadata

Assignees

Labels

P2Normal priorityportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimablesize:SHours

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions