Skip to content

shaders/custom: add //!PARAM syntax to mpv hook shaders

Niklas Haas requested to merge hook_vars into master

These parameters are made available to all hook stages. I think this is preferable to requiring shader authors also specify which parameters should be made available in which hook stages. They should normally be quite small anyways, not to mention getting optimized out by shader compilers if unused.

Example:

//!PARAM contrast
//!DESC Gain to apply to image brightness
//!TYPE float
//!MINIMUM 0.0
//!MAXIMUM 100.0
1.0

//!HOOK LINEAR
//!BIND HOOKED

vec4 hook()
{
    return contrast * HOOKED_texOff(0);
}

Closes: #231 (closed)

Merge request reports