Skip to content

graphics: swap sampler-state lifecycle to safe Rust (Refs #5149) - #5164

Merged
zackees merged 3 commits into
masterfrom
port/5149-samplerstate-lifecycle
Nov 19, 2026
Merged

zackees merged 3 commits into
masterfrom
port/5149-samplerstate-lifecycle

Conversation

@zackees

@zackees zackees commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

The sampler-state lifecycle entry points now dispatch through a safe obs-graphics core and thin Rust FFI exports. Rust validates the graphics context before arguments, preserves the exact debug messages and NULL behavior, and forwards settings and opaque handles unchanged through a private C layout/vtable adapter. Sampler objects remain backend-owned, with no wrapper allocation, free or lifecycle tracking.

The original C bodies remain in a reference-only build group, with a byte-identical legacy copy for the differential oracle. The existing C characterization and public headers are unchanged. Source/export/oracle fragments, real-adapter linkage for standalone Rust-static consumers, the per-port native registration and the sorted Rust inventory row are included.

RED commit: 69e7b066d; all four mirrored characterization cases fail at Rust stubs. GREEN: all six focused Tier 1/Tier 3 cases pass, and the full Graphics category passes 1,018 tests. Changing the NULL-info diagnostic is detected by the exact original-C differential characterization; the mutation was restored before final validation. No intentional behavior differences. Tier 4 does not apply to these non-protocol wrappers.

Validation also passed the whole native_build:: module (308 cases), all eight Windows MSVC category links, and six focused C targets against both rebuilt libraries, including the unchanged sampler characterization and real-adapter Rust-static consumers. Each C mode passed its repeat, and all 1,769 dynamic exports are identical. The single full ./lint invocation stopped on gersemi formatting in the new link-support fragment; pinned gersemi corrected it and the focused check passes. The complete ./push client-lint gate, including six-target Clippy/Dylint, then passed on the final tree (397.3 s). Repository self-tests and data validators passed; the final workspace run passed 9,105 tests (six skipped), feature configurations passed 920 tests, and applicable doctests and Windows GNU linking passed. The complete client-test lane passed in 502.4 s; 19 proof records were stamped and the final head signed.

The pre-publication merge-tree check against #5155's fetched head exits 0 without conflicts. That PR is still open. Existing C tests, public headers, WebSocket and CI are unchanged; #5132 and the known #5141 flake are outside this change.

Test cost: 25 reduced module runs, longest 0.053 s, peak RSS 8,752 KiB; no test-owned threads or allocation-driving generated sizes. One read-only clud-review primary reviewer found no actionable issues.

Refs #5149. Prerequisite extraction: #5148 (Refs #5128).

Ci-Attestation: {"at":1795046856,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":121,"stamp":"d247439b8ed910f8e6c9f24a6299ca2d","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046856,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":121,"stamp":"0d219066239e9eeb088c62ae93a55e60","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046856,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":121,"stamp":"80b49d57777994b86a7a62c3527412cc","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046856,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":121,"stamp":"8d65bc32bdc82f982bdbedf8f7263f01","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"general/all/client-lint","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"c473ef75e5da7ecf0a699efd285e19a9","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046856,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":121,"stamp":"75c2383ce13096a07ffe0d92959418de","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046734,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"fef7e09df0456b1760c66a97eca0d481","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046734,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"7797a0d5119443f73a3da8c63c463de0","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"374f86bb63815bd6b083b725641f6db5","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"265aef823c826d7013cf31c157c74dcf","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"a76ad6314afef6670853f2204e3e5591","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"ae1be01d9ea7a4b74055e83aae29fc9c","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"fcca1552dfedeacf9b6a5313853208b1","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046734,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"1fa52d452125b5bc922d4c79c30e241f","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"37db4011745b16d3fa43c660351a1359","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"7ce67c9acef94c8437e15f98043e5c60","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"5186d9373dd05976187795ff0c46f1c4","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795046733,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ad1dcd741d5434b667e0689bd45ca7fe622e9af2720c4cfdbbbaf5bbe84cae30","lane":"client-lint","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":397,"stamp":"a155e4f83520444eb3ac6bab4d0ba064","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}
Ci-Attestation: {"at":1795047359,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"2092fee471980e3cd09e0572bfd536d1b594c65767d6b227134966d48146ce20","lane":"client-test-x86_64-unknown-linux-gnu","parents":["f1c48417621917027e3d9a37a6b9c08609a46b97"],"secs":502,"stamp":"0d174f2e84525c857936e638f31fe9b2","tree":"313297da473b6297e42dc1fe66377f30f5867013","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"a62bfe717d5d9610a5136ca211273e66a1ae1f84","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.graphics+.h.c","libobs/build/libobs.ported-graphics-samplerstate-lifecycle+.h.c","libobs/build/ported-source-sets/graphics-samplerstate-lifecycle.json","libobs/cmake/rust-exports.d/obs-graphics-samplerstate_lifecycle.txt","libobs/graphics/graphics-samplerstate-lifecycle-fields.c.h","libobs/graphics/graphics-samplerstate-lifecycle.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_graphics_samplerstate_lifecycle_swap_is_registered.rs","rust/obs-c-oracle/legacy/graphics-samplerstate-lifecycle.c","rust/obs-c-oracle/oracle.d/graphics-samplerstate-lifecycle-fields.list","rust/obs-c-oracle/oracle.d/graphics-samplerstate-lifecycle.list","rust/obs-c-oracle/oracle/samplerstate_lifecycle.c","rust/obs-graphics/src/ffi/mod.rs","rust/obs-graphics/src/ffi/samplerstate_lifecycle.rs","rust/obs-graphics/src/lib.rs","rust/obs-graphics/src/samplerstate_lifecycle.rs","rust/obs-graphics/tests/render/main.rs","rust/obs-graphics/tests/render/samplerstate_lifecycle.rs","rust/obs-graphics/tests/render/samplerstate_lifecycle_parity.rs","test/cmocka/graphics-samplerstate-lifecycle-link-support.c","test/cmocka/tests.d/graphics_samplerstate_lifecycle_link_support.cmake"],"head":"4f0ed04f13377f1373c6313167f25dd77b45dc75","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"77062ab89dbcd9a7a0913ffc97988a85a5b7bbc3febbceb06dc682abf4143288","tree":"313297da473b6297e42dc1fe66377f30f5867013"}}
@zackees zackees changed the title style: format sampler lifecycle link support (Refs #5149) graphics: swap sampler-state lifecycle to safe Rust (Refs #5149) Nov 19, 2026
@zackees zackees added the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 19, 2026
@zackees
zackees enabled auto-merge November 19, 2026 00:17
@zackees zackees removed the pool-active Pool worker owns this PR; automated rebases must skip it label Nov 19, 2026
@zackees
zackees added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit 5fce766 Nov 19, 2026
42 checks passed
@zackees
zackees deleted the port/5149-samplerstate-lifecycle branch November 19, 2026 01:27
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.

1 participant