Skip to content

rust: port obs_source_main_render and obs_source_render_filters to obs-source #5972

Done

Description

@rdoupe

obs_source_main_render() and obs_source_render_filters() in libobs/obs-source.c.h (~555-568 and ~667-690 on master, 68c8fae) are still C. They are the two draws obs_source_video_render() makes, which is Rust since #5963; it reaches them through the hidden adapters obs_source_video_render_main_render() and obs_source_video_render_render_filters(). Every decision in them is already Rust (obs_source_render_route_main_custom_draw, _srgb_aware, _default_effect, _reads_filters, #2208), and source_render() already has a hidden adapter (obs_source_default_render_source_render()). What is left is the field reads, the lock and the calls.

Behavior the port keeps, read for read and call for call:

  • obs_source_render_filters(): under filter_mutex, take a reference to filters.array[0]; unlock; set rendering_filter, call obs_source_video_render() on that filter, clear rendering_filter, release the reference.
  • obs_source_main_render(): read info.output_flags once; read filter_parent, and filters.num only when the route says it reads filters; when not sRGB aware, save gs_get_linear_srgb() and set it false, restoring it after the draw; default effect: obs_source_default_render(); otherwise, only when context.data is set, source_render() with NULL for a custom draw or gs_get_effect().

Plan, one PR into obs-source (the shape of #5940, #5963, #5968):

  1. Extract both functions verbatim into their own live core-source file (for example libobs/obs-source-video-render-draws.c.h), the adapters calling them unchanged. No behavior change.
  2. Tier 1 RED in obs-source's existing category binary against a todo!() core over a trait for the fields, the lock, the references and the calls.
  3. GREEN: safe core in obs-source, the two adapters as hidden C ABI exports in ffi/, a one-access field adapter, the extracted file moved to a reference-only ported group.
  4. Tier 3 parity against the original C in obs-c-oracle: the same source states through both, comparing recorded reads and calls and their order, with clobbers that change fields mid-call (filters.num read only on its route, rendering_filter seen set by the filter's draw).
  5. Tier 2: the existing cmocka cases that reach them through obs_source_video_render() against the hybrid libobs and the C reference, plus a characterization of the two draws if a route is not reached.

No public header, C test or obs-websocket change.

Activity

  1. added
    port
    on Nov 30, 2026
  2. rdoupe commented on Nov 30, 2026

    @rdoupe
    CollaboratorAuthor

    /ready

  3. rdoupe commented on Nov 30, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #5972 port of obs_source_main_render and obs_source_render_filters (extract, Tier 1 RED, GREEN, Tier 3 parity, Tier 2), the next step after obs_source_video_tick (#5968).

  4. added
    ready
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

portready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions