From f9ef0a99d64cd38318b711352d1ed79936632054 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 13 Jul 2018 20:20:30 -0700 Subject: [PATCH] Fix DX threading violation by setting D3DCREATE_MULTITHREADED --- app/streaming/renderers/dxva2.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/streaming/renderers/dxva2.cpp b/app/streaming/renderers/dxva2.cpp index 78265731..9e0f3dd7 100644 --- a/app/streaming/renderers/dxva2.cpp +++ b/app/streaming/renderers/dxva2.cpp @@ -342,6 +342,11 @@ bool DXVA2Renderer::initialize(SDL_Window* window, int videoFormat, int width, i m_Width = width; m_Height = height; + // FFmpeg will be decoding on different threads than the main thread that we're + // currently running on right now. We must set this hint so SDL will pass + // D3DCREATE_MULTITHREADED to IDirect3D9::CreateDevice(). + SDL_SetHint(SDL_HINT_RENDER_DIRECT3D_THREADSAFE, "1"); + m_SdlRenderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); if (!m_SdlRenderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,