path: root/video/out/opengl/common.h
diff options
authorJames Ross-Gowan <>2015-12-01 00:56:02 +1100
committerMartin Herkt <>2015-12-11 18:29:18 +0100
commit3d12312806e7d54e7bb6b4b2a5981999735f6233 (patch)
tree8aa8908b1727a314860bfeb6a3752272e3bbc4b4 /video/out/opengl/common.h
parenta6521f394122ee1ce097ceba5d0fc18ad4fd7e7a (diff)
vo_opengl: add dxinterop backend
WGL_NV_DX_interop is widely supported by Nvidia and AMD drivers. It allows a texture to be shared between Direct3D and WGL, so that rendering can be done with WGL and presentation can be done with Direct3D. This should allow us to work around some persistent WGL issues, such as dropped frames with some driver/OS combos, drivers that buffer frames to increase performance at the cost of latency, and the inability to disable exclusive fullscreen mode when using WGL to render to a fullscreen window. The addition of a DX_interop backend might also enable some cool Direct3D-specific enhancements in the future, such as using the GetPresentStatistics API to get accurate frame presentation timestamps. Note that due to a driver bug, this backend is currently broken on Intel. It will appear to work as long as the window is not resized too often, but after a few changes of size it will be unable to share the newly created renderbuffer with GL. See:
Diffstat (limited to 'video/out/opengl/common.h')
1 files changed, 19 insertions, 0 deletions
diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h
index 8d5bbdbb6d..537e785e3b 100644
--- a/video/out/opengl/common.h
+++ b/video/out/opengl/common.h
@@ -63,6 +63,7 @@ enum {
MPGL_CAP_1D_TEX = (1 << 14),
MPGL_CAP_3D_TEX = (1 << 15),
MPGL_CAP_DEBUG = (1 << 16),
+ MPGL_CAP_DXINTEROP = (1 << 17), // WGL_NV_DX_interop
MPGL_CAP_SW = (1 << 30), // indirect or sw renderer
@@ -128,6 +129,9 @@ typedef struct MPGLContext {
// Windows-specific hack. See vo_opengl dwmflush suboption.
int dwm_flush_opt;
+ // Flip the rendered image vertically. This is useful for dxinterop.
+ bool flip_v;
// For free use by the mpgl_driver.
void *priv;
} MPGLContext;
@@ -261,6 +265,21 @@ struct GL {
void (GLAPIENTRY *VDPAUMapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
void (GLAPIENTRY *VDPAUUnmapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
+#if HAVE_GL_WIN32
+ // The HANDLE type might not be present on non-Win32
+ BOOL (GLAPIENTRY *DXSetResourceShareHandleNV)(void *dxObject,
+ HANDLE shareHandle);
+ HANDLE (GLAPIENTRY *DXOpenDeviceNV)(void *dxDevice);
+ HANDLE (GLAPIENTRY *DXRegisterObjectNV)(HANDLE hDevice, void *dxObject,
+ GLuint name, GLenum type, GLenum access);
+ BOOL (GLAPIENTRY *DXUnregisterObjectNV)(HANDLE hDevice, HANDLE hObject);
+ BOOL (GLAPIENTRY *DXLockObjectsNV)(HANDLE hDevice, GLint count,
+ HANDLE *hObjects);
+ BOOL (GLAPIENTRY *DXUnlockObjectsNV)(HANDLE hDevice, GLint count,
+ HANDLE *hObjects);
GLint (GLAPIENTRY *GetVideoSync)(GLuint *);
GLint (GLAPIENTRY *WaitVideoSync)(GLint, GLint, unsigned int *);