Skip to content

rust: Port the scene item render plan in obs-scene.c to obs-scene #2003

Closed

Description

@rdoupe

Unit

This unit moves the per-item render decisions in libobs/obs-scene.c.h into rust/obs-scene, as a new module render_plan. The decisions are:

  • item_texture_enabled and its triggers (crop_enabled, scale_filter_enabled, default_blending_enabled, item_is_scene), which decide whether the item draws through a texture.
  • These choices in render_item:
  • are_texcoords_centered.
  • These choices in render_item_texture: the effect (scale filter and output_scale, with upscale for Area), the SDR white multiplier and the technique.

Every gs_* call, obs_source_video_render, the texrender objects, and the SDR white level lookup stay in C. C passes in the white level, the two scene_transition_active results, the source size, the colour spaces and the format match. The blend table (#1521) and calc_cx/calc_cy (#1947) are already ported.

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-scene-render-plan.c.h, as hidden functions. render_item and render_item_texture keep every graphics call, in the same order, and read the plan.
  2. Characterization: test_scene_render_plan_steps. It covers:
    • each texture trigger alone, and none;
    • output_scale at 0.5 ± 1 ulp, 1 ± EPSILON, and NaN;
    • each scale filter, with and without upscale;
    • the 4 × 4 colour space pairs, with white levels of 80, 300 and 0;
    • the child choice for visible/hidden × show/hide active;
    • are_texcoords_centered on identity, a fractional translation, -0.0 and NaN. The C compares bytes, so -0.0 counts as not centred.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-scene-render-plan group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C. It is exhaustive over the enums and flags, runs proptests over f32 scales and matrices drawn from bit patterns, and compares the plan field by field. Plus a deliberate-break check and port_comparison numbers.

These real-libobs tests must stay green on every lane: test_item_transition_empty_source, test_darken_transparent, test_scene_rotated_scale_filter, test_scene_blend, test_visibility_transition and test_group_hide_transition_audio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions