mirror of https://github.com/mpv-player/mpv
d3d11: disable IDXGIInfoQueue usage if dxgidebug.h is incomplete
Older MinGW-w64 doesn't define IDXGIInfoQueue in dxgidebug.h.
This commit is contained in:
parent
19a9164e24
commit
1a495451ab
|
@ -995,6 +995,7 @@ if features['d3d11']
|
||||||
sources += files('video/out/d3d11/context.c',
|
sources += files('video/out/d3d11/context.c',
|
||||||
'video/out/d3d11/ra_d3d11.c')
|
'video/out/d3d11/ra_d3d11.c')
|
||||||
features += {'dxgi-debug-d3d11': cc.has_header_symbol('d3d11sdklayers.h', 'DXGI_DEBUG_D3D11')}
|
features += {'dxgi-debug-d3d11': cc.has_header_symbol('d3d11sdklayers.h', 'DXGI_DEBUG_D3D11')}
|
||||||
|
features += {'dxgi-debug': cc.has_header_symbol('dxgidebug.h', 'IID_IDXGIInfoQueue')}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
wayland = {
|
wayland = {
|
||||||
|
|
|
@ -44,9 +44,11 @@ struct ra_d3d11 {
|
||||||
|
|
||||||
struct dll_version d3d_compiler_ver;
|
struct dll_version d3d_compiler_ver;
|
||||||
|
|
||||||
|
#if HAVE_DXGI_DEBUG
|
||||||
// Debug interfaces (--gpu-debug)
|
// Debug interfaces (--gpu-debug)
|
||||||
IDXGIDebug *debug;
|
IDXGIDebug *debug;
|
||||||
IDXGIInfoQueue *iqueue;
|
IDXGIInfoQueue *iqueue;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Device capabilities
|
// Device capabilities
|
||||||
D3D_FEATURE_LEVEL fl;
|
D3D_FEATURE_LEVEL fl;
|
||||||
|
@ -2095,6 +2097,7 @@ static uint64_t timer_stop(struct ra *ra, ra_timer *ratimer)
|
||||||
return timer->result;
|
return timer->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_DXGI_DEBUG
|
||||||
static int map_msg_severity(DXGI_INFO_QUEUE_MESSAGE_SEVERITY sev)
|
static int map_msg_severity(DXGI_INFO_QUEUE_MESSAGE_SEVERITY sev)
|
||||||
{
|
{
|
||||||
switch (sev) {
|
switch (sev) {
|
||||||
|
@ -2169,9 +2172,11 @@ static int map_msg_severity_by_id(D3D11_MESSAGE_ID id,
|
||||||
return map_msg_severity(sev);
|
return map_msg_severity(sev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void debug_marker(struct ra *ra, const char *msg)
|
static void debug_marker(struct ra *ra, const char *msg)
|
||||||
{
|
{
|
||||||
|
#if HAVE_DXGI_DEBUG
|
||||||
struct ra_d3d11 *p = ra->priv;
|
struct ra_d3d11 *p = ra->priv;
|
||||||
void *talloc_ctx = talloc_new(NULL);
|
void *talloc_ctx = talloc_new(NULL);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -2212,6 +2217,7 @@ static void debug_marker(struct ra *ra, const char *msg)
|
||||||
IDXGIInfoQueue_ClearStoredMessages(p->iqueue, DXGI_DEBUG_ALL);
|
IDXGIInfoQueue_ClearStoredMessages(p->iqueue, DXGI_DEBUG_ALL);
|
||||||
done:
|
done:
|
||||||
talloc_free(talloc_ctx);
|
talloc_free(talloc_ctx);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroy(struct ra *ra)
|
static void destroy(struct ra *ra)
|
||||||
|
@ -2242,6 +2248,7 @@ static void destroy(struct ra *ra)
|
||||||
}
|
}
|
||||||
SAFE_RELEASE(p->ctx);
|
SAFE_RELEASE(p->ctx);
|
||||||
|
|
||||||
|
#if HAVE_DXGI_DEBUG
|
||||||
if (p->debug) {
|
if (p->debug) {
|
||||||
// Report any leaked objects
|
// Report any leaked objects
|
||||||
debug_marker(ra, "after destroy");
|
debug_marker(ra, "after destroy");
|
||||||
|
@ -2252,6 +2259,7 @@ static void destroy(struct ra *ra)
|
||||||
}
|
}
|
||||||
SAFE_RELEASE(p->debug);
|
SAFE_RELEASE(p->debug);
|
||||||
SAFE_RELEASE(p->iqueue);
|
SAFE_RELEASE(p->iqueue);
|
||||||
|
#endif
|
||||||
|
|
||||||
talloc_free(ra);
|
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;
|
p->max_uavs = D3D11_PS_CS_UAV_REGISTER_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_DXGI_DEBUG
|
||||||
if (ID3D11Device_GetCreationFlags(p->dev) & D3D11_CREATE_DEVICE_DEBUG)
|
if (ID3D11Device_GetCreationFlags(p->dev) & D3D11_CREATE_DEVICE_DEBUG)
|
||||||
mp_d3d11_get_debug_interfaces(ra->log, &p->debug, &p->iqueue);
|
mp_d3d11_get_debug_interfaces(ra->log, &p->debug, &p->iqueue);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Some level 9_x devices don't have timestamp queries
|
// Some level 9_x devices don't have timestamp queries
|
||||||
hr = ID3D11Device_CreateQuery(p->dev,
|
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
|
// https://msdn.microsoft.com/en-us/library/windows/desktop/ff476874.aspx
|
||||||
find_max_texture_dimension(ra);
|
find_max_texture_dimension(ra);
|
||||||
|
|
||||||
|
#if HAVE_DXGI_DEBUG
|
||||||
// Ignore any messages during find_max_texture_dimension
|
// Ignore any messages during find_max_texture_dimension
|
||||||
if (p->iqueue)
|
if (p->iqueue)
|
||||||
IDXGIInfoQueue_ClearStoredMessages(p->iqueue, DXGI_DEBUG_ALL);
|
IDXGIInfoQueue_ClearStoredMessages(p->iqueue, DXGI_DEBUG_ALL);
|
||||||
|
#endif
|
||||||
|
|
||||||
MP_VERBOSE(ra, "Maximum Texture2D size: %dx%d\n", ra->max_texture_wh,
|
MP_VERBOSE(ra, "Maximum Texture2D size: %dx%d\n", ra->max_texture_wh,
|
||||||
ra->max_texture_wh);
|
ra->max_texture_wh);
|
||||||
|
|
|
@ -1003,6 +1003,7 @@ done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_DXGI_DEBUG
|
||||||
void mp_d3d11_get_debug_interfaces(struct mp_log *log, IDXGIDebug **debug,
|
void mp_d3d11_get_debug_interfaces(struct mp_log *log, IDXGIDebug **debug,
|
||||||
IDXGIInfoQueue **iqueue)
|
IDXGIInfoQueue **iqueue)
|
||||||
{
|
{
|
||||||
|
@ -1037,3 +1038,4 @@ void mp_d3d11_get_debug_interfaces(struct mp_log *log, IDXGIDebug **debug,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -23,7 +23,10 @@
|
||||||
#include <d3d11.h>
|
#include <d3d11.h>
|
||||||
#include <dxgi1_2.h>
|
#include <dxgi1_2.h>
|
||||||
#include <dxgi1_6.h>
|
#include <dxgi1_6.h>
|
||||||
|
|
||||||
|
#if HAVE_DXGI_DEBUG
|
||||||
#include <dxgidebug.h>
|
#include <dxgidebug.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "video/mp_image.h"
|
#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,
|
struct d3d11_swapchain_opts *opts,
|
||||||
IDXGISwapChain **swapchain_out);
|
IDXGISwapChain **swapchain_out);
|
||||||
|
|
||||||
|
#if HAVE_DXGI_DEBUG
|
||||||
void mp_d3d11_get_debug_interfaces(struct mp_log *log, IDXGIDebug **debug,
|
void mp_d3d11_get_debug_interfaces(struct mp_log *log, IDXGIDebug **debug,
|
||||||
IDXGIInfoQueue **iqueue);
|
IDXGIInfoQueue **iqueue);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue