Skip to content

renderer: refactor background/border clearing options

Niklas Haas requested to merge haasn/libplacebo:background_refactor into master

The current behavior is very ad-hoc and presents numerous issues to downstream clients. Make this configuration process more straightforward by adding an explicit clearing mode enum field to pl_render_params, which the old override fields are specific instances of.

Notably, this could be extended in the future, e.g. by PL_CLEAR_GRADIENT or whatever. (Although this can already be done as of right now by setting both clear modes to PL_CLEAR_NONE and using blend_params on top of a custom-drawn gradient)

The default of PL_COLOR_CLEAR for both is consistent with the current status quo, and also presents the least surprising outcome when combining transparent/opaque images with transparent/opaque framebuffers. This way, the user only gets transparent images output if they explicitly opt-in to it, either by setting background_transparency to 1 (like plplay does), or by setting the background clearing mode to PL_CLEAR_SKIP.

In particular, border = PL_CLEAR_SKIP will result in "garbage" pixels out of the box, at least on implementations which don't pre-clear framebuffers for you.

Supersedes: !637 (closed)

Merge request reports