On Thu, 22 Jun 2017, wm4 wrote:

Basically copied from VLC (LGPL):

http://git.videolan.org/?p=vlc.git;a=blob;f=modules/video_output/win32/direct3d11.c;h=e9fcb83dcabfe778f26e63d19f218caf06a7c3ae;hb=HEAD#l1482
http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/d3d11va.c;h=85e7d25caebc059a9770da2ef4bb8fe90816d76d;hb=HEAD#l599
---
Rebased from previous patch set.
---
configure                     |  2 ++
libavutil/hwcontext_d3d11va.c | 32 ++++++++++++++++++++++++++++++++
libavutil/hwcontext_d3d11va.h |  4 ++++
3 files changed, 38 insertions(+)

diff --git a/configure b/configure
index bbed2258b9..020d1e03ee 100755
--- a/configure
+++ b/configure
@@ -1556,6 +1556,7 @@ HEADERS_LIST="
    dev_video_meteor_ioctl_meteor_h
    direct_h
    dlfcn_h
+    dxgidebug_h
    dxva_h
    gsm_h
    io_h
@@ -4650,6 +4651,7 @@ check_struct windows.h "CONDITION_VARIABLE" Ptr
check_header d3d11.h
check_header direct.h
check_header dlfcn.h
+check_header dxgidebug.h
check_header dxva.h
check_header dxva2api.h
check_header io.h
diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 376c76e5cf..a4924e34d2 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -16,6 +16,8 @@
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

+#include "config.h"
+
#include <windows.h>

// Include thread.h before redefining _WIN32_WINNT, to get
@@ -32,6 +34,10 @@
#include <d3d11.h>
#include <dxgi1_2.h>

+#if HAVE_DXGIDEBUG_H
+#include <dxgidebug.h>
+#endif
+
#include "avassert.h"
#include "common.h"
#include "hwcontext.h"
@@ -476,8 +482,18 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, 
const char *device,
    IDXGIAdapter           *pAdapter = NULL;
    ID3D10Multithread      *pMultithread;
    UINT creationFlags = D3D11_CREATE_DEVICE_VIDEO_SUPPORT;
+    int is_debug       = !!av_dict_get(opts, "debug", NULL, 0);
    int ret;

+    // (On UWP we can't check this.)
+#if HAVE_LOADLIBRARY
+    if (!LoadLibrary("d3d11_1sdklayers.dll"))
+        is_debug = 0;
+#endif
+
+    if (is_debug)
+        creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
+
    if ((ret = ff_thread_once(&functions_loaded, load_functions)) != 0)
        return AVERROR_UNKNOWN;
    if (!mD3D11CreateDevice || !mCreateDXGIFactory) {
@@ -511,6 +527,22 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, 
const char *device,
        ID3D10Multithread_Release(pMultithread);
    }

+#if !defined(UWP) && HAVE_DXGIDEBUG_H

We don't have any UWP define here any longer; shouldn't this be this be #if HAVE_LOADLIBRARY && HAVE_DXGIDBEUG_H instead?

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to