summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-29 21:56:38 +0200
committerwm4 <wm4@nowhere>2016-03-29 21:56:38 +0200
commitdae23fff09337992f9773557a3ba41ffb1311b32 (patch)
tree2a9d7a56c6c844395986b7093da27012eb9cc7c6
parentb95a10c2dd9d73d13375de1c802c2124478f6d88 (diff)
downloadmpv-dae23fff09337992f9773557a3ba41ffb1311b32.tar.bz2
mpv-dae23fff09337992f9773557a3ba41ffb1311b32.tar.xz
vo_opengl: always premultiply alpha
Until now, we've let the windowing backend decide. But since they usually require premultiplied alpha, and premultiplied alpha is easier to handle, hardcode it.
-rw-r--r--video/out/opengl/common.h1
-rw-r--r--video/out/opengl/context_cocoa.c1
-rw-r--r--video/out/opengl/context_x11.c1
-rw-r--r--video/out/opengl/video.c3
4 files changed, 1 insertions, 5 deletions
diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h
index 9236ce1d6f..f790dcb166 100644
--- a/video/out/opengl/common.h
+++ b/video/out/opengl/common.h
@@ -89,7 +89,6 @@ struct GL {
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
int fb_r, fb_g, fb_b; // frame buffer bit depth (0 if unknown)
- bool fb_premultiplied; // assumption about FB alpha compositor usage
void (GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei);
void (GLAPIENTRY *Clear)(GLbitfield);
diff --git a/video/out/opengl/context_cocoa.c b/video/out/opengl/context_cocoa.c
index e48472ff46..271bdb7444 100644
--- a/video/out/opengl/context_cocoa.c
+++ b/video/out/opengl/context_cocoa.c
@@ -124,7 +124,6 @@ static bool create_gl_context(struct MPGLContext *ctx, int vo_flags)
mpgl_load_functions(ctx->gl, (void *)cocoa_glgetaddr, NULL, ctx->vo->log);
ctx->gl->fb_r = ctx->gl->fb_g = ctx->gl->fb_b = cgl_color_size(ctx);
- ctx->gl->fb_premultiplied = true;
CGLReleasePixelFormat(p->pix);
diff --git a/video/out/opengl/context_x11.c b/video/out/opengl/context_x11.c
index c02730c729..d9a584e87c 100644
--- a/video/out/opengl/context_x11.c
+++ b/video/out/opengl/context_x11.c
@@ -274,7 +274,6 @@ static int glx_init(struct MPGLContext *ctx, int flags)
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_RED_SIZE, &ctx->gl->fb_r);
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_GREEN_SIZE, &ctx->gl->fb_g);
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_BLUE_SIZE, &ctx->gl->fb_b);
- ctx->gl->fb_premultiplied = true;
return 0;
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index de9fdd2814..6b46c1fb42 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -1736,8 +1736,7 @@ static void pass_convert_yuv(struct gl_video *p)
GLSL(color.rgb = color.rgb * color.a + background * (1.0 - color.a);)
} else { // alpha present in image
p->components = 4;
- if (p->gl->fb_premultiplied)
- GLSL(color = vec4(color.rgb * color.a, color.a);)
+ GLSL(color = vec4(color.rgb * color.a, color.a);)
}
}