Skip to content

graphics: swap active shader queries to Rust (Refs #5248) - #5261

Merged
zackees merged 2 commits into
masterfrom
port/5248-active-shader-queries
Nov 19, 2026
Merged

zackees merged 2 commits into
masterfrom
port/5248-active-shader-queries

Conversation

@zackees

@zackees zackees commented Nov 19, 2026

Copy link
Copy Markdown
Member

Refs #5248. Port the extracted active vertex/pixel shader queries to a safe Rust core and thin ABI shims in obs-graphics. Missing contexts return NULL and emit the original exact LOG_DEBUG diagnostic before any field projection. Live contexts dispatch each mandatory export callback once with the original device and return its borrowed shader pointer unchanged, including backend NULL. Queries preserve shader contents and context reference counts.

The existing device-query seam and demand-linked real adapter archive supply TLS, logging and native layout access for libobs and every standalone Rust-static consumer. The real export table supplies the const gs_device_t backend signatures. Original C function bodies remain reference-only, with a byte-identical legacy oracle. Existing C tests, public headers and the OBS WebSocket plugin are unchanged. No intentional differences or new public layouts; Tier 4 is inapplicable.

RED f7f6aab (originally ac327d8b3) fails all three safe-core mirrors at the stub (exit 101). GREEN 3e67bd1 (originally 946ecabf2) passes all 1,035 Graphics tests. Tier 3 compares 72 fake-device/shader/callback combinations and bounded random context/query sequences through the real ABI and original-C oracle, with exact pointer identities, independent call counts, diagnostics and context reference counts. Returning NULL after dispatch fails both differential tests (exit 101); restoring the core returns the full Graphics category to GREEN. An independent clud-review primary reviewer inspected all 17 files and ran all five focused tests without findings.

Test cost: 25 reduced-parity runs of the five new tests together; longest 0.01 seconds, peak RSS 8,200 KiB, no own threads. Tests stay in the existing Graphics category executable.

Focused Linux Tier 2 built every one of the 65 configured *_rust targets, hybrid libobs, the C reference and the frozen characterization. The characterization passed 25 repeats OFF and 25 ON. Both libraries expose exactly the same 1,769 dynamic symbols. Validation used explicit soldr wrappers for the CMake Rust compiler and build frontend. The deliberate mutation overlapped an earlier Linux build, which was discarded; these results are from a full fresh invocation on the restored tree.

The entire native_build:: module passed: 322 tests, zero failed/ignored. Its first parallel run had one ETXTBSY (Text file busy) when an unrelated existing staging test launched a just-copied executable; the complete serial rerun passed without edits or assertion changes.

ci/windows_link_check.py passed all eight Windows MSVC Rust category links, then hybrid libobs and all 56 configured Rust fixtures on EACH Windows MSVC x64 and Darwin ARM64. The separate ci/cmocka_link_check.py --alias mac-arm64 invocation also passed hybrid plus all 56 fixtures. The frozen C characterization explicitly compiled and linked on both cross targets.

Darwin binding evidence (llvm-nm -m): the characterization imports _gs_get_vertex_shader and _gs_get_pixel_shader as undefined external symbols (from obs); its _vertex and _pixel callbacks are non-external definitions. The libobs Mach-O defines both public getters and contains _obs_graphics_device_queries_vertex_shader and _obs_graphics_device_queries_pixel_shader as non-external (was a private external). All fakes are static export-table callbacks; no global function called by Rust is interposed. Full nm output is retained under build_ci_audit/5248/darwin-{fixture,libobs}-nm.txt.

The required Rust formatting check passed. The full repository linter passed once, exit 0 in 491.9 seconds; its final artifact records lane lint: ok (491.9s). Publication resumes from the previously verified GREEN tree without repeating full verification.

The earlier forced-refspec merge-tree comparisons were clean against sibling #5252 and #5250/#5254; #5155/#5061 had the same pre-existing conflicts against master and this branch. Publication rebased cleanly onto origin/master, including the merged index-buffer swap #5252 (db58dec). Temporary comparison refs were deleted.

These checks do not execute native Windows/macOS programs, run the complete cmocka suite or qualify real-GPU behavior. Hosted CI remains the merge gate.

Publication revalidation after the clean rebase: all 1,040 Graphics category tests passed with zero failed or ignored; workspace Rust formatting passed. The previously completed full verification and independent review are retained above. Ordinary selected PR CI remains required; no complete client attestation is claimed for the rebased head.

@zackees
zackees enabled auto-merge November 19, 2026 16:51
@zackees
zackees added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit 21d99bf Nov 19, 2026
45 checks passed
@zackees
zackees deleted the port/5248-active-shader-queries branch November 19, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant