generated from obsproject/obs-plugintemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source: Add support for WGL_NV_DX_interop on windows
Allows us to share textures between OpenGL and Direct3D saving us the reading into ram and then copying back into vram. On a 720p video it saved ~1ms in Debug build.
- Loading branch information
Showing
4 changed files
with
97 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,49 @@ | ||
#pragma once | ||
#include <stdbool.h> | ||
|
||
#if defined(WIN32) | ||
#include <Windows.h> | ||
#include <glad/glad_wgl.h> | ||
#include "mpv-source.h" | ||
|
||
extern bool wgl_have_NV_DX_interop; | ||
extern HANDLE wgl_dx_device; | ||
|
||
static inline void wgl_lock_shared_texture(void* context) | ||
{ | ||
struct mpv_source* src = context; | ||
wglDXLockObjectsNV(wgl_dx_device, 1, &src->gl_shared_texture_handle); | ||
} | ||
|
||
static inline void wgl_unlock_shared_texture(void* context) | ||
{ | ||
struct mpv_source* src = context; | ||
wglDXUnlockObjectsNV(wgl_dx_device, 1, &src->gl_shared_texture_handle); | ||
} | ||
|
||
#else | ||
# define wgl_have_NV_DX_interop 0 | ||
|
||
static inline void wgl_lock_shared_texture(void* context) | ||
{ | ||
UNUSED_PARAMETER(context); | ||
} | ||
|
||
static inline void wgl_unlock_shared_texture(void* context) | ||
{ | ||
UNUSED_PARAMETER(context); | ||
} | ||
#endif | ||
|
||
bool wgl_init(); | ||
|
||
void wgl_deinit(); | ||
|
||
bool wgl_enter_context(); | ||
|
||
void wgl_exit_context(); | ||
void wgl_exit_context(); | ||
|
||
void wgl_init_shared_gl_texture(void* context); | ||
|
||
void wgl_free_shared_gl_texture(void* context); | ||
|