1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-13 18:37:10 +00:00

d3d11va: unconditionally load D3D DLLs

At least with Nvidia drivers, some thread tries to access D3D11 objects
after ANGLE unloads d3d11.dll. Fix this by holding a reference to
d3d11.dll ourselves.

Might fix the crash in #3348. (I wish I knew why though.)
This commit is contained in:
James Ross-Gowan 2016-11-23 00:55:20 +11:00
parent f843ae9983
commit 745862131f

View File

@ -429,7 +429,6 @@ static bool create_device(struct lavc_ctx *s, BOOL thread_safe)
HRESULT hr;
struct priv *p = s->hwdec_priv;
d3d_load_dlls();
if (!d3d11_dll) {
MP_ERR(p, "Failed to load D3D11 library\n");
return false;
@ -492,6 +491,11 @@ static int d3d11va_init(struct lavc_ctx *s)
if (!p)
return -1;
// Unconditionally load Direct3D DLLs, even when using a VO-supplied D3D11
// device. This prevents a crash that occurs at least with NVIDIA drivers,
// where D3D objects are accessed after ANGLE unloads d3d11.dll.
d3d_load_dlls();
s->hwdec_priv = p;
p->log = mp_log_new(s, s->log, "d3d11va");
if (s->hwdec->type == HWDEC_D3D11VA_COPY) {