diff --git a/video/decode/d3d11va.c b/video/decode/d3d11va.c index 8ce07880e7..e31582d37c 100644 --- a/video/decode/d3d11va.c +++ b/video/decode/d3d11va.c @@ -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) {