Skip to content

libobs: Characterize effect name and index lookups - #1823

Merged
zackees merged 2 commits into
obs-rust:masterfrom
nathan-v:test/effect-lookups
Oct 22, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
nathan-v:test/effect-lookups

Conversation

@nathan-v

Copy link
Copy Markdown
Contributor

Refs #1822

What and why

The effect name and index lookups lived in effect.c.h next to the device loop and the setters. This moves them verbatim into libobs/graphics/effect-lookups.c.h, in the same graphics unity group, and adds test_effect_lookups. No behavior change, no public header change, no Rust. The port to obs-graphics is the next PR.

The test links libobs and fills a gs_effect by hand. It does not start a GPU. It pins first-match names (case sensitive, the empty string, duplicates), null inputs, the stored current technique, view-proj and world, and gs_effect_get_param_info.

A param index uses >=, so an index equal to the count is NULL. An annotation index and a pass index use >, so an index equal to the count returns one past the array. That return is characterized, not endorsed. The test compares the pointer and does not dereference it.

RED → GREEN

  • RED commit: N/A for this PR. The C already has the behavior. 79fed0db99e88bbbc8319540bcf7454a315c2e70 adds the test, and it passed 5/5 while the functions were still in effect.c.h.
  • GREEN: 5e355d4549e1328bcc43f91c801d43683eae1501 moves the functions. The same five tests passed against the moved file: null_and_empty_test, name_lookups_test, index_bounds_test, stored_pointers_test, param_info_test.
  • Real app: N/A. No UI, protocol, or log change.

The Rust RED and GREEN are the follow-up on #1822.

Checklist

  • Base is master
  • I claimed the issue
  • Characterization test, then the behavior-neutral move. Rust RED and GREEN are the next PR.
  • User-visible change: not applicable, no line in docs/features.md
  • Local gate: not stamped. On this Mac the lint lane failed in the existing Windows host probes (_SPACE / _ALPHA against the macOS libc++ headers) and in test_tier2_run (/var vs /private/var). clang-format 22.1.3 and gersemi 0.25.0 passed on the changed files. The Docker daemon was not running, so Linux Tier 2 did not run here. PR CI runs it.
  • Warning or flag changes: none
  • Intentional differences: none. The one-past index is pinned, not changed.

Local macOS arm64, build_rust_OFF (Rust off): test_effect_lookups 5/5 before the move and 5/5 after. Homebrew cmocka would not load in the Xcode-signed binary (Team ID); the run used a copied dylib and DYLD_FRAMEWORK_PATH.

Pin the current walks in effect.c.h: first-match names,
null inputs, and the index checks. A param index uses >=.
An annotation or pass index uses >, so an index equal to
the count returns one past the array. Refs obs-rust#1822.
The walks leave effect.c.h with the same behavior. They stay in
the graphics unity group. The device loop, passes, and setters
stay in effect.c.h. Refs obs-rust#1822.
@nathan-v
nathan-v marked this pull request as ready for review October 22, 2026 21:09
@nathan-v
nathan-v requested a review from zackees as a code owner October 22, 2026 21:09
@zackees
zackees added this pull request to the merge queue Oct 22, 2026
Merged via the queue into obs-rust:master with commit e7a272f Oct 22, 2026
30 checks passed
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.

2 participants