[vlc-commits] direct3d11: use DXGI_SWAP_EFFECT_FLIP_DISCARD on Windows 10
Steve Lhomme
git at videolan.org
Mon Oct 15 13:39:26 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Oct 15 12:54:29 2018 +0200| [d4f178086f313c759dca1b471666216226bba3d6] | committer: Steve Lhomme
direct3d11: use DXGI_SWAP_EFFECT_FLIP_DISCARD on Windows 10
See https://docs.microsoft.com/en-us/windows/desktop/direct3ddxgi/for-best-performance--use-dxgi-flip-model
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d4f178086f313c759dca1b471666216226bba3d6
---
modules/video_output/win32/direct3d11.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index e33ebee682..d5c4f17fa7 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -493,7 +493,18 @@ static void FillSwapChainDesc(vout_display_t *vd, DXGI_SWAP_CHAIN_DESC1 *out)
out->Height = vd->source.i_visible_height;
out->Format = vd->sys->display.pixelFormat->formatTexture;
//out->Flags = 512; // DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO;
- out->SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
+
+ bool isWin10OrGreater = false;
+ HMODULE hKernelBase = GetModuleHandle(TEXT("kernelbase.dll"));
+ if (likely(hKernelBase != NULL))
+ {
+ isWin10OrGreater = GetProcAddress(hKernelBase, "VirtualAllocFromApp") != NULL;
+ FreeLibrary(hKernelBase);
+ }
+ if (isWin10OrGreater)
+ out->SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
+ else
+ out->SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
}
#endif
More information about the vlc-commits
mailing list