summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-05-01 17:43:25 +0200
committerKacper Michajłow <kasper93@gmail.com>2024-04-19 03:32:29 +0200
commit1a495451ab13ada7d4134258accaa6927262d554 (patch)
tree4481b07ff65a5132a00963bba2f6f5d1f406ff7d /video
parent19a9164e246c197c77ec2d0c0f1f462e42bb4817 (diff)
downloadmpv-1a495451ab13ada7d4134258accaa6927262d554.tar.bz2
mpv-1a495451ab13ada7d4134258accaa6927262d554.tar.xz
d3d11: disable IDXGIInfoQueue usage if dxgidebug.h is incomplete
Older MinGW-w64 doesn't define IDXGIInfoQueue in dxgidebug.h.
Diffstat (limited to 'video')
-rw-r--r--video/out/d3d11/ra_d3d11.c12
-rw-r--r--video/out/gpu/d3d11_helpers.c2
-rw-r--r--video/out/gpu/d3d11_helpers.h5
3 files changed, 19 insertions, 0 deletions
diff --git a/video/out/d3d11/ra_d3d11.c b/video/out/d3d11/ra_d3d11.c
index 2b9c1aa11e..4438b2083c 100644
--- a/video/out/d3d11/ra_d3d11.c
+++ b/video/out/d3d11/ra_d3d11.c
@@ -44,9 +44,11 @@ struct ra_d3d11 {
struct dll_version d3d_compiler_ver;
+#if HAVE_DXGI_DEBUG
// Debug interfaces (--gpu-debug)
IDXGIDebug *debug;
IDXGIInfoQueue *iqueue;
+#endif
// Device capabilities
D3D_FEATURE_LEVEL fl;
@@ -2095,6 +2097,7 @@ static uint64_t timer_stop(struct ra *ra, ra_timer *ratimer)
return timer->result;
}
+#if HAVE_DXGI_DEBUG
static int map_msg_severity(DXGI_INFO_QUEUE_MESSAGE_SEVERITY sev)
{
switch (sev) {
@@ -2169,9 +2172,11 @@ static int map_msg_severity_by_id(D3D11_MESSAGE_ID id,
return map_msg_severity(sev);
}
}
+#endif
static void debug_marker(struct ra *ra, const char *msg)
{
+#if HAVE_DXGI_DEBUG
struct ra_d3d11 *p = ra->priv;
void *talloc_ctx = talloc_new(NULL);
HRESULT hr;
@@ -2212,6 +2217,7 @@ static void debug_marker(struct ra *ra, const char *msg)
IDXGIInfoQueue_ClearStoredMessages(p->iqueue, DXGI_DEBUG_ALL);
done:
talloc_free(talloc_ctx);
+#endif
}
static void destroy(struct ra *ra)
@@ -2242,6 +2248,7 @@ static void destroy(struct ra *ra)
}
SAFE_RELEASE(p->ctx);
+#if HAVE_DXGI_DEBUG
if (p->debug) {
// Report any leaked objects
debug_marker(ra, "after destroy");
@@ -2252,6 +2259,7 @@ static void destroy(struct ra *ra)
}
SAFE_RELEASE(p->debug);
SAFE_RELEASE(p->iqueue);
+#endif
talloc_free(ra);
}
@@ -2443,8 +2451,10 @@ struct ra *ra_d3d11_create(ID3D11Device *dev, struct mp_log *log,
p->max_uavs = D3D11_PS_CS_UAV_REGISTER_COUNT;
}
+#if HAVE_DXGI_DEBUG
if (ID3D11Device_GetCreationFlags(p->dev) & D3D11_CREATE_DEVICE_DEBUG)
mp_d3d11_get_debug_interfaces(ra->log, &p->debug, &p->iqueue);
+#endif
// Some level 9_x devices don't have timestamp queries
hr = ID3D11Device_CreateQuery(p->dev,
@@ -2458,9 +2468,11 @@ struct ra *ra_d3d11_create(ID3D11Device *dev, struct mp_log *log,
// https://msdn.microsoft.com/en-us/library/windows/desktop/ff476874.aspx
find_max_texture_dimension(ra);
+#if HAVE_DXGI_DEBUG
// Ignore any messages during find_max_texture_dimension
if (p->iqueue)
IDXGIInfoQueue_ClearStoredMessages(p->iqueue, DXGI_DEBUG_ALL);
+#endif
MP_VERBOSE(ra, "Maximum Texture2D size: %dx%d\n", ra->max_texture_wh,
ra->max_texture_wh);
diff --git a/video/out/gpu/d3d11_helpers.c b/video/out/gpu/d3d11_helpers.c
index 358a7deb8b..fa37d5ef30 100644
--- a/video/out/gpu/d3d11_helpers.c
+++ b/video/out/gpu/d3d11_helpers.c
@@ -1003,6 +1003,7 @@ done:
return ret;
}
+#if HAVE_DXGI_DEBUG
void mp_d3d11_get_debug_interfaces(struct mp_log *log, IDXGIDebug **debug,
IDXGIInfoQueue **iqueue)
{
@@ -1037,3 +1038,4 @@ void mp_d3d11_get_debug_interfaces(struct mp_log *log, IDXGIDebug **debug,
return;
}
}
+#endif
diff --git a/video/out/gpu/d3d11_helpers.h b/video/out/gpu/d3d11_helpers.h
index 166d451933..92322b9152 100644
--- a/video/out/gpu/d3d11_helpers.h
+++ b/video/out/gpu/d3d11_helpers.h
@@ -23,7 +23,10 @@
#include <d3d11.h>
#include <dxgi1_2.h>
#include <dxgi1_6.h>
+
+#if HAVE_DXGI_DEBUG
#include <dxgidebug.h>
+#endif
#include "video/mp_image.h"
@@ -114,7 +117,9 @@ bool mp_d3d11_create_swapchain(ID3D11Device *dev, struct mp_log *log,
struct d3d11_swapchain_opts *opts,
IDXGISwapChain **swapchain_out);
+#if HAVE_DXGI_DEBUG
void mp_d3d11_get_debug_interfaces(struct mp_log *log, IDXGIDebug **debug,
IDXGIInfoQueue **iqueue);
+#endif
#endif