mirror of
https://github.com/mpv-player/mpv
synced 2024-12-15 03:15:52 +00:00
vo_opengl: also expose NAME_mul for user shaders
This is exposed so that bjin/mpv-prescalers can use textureGatherOffset for performance. Since there are now quite a lot of parameters where it isn't quite clear why they're all defined, add a paragraph to the man page that explains them a bit.
This commit is contained in:
parent
ef43854b34
commit
aa2bdec26c
@ -4274,10 +4274,18 @@ The following video options are currently all specific to ``--vo=opengl`` and
|
||||
to texture coordinates)
|
||||
vec2 NAME_pt
|
||||
The (unrotated) size of a single pixel, range [0,1].
|
||||
float NAME_mul
|
||||
The coefficient that needs to be multiplied into the texture contents
|
||||
in order to normalize it to the range [0,1].
|
||||
sampler NAME_raw
|
||||
The raw bound texture itself. The use of this should be avoided unless
|
||||
absolutely necessary.
|
||||
|
||||
Normally, users should use either NAME_tex or NAME_texOff to read from the
|
||||
texture. For some shaders however , it can be better for performance to do
|
||||
custom sampling from NAME_raw, in which case care needs to be taken to
|
||||
respect NAME_mul and NAME_rot.
|
||||
|
||||
In addition to these parameters, the following uniforms are also globally
|
||||
available:
|
||||
|
||||
|
@ -1171,10 +1171,11 @@ static void hook_prelude(struct gl_video *p, const char *name, int id,
|
||||
GLSLHF("#define %s_size texture_size%d\n", name, id);
|
||||
GLSLHF("#define %s_rot texture_rot%d\n", name, id);
|
||||
GLSLHF("#define %s_pt pixel_size%d\n", name, id);
|
||||
GLSLHF("#define %s_mul %f\n", name, tex.multiplier);
|
||||
|
||||
// Set up the sampling functions
|
||||
GLSLHF("#define %s_tex(pos) (%f * vec4(texture(%s_raw, pos)).%s)\n",
|
||||
name, tex.multiplier, name, get_tex_swizzle(&tex));
|
||||
GLSLHF("#define %s_tex(pos) (%s_mul * vec4(texture(%s_raw, pos)).%s)\n",
|
||||
name, name, name, get_tex_swizzle(&tex));
|
||||
|
||||
// Since the extra matrix multiplication impacts performance,
|
||||
// skip it unless the texture was actually rotated
|
||||
|
Loading…
Reference in New Issue
Block a user