Use DWM MMCSS for D3D11VA like DXVA2 does

This commit is contained in:
Cameron Gutman 2022-05-09 23:52:13 -05:00
parent 69af991772
commit ad5581c620

View file

@ -11,6 +11,8 @@
#include <SDL_syswm.h> #include <SDL_syswm.h>
#include <VersionHelpers.h> #include <VersionHelpers.h>
#include <dwmapi.h>
#define SAFE_COM_RELEASE(x) if (x) { (x)->Release(); } #define SAFE_COM_RELEASE(x) if (x) { (x)->Release(); }
typedef struct _VERTEX typedef struct _VERTEX
@ -95,10 +97,14 @@ D3D11VARenderer::D3D11VARenderer()
RtlZeroMemory(m_VideoTextureResourceViews, sizeof(m_VideoTextureResourceViews)); RtlZeroMemory(m_VideoTextureResourceViews, sizeof(m_VideoTextureResourceViews));
m_ContextLock = SDL_CreateMutex(); m_ContextLock = SDL_CreateMutex();
DwmEnableMMCSS(TRUE);
} }
D3D11VARenderer::~D3D11VARenderer() D3D11VARenderer::~D3D11VARenderer()
{ {
DwmEnableMMCSS(FALSE);
SDL_DestroyMutex(m_ContextLock); SDL_DestroyMutex(m_ContextLock);
SAFE_COM_RELEASE(m_VideoVertexBuffer); SAFE_COM_RELEASE(m_VideoVertexBuffer);