0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

vo_opengl: fix shader compilation with debanding and OSX hwdec

2 things are being stupid here: Apple for requiring rectangle textures
with their IOSurface interop for no reason, and OpenGL having a
different sampler type for rectangle textures.
This commit is contained in:
wm4 2015-09-10 20:53:47 +02:00
parent e2139488ff
commit a8eae12af5
3 changed files with 10 additions and 8 deletions

View File

@ -1128,8 +1128,9 @@ static void pass_read_video(struct gl_video *p)
}
if (p->opts.deband) {
pass_sample_deband(p->sc, p->opts.deband_opts, 1, merged ? 1.0 : tex_mul,
p->image_w, p->image_h, &p->lfg);
pass_sample_deband(p->sc, p->opts.deband_opts, 1, p->gl_target,
merged ? 1.0 : tex_mul, p->image_w, p->image_h,
&p->lfg);
GLSL(color.zw = vec2(0.0, 1.0);) // skip unused
finish_pass_fbo(p, &p->chroma_deband_fbo, c_w, c_h, 1, 0);
p->use_normalized_range = true;
@ -1163,7 +1164,7 @@ static void pass_read_video(struct gl_video *p)
GLSL(vec4 main;)
GLSLF("{\n");
if (p->opts.deband) {
pass_sample_deband(p->sc, p->opts.deband_opts, 0, tex_mul,
pass_sample_deband(p->sc, p->opts.deband_opts, 0, p->gl_target, tex_mul,
p->image_w, p->image_h, &p->lfg);
p->use_normalized_range = true;
} else {

View File

@ -378,8 +378,8 @@ const struct m_sub_options deband_conf = {
// Stochastically sample a debanded result from a given texture
void pass_sample_deband(struct gl_shader_cache *sc, struct deband_opts *opts,
int tex_num, float tex_mul, float img_w, float img_h,
AVLFG *lfg)
int tex_num, GLenum tex_target, float tex_mul,
float img_w, float img_h, AVLFG *lfg)
{
// Set up common variables and initialize the PRNG
GLSLF("// debanding (tex %d)\n", tex_num);
@ -388,7 +388,8 @@ void pass_sample_deband(struct gl_shader_cache *sc, struct deband_opts *opts,
// Helper: Compute a stochastic approximation of the avg color around a
// pixel
GLSLH(vec4 average(sampler2D tex, vec2 pos, float range, inout float h) {)
GLSLHF("vec4 average(%s tex, vec2 pos, float range, inout float h) {",
mp_sampler_type(tex_target));
// Compute a random rangle and distance
GLSLH(float dist = rand(h) * range; h = permute(h);)
GLSLH(float dir = rand(h) * 6.2831853; h = permute(h);)

View File

@ -46,7 +46,7 @@ void pass_linearize(struct gl_shader_cache *sc, enum mp_csp_trc trc);
void pass_delinearize(struct gl_shader_cache *sc, enum mp_csp_trc trc);
void pass_sample_deband(struct gl_shader_cache *sc, struct deband_opts *opts,
int tex_num, float tex_mul, float img_w, float img_h,
AVLFG *lfg);
int tex_num, GLenum tex_target, float tex_mul,
float img_w, float img_h, AVLFG *lfg);
#endif