summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-05-05 18:44:41 +0200
committerwm4 <wm4@nowhere>2016-05-05 18:44:41 +0200
commit7a75e7c00216471fff64406e76a1d9654d3439b5 (patch)
tree5338ea78dc5abb6b7cd3851bdeac6e62fa9feac4
parent605dd928d30445610544f919f5b577f4acb79114 (diff)
downloadmpv-7a75e7c00216471fff64406e76a1d9654d3439b5.tar.bz2
mpv-7a75e7c00216471fff64406e76a1d9654d3439b5.tar.xz
vo_opengl: angle: avoid fullscreen FBO copy for flipping
In order to honor the differences between OpenGL and Direct3D coordinate systems, ANGLE uses a full FBO copy merely to flip the final frame vertically. This can be avoided with the EGL_ANGLE_surface_orientation extension.
-rw-r--r--video/out/opengl/context_angle.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/video/out/opengl/context_angle.c b/video/out/opengl/context_angle.c
index cb48343d6f..f75dc34f91 100644
--- a/video/out/opengl/context_angle.c
+++ b/video/out/opengl/context_angle.c
@@ -23,6 +23,12 @@
#include "video/out/w32_common.h"
#include "context.h"
+#ifndef EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE
+#define EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE 0x33A7
+#define EGL_SURFACE_ORIENTATION_ANGLE 0x33A8
+#define EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE 0x0002
+#endif
+
struct priv {
EGLDisplay egl_display;
EGLContext egl_context;
@@ -154,8 +160,24 @@ static int angle_init(struct MPGLContext *ctx, int flags)
if (!config)
goto fail;
+ EGLint *window_attribs = NULL;
+ EGLint window_attribs_flip[] = {
+ EGL_SURFACE_ORIENTATION_ANGLE, EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE,
+ EGL_NONE
+ };
+ EGLint flip_val;
+ if (eglGetConfigAttrib(p->egl_display, config,
+ EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE, &flip_val))
+ {
+ if (flip_val == EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE) {
+ window_attribs = window_attribs_flip;
+ ctx->flip_v = true;
+ MP_VERBOSE(vo, "Rendering flipped.\n");
+ }
+ }
+
p->egl_surface = eglCreateWindowSurface(p->egl_display, config,
- vo_w32_hwnd(vo), NULL);
+ vo_w32_hwnd(vo), window_attribs);
if (p->egl_surface == EGL_NO_SURFACE) {
MP_FATAL(ctx->vo, "Could not create EGL surface!\n");
goto fail;