You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: libobs/graphics: gs_reset_blend_state leaves a non-default blend op when the blend function is the default #2519
gs_reset_blend_state is documented to "set the blend state to the default value" (docs/sphinx/reference-libobs-graphics-graphics.rst). Since blend ops were added in 2021 (33a6d2a, "libobs: Expose blending operation types"), the blend state includes the op (GS_BLEND_OP_ADD by default), but the reset only resets the op inside the branch for a blend function that differs from the default:
With the default function and, for example, GS_BLEND_OP_REVERSE_SUBTRACT, the op stays.
Who can reach it
Not OBS's own blend modes: the ones with another op (Subtract, Lighten, Darken) also use another function (ONE, ONE, ONE, ONE), and each scene item pushes and pops its blend state. A plugin or a script can: gs_blend_op is public API, and scene_video_render calls gs_reset_blend_state() before it draws the scene's items, so a scene rendered with the op still set draws with the wrong blending. Unchanged in upstream OBS master.
Fix
Reset the op whenever it is not GS_BLEND_OP_ADD, also when the function is the default.
Plan
Inside the state stacks port (#2517), as its own RED and GREEN commits: the reset is testable on the extracted seam (which device steps it takes) without a graphics device, while the public API has no getter for the current blend state. RED: with the default function and a non-default op, the reset takes the op step (now: none). GREEN: the change, in the C before the port's RED.
Activity
fixup: features ledger line for #2519
obs-graphics: Port the graphics state stacks (obs-rust#2517, fixes ob…