Skip to content

obs-graphics: Port the linear-sRGB context getter (#3904) - #3905

Merged
zackees merged 4 commits into
masterfrom
port/3904-graphics-linear-srgb
Nov 7, 2026
Merged

zackees merged 4 commits into
masterfrom
port/3904-graphics-linear-srgb

Conversation

@zackees

@zackees zackees commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Ports gs_get_linear_srgb() to Rust while preserving false without a graphics context, its exact debug log, and the current context's stored flag. A private C field-pointer adapter owns validation and the real graphics layout; Rust has no private-layout mirror and does not call blog.

Fixes #3904, a native sub-issue of #444.

Commit evidence

  • C-only actual-library characterization: d86abaf14. The unchanged test passes against both actual libraries, including exact log level/text/count, both flag values, repeated reads, context ownership and no mutation.
  • Separate building C extraction: 4f9970911. The getter body is verbatim (SHA256 24afe6bc227d86494f0f804413574792765a944570436fcb34bf70dcd7fbf6f6); both characterization runs pass before Rust is introduced.
  • Tier 1 RED: 2bf82a71d. The focused Graphics category test fails at todo!() with not yet implemented: port gs_get_linear_srgb (1 failed).
  • Rust GREEN: 830dbcea6. Four focused tests pass in the existing Graphics binary. Tier 3 compiles the extracted C getter and field adapter against the real private header, checks bool size/alignment and the field offset, and compares values, state and exact logs over all boolean states and randomized sequences. Proptest persistence is disabled and generated sequences are bounded below 64 entries.
  • Mutation: temporarily negating the core makes both differential tests fail (exit 101). Restoring the committed source returns all four focused tests to GREEN.

Validation

  • Through docker_task_command and this slot's warm volume: unchanged test_graphics_linear_srgb, test_effect_parser_lifecycle_rust, test_graphics_immediate_steps_rust and test_sprite_geometry_steps_rust pass against both libraries (8 runs). ldd proves /build/tree/libobs-c-reference/libobs.so.30 and /build/tree/libobs/libobs.so.30 respectively. Their 1,767 dynamic export names are identical.
  • Host GCC and Nix Clang (-Qunused-arguments) accept both source groups, the C fixture and oracle with -Wall -Wextra -Wformat=2 -Wformat-nonliteral -Wconversion -Wsign-conversion -Wfloat-conversion -Werror, using dependency SIMDe roots.
  • SOLDR_PORCELAIN=0 SOLDR_RUSTC_WRAPPER=none soldr cargo test -p obs-studio-rust --test obs-tests-app native_build::canonical_rust_static_: 7 pass. The 13 existing graphics Rust-static CMake consumers compile the same private field adapter; conditional OBS::w32-pthreads support is added for private threading headers.
  • ci/test_native_b2_portability.py, ci/test_test_graph_sorted.py, ci/test_rust_readme.py and ci/test_build_groups.py: pass. One local review agent: clud-review: clean.
  • ./lint completed its earlier format/self-test/rustfmt/Clippy checks, then exited 1 solely because Soldr refuses to build the unavailable Dylint driver under clud (nightly-2026-05-28 versus the predeployed nightly-2026-08-15). Per worker instructions, no toolchain change or guard workaround was attempted; hosted Fast Gate remains required. No local-gate attestation is claimed.

Test cost: four new Rust tests, longest combined process 0.027 s and peak RSS 6,956 KiB over 25 reduced-parity runs; no own threads. No new Rust test executable.

No intentional behavior differences. Tier 4 is inapplicable to this local graphics getter. Native Windows/macOS builds and the full workspace suite were not run locally. Public headers, existing C test sources and the WebSocket plugin are unchanged.

@zackees
zackees marked this pull request as ready for review November 7, 2026 14:10
@zackees
zackees enabled auto-merge November 7, 2026 14:10
@zackees
zackees force-pushed the port/3904-graphics-linear-srgb branch from 830dbce to 993b5cd Compare November 7, 2026 15:06
@zackees

zackees commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

Rebased after the 14:43 UTC merges onto master 5de5b53. Resolved build.rs by retaining both encoder-counter and linear-sRGB extraction blocks; README rows and test graph entries merged intact. Range-diff preserves characterization, extraction, RED and implementation/tests. Whole native_build:: module (113 tests), portability (6), sorted graph (2), README (1), local_gate --only self-test, obs-c-oracle build and all four focused shader::linear_srgb unit/layout/parity tests passed. Exact lease replaced 830dbce with 993b5cd. Remote verified; auto-merge remained enabled and was confirmed. Full Tier 2 and native Windows/macOS were not rerun; hosted CI remains the merge gate.

@zackees
zackees added this pull request to the merge queue Nov 7, 2026
@zackees
zackees removed this pull request from the merge queue due to a manual request Nov 7, 2026
@zackees
zackees force-pushed the port/3904-graphics-linear-srgb branch from 993b5cd to 04c6413 Compare November 7, 2026 16:41
@zackees
zackees enabled auto-merge November 7, 2026 16:41
@zackees

zackees commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

Rebased after #3879: kept the encoder metadata extraction and both independent linear-sRGB extraction files, preserving all README, graph and registration changes. Replaced 993b5cd with 04c6413 using an exact lease; range-diff retains all four patches except extraction context. Passed whole native_build module (127 tests), portability, graph sorting, README, oracle build and four focused linear-sRGB Rust/parity tests. Workspace fmt NOT VERIFIED: the session verify-ratio guard refused it on the preceding PR; no retry or workaround on this PR. Head-pinned auto-merge re-armed; hosted formatting remains required.

@zackees

zackees commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

This head contains the exact unchanged encoder_metadata.c from #3879 and has the same latent obs-util link dependency on five obs-output getters. Focused master fix #3919 passes getter callbacks into the oracle log probe, preserving all C/Rust assertions; its standalone test reproduces the exact Windows link RED and passes GREEN. No graphics feature-code change is needed for these symbols. Hosted job-log retrieval was refused for terminal escape sequences, so I did not bypass that guard.

@zackees
zackees force-pushed the port/3904-graphics-linear-srgb branch from 04c6413 to 68d08b1 Compare November 7, 2026 18:27
@zackees

zackees commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

Rebased onto master 8e406b2 after #3916/#3920/#3919. Preserved discovery and the existing graphics extraction (outside the libobs/obs-*-fields.c.h glob; guard accepts it); both .inc names match. No shared registration-list additions to migrate, and oracle context/log calls use local substitutes. Passed discovery/registration guards, workspace fmt, whole native_build module, oracle build, portability, graph ordering, README and local-gate self-tests. obs-util and focused linear_srgb commands were refused by soldr active-target-lock preflight; neither ran, no workaround attempted. Range-diff reviewed; lease-pushed 68d08b1, remote verified, auto-merge remains enabled.

@zackees
zackees added this pull request to the merge queue Nov 7, 2026
Merged via the queue into master with commit 8e74e92 Nov 7, 2026
44 checks passed
@zackees
zackees deleted the port/3904-graphics-linear-srgb branch November 7, 2026 19:42
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to Done in obs-rust Multiview Nov 7, 2026
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.

rust: Port graphics.c.h linear-sRGB getter to obs-graphics

1 participant