Repository navigation
Closed
Closed
Copy link
Labels
enhancementNew feature or requestportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimable
Description
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 storedlast_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'supdate_transformflag, itslast_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_resizeflag (only when the walk is inside a group), and for each item: removed, or transform updated. Output: callresize_group()or not, and itsscene_resizeargument.
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 theremove_itemsdarray;update_item_transform()(itsdefer_updatecheck, the source size read, the lock and theitem_transformsignal) andresize_group()(itsdefer_group_resizecheck);- the source and scene size reads.
Plan (one PR, separate commits)
- A behaviour-neutral move of the decisions into
libobs/obs-scene-transform-update.c.h, as hidden functions on plain values. - 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_updateabove 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_resizeflag 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.
- RED, then GREEN: the safe Rust core plus shims, in a
libobs.ported-scene-transform-updategroup. Exported symbols are unchanged. - 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 andport_comparisonnumbers (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_transformtest_group_child_drift,test_group_extent,test_group_recursiontest_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.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestportPort a C unit to Rust (four-tier policy)readyMeets the definition of Ready; claimable
Type
Projects
- StatusShow more project fieldsDone
Activity
vpacher commentedon Oct 29, 2026
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, grouplibobs.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.obs-scene: Port the scene transform update decisions (obs-rust#2874) (o…