Skip to content

test: Extract and characterize graphics GPU metadata queries before Rust swap #5094

Open

Description

@zackees

Scout B10 / rank 11 is the C-only prerequisite for Phase 5/6 graphics API boundary, later targeting obs-graphics. The exported gs_get_driver_version, gs_get_renderer, gs_get_gpu_dmem, gs_get_gpu_smem remain embedded in libobs/graphics/graphics.c.h:341–391 on master b29f7d7a1e39add2bc5f04e3553c00d1629d67d8.

Move the public function bodies verbatim into libobs/graphics/graphics-gpu-metadata.c.h in the appropriate existing unity group, with only behavior-neutral private dependency declarations/aliases where needed. No external prerequisite. Serialize with target-size extraction and the in-flight device-query/texture-copy swaps (#5083/#5084); these four optional GPU metadata callbacks are separate from gs_get_device_type/gs_get_adapter_count.

No focused recording-backend characterization for these four wrappers was found. Add a new focused cmocka characterization with sorted native test-graph registration and a tests.d pointer. Pin no-context NULL string/zero memory defaults, exact per-entry LOG_DEBUG diagnostics, and no dispatch. A present context with the matching optional callback absent returns the same default silently; an installed callback is invoked exactly once with no device argument. Return string pointers unchanged (including NULL/empty pointers) without allocation and uint64_t memory values bit-for-bit, including high-bit and UINT64_MAX. Use distinct callbacks to prove the correct slot; a GPU or vendor driver is unnecessary.

Commit characterization RED against the missing extraction seam, then the behavior-neutral extraction GREEN. Also show the characterization passes against unchanged original C before the swap. Run the focused test against C-reference and hybrid libobs, verify exported-symbol parity, validate affected native-build registrations and run full ./lint once. Existing C tests, public headers, Rust code and plugins/obs-websocket remain unchanged. No new workflow or Rust test executable. No user-visible behavior change means no features-ledger entry.

Rust Tier 1 mirrors, Tier 3 original-C differential/mutation coverage and the Rust-static real-adapter linkage belong to a separately filed swap after this prerequisite lands. Use the existing test category binary then; Tier 4 is inapplicable to this non-protocol unit.

Rust-side confirmation: No Rust gpu_get_driver_version/renderer/dmem/smem dispatch was found. Existing graphics viewport and device-load modules cover different backend exports; device-query swap #5083 covers type/adapter count only. Exact-symbol all-state issue/PR searches, semantic searches, the full open-PR snapshot and recent Claiming comments found no duplicate implementation.

Append points / lane: libobs/build/libobs.graphics+.h.c; test_graphics_gpu_metadata.c and tests.d/native graph. Later swap: obs-graphics lib.rs/ffi/mod.rs, existing Graphics category suite modules and per-unit source/export/oracle fragments. Lane G / graphics; coordinate shared append points rather than assuming a different filename is collision-free.

Decisions

C-only prerequisite, P2 / port / size:S: the API contract is small and deterministic, and separating characterization/extraction makes the subsequent Rust swap reviewable. Preserve odd existing behavior rather than fixing it during extraction. New destination/test names are proposals; reuse equivalent established fixtures if that avoids duplicate registration. This issue is unclaimed; no Claiming comment was posted by the scout.

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. rdoupe commented on Nov 18, 2026

    @rdoupe
    Collaborator

    Claiming: #5094

    Plan: same shape as #5079. Characterization test_graphics_gpu_metadata (recording backend, no GPU) RED against the missing graphics-gpu-metadata.c.h seam, then the verbatim move of the four bodies GREEN. Run against C-reference and hybrid libobs, check exported-symbol parity, ./lint once.

  3. moved this from Ready to In progress in obs-rust Multiviewon Nov 18, 2026
  4. rdoupe commented on Nov 19, 2026

    @rdoupe
    Collaborator

    PR is up: #5286 (RED 3292c1c, GREEN f9c9c9d; evidence in the body). I'll queue it once PR CI is green.

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