Skip to content

rust: Port the scene transform update decisions in obs-scene.c to obs-scene #2874

Closed

Description

@vpacher

Unit

Port the transform update decisions of libobs/obs-scene.c.h to rust/obs-scene, as a new module transform_update, next to item_transform (#2385), group_transform (#1719) and render_plan (#2003). scene_video_render() runs these decisions on each frame for each scene that is not a group, and obs_scene_prune_sources() runs them on request. These decisions move:

  • The scene size step in scene_size_changed(). Input: the scene size (scene_getwidth(), scene_getheight()) and the stored last_width, last_height. Output: changed or not changed. The stored size changes only when the size changed.
  • The item update decision in update_transforms_and_prune_sources(). Input: the item's update_transform flag, its last_width, last_height, the source size (source_size_changed()) and the scene size change. Output: update the item transform or not.
  • The group rebuild decision. Input: the group's update_group_resize flag (only when the walk is inside a group), and for each item: removed, or transform updated. Output: call resize_group() or not, and its scene_resize argument.

These stay in C:

  • video_lock() / video_unlock(), the item list walk and the recursion into a group's scene;
  • obs_source_removed(), obs_sceneitem_remove_internal() and the remove_items darray;
  • update_item_transform() (its defer_update check, the source size read, the lock and the item_transform signal) and resize_group() (its defer_group_resize check);
  • the source and scene size reads.

Plan (one PR, separate commits)

  1. A behaviour-neutral move of the decisions into libobs/obs-scene-transform-update.c.h, as hidden functions on plain values.
  2. Characterization in test_scene_transform_update_steps. It covers:
    • the scene size: first frame, same size, a new width only, a new height only, a size back to an earlier value; the stored size changes only on a change;
    • the item update: each input alone, all inputs together, none;
    • an item with defer_update above 0: C skips the update and does not store the new source size, so the item asks again on each frame and keeps the group rebuild on;
    • a removed item: it sets the group rebuild, and it skips the group recursion and the update check;
    • a group item: its group's walk runs first, with the same scene size change, and then its own update check;
    • the group rebuild: from the update_group_resize flag alone, from a removed item, from an updated item; never at the top level (no group item);
    • obs_scene_prune_sources(): no scene size change.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-scene-transform-update group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C: exhaustive over the flags and the size edges (0, 1, UINT32_MAX), plus proptests over item sequences. Also a deliberate-break check and port_comparison numbers (it runs once per frame for each item).

These real-libobs tests must stay green on every lane:

  • test_scene_item_transform_steps, test_scene_group_transform
  • test_group_child_drift, test_group_extent, test_group_recursion
  • test_group_teardown_uaf, test_scene_enum_items_removal, test_scene_list_remove

Production check: batched with the other per-frame ports in one before/after run on the obs-rust production box (Linux, 25 fps). Each frame of its scenes goes through this code.

Refs #2385 #1719 #2003 #2115

Activity

  1. added
    enhancement
    port
    on Oct 29, 2026
  2. vpacher commented on Oct 29, 2026

    @vpacher
    MemberAuthor

    Claiming: #2874

    Plan as in the issue: one PR with the behaviour-neutral move, the characterization (test_scene_transform_update_steps), RED/GREEN (obs-scene::transform_update, group libobs.ported-scene-transform-update) and Tier 3 parity. Before pushing: memory and time of the new tests, Windows on a local VM, and a local-gate stamp so PR CI can skip the Linux jobs. I expect a draft PR within 48 hours.

  3. added
    ready
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementportready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions