vlc | branch: master | Jean-Baptiste Kempf <[email protected]> | Wed May 27 11:59:38 2015 +0200| [7b00c39992c196032b80a20e2594675d72ec20ef] | committer: Jean-Baptiste Kempf
Compile D3D11 for WinRT This is based on some work by Martell, and modified by /me It's not yet perfectly clean, but that will come in the next commits > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7b00c39992c196032b80a20e2594675d72ec20ef --- modules/video_output/Makefile.am | 8 ++--- modules/video_output/msw/common.c | 52 +++++++++++++++++++++++++-------- modules/video_output/msw/direct3d11.c | 22 +++++++++----- 3 files changed, 59 insertions(+), 23 deletions(-) diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am index 5aaeafb..2c8f930 100644 --- a/modules/video_output/Makefile.am +++ b/modules/video_output/Makefile.am @@ -182,13 +182,13 @@ vout_LTLIBRARIES += $(LTLIBdirect3d9) EXTRA_LTLIBRARIES += libdirect3d9_plugin.la libdirect3d11_plugin_la_SOURCES = video_output/msw/direct3d11.c \ - video_output/msw/common.c video_output/msw/common.h \ - video_output/msw/events.c video_output/msw/events.h \ - video_output/msw/builtin_shaders.h \ - video_output/msw/win32touch.c video_output/msw/win32touch.h + video_output/msw/common.c video_output/msw/common.h libdirect3d11_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \ -DMODULE_NAME_IS_direct3d11 if !HAVE_WINSTORE +libdirect3d11_plugin_la_SOURCES += video_output/msw/events.c \ + video_output/msw/events.h video_output/msw/builtin_shaders.h \ + video_output/msw/win32touch.c video_output/msw/win32touch.h libdirect3d11_plugin_la_LIBADD = -lgdi32 -lole32 -luuid else libdirect3d11_plugin_la_LIBADD = -ld3dcompiler -lole32 -luuid diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c index 987f260..1e5b5f7 100644 --- a/modules/video_output/msw/common.c +++ b/modules/video_output/msw/common.c @@ -42,11 +42,13 @@ #include <vlc_windows_interfaces.h> +#if !VLC_WINSTORE_APP static void CommonChangeThumbnailClip(vout_display_t *, bool show); static int CommonControlSetFullscreen(vout_display_t *, bool is_fullscreen); static void DisableScreensaver(vout_display_t *); static void RestoreScreensaver(vout_display_t *); +#endif /* */ int CommonInit(vout_display_t *vd) @@ -58,10 +60,12 @@ int CommonInit(vout_display_t *vd) sys->hparent = NULL; sys->hfswnd = NULL; sys->changes = 0; + sys->is_first_display = true; + sys->is_on_top = false; + +#if !VLC_WINSTORE_APP SetRectEmpty(&sys->rect_display); SetRectEmpty(&sys->rect_parent); - sys->is_first_display = true; - sys->is_on_top = false; var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); @@ -70,6 +74,7 @@ int CommonInit(vout_display_t *vd) sys->event = EventThreadCreate(vd); if (!sys->event) return VLC_EGENERIC; +#endif event_cfg_t cfg; memset(&cfg, 0, sizeof(cfg)); @@ -84,6 +89,7 @@ int CommonInit(vout_display_t *vd) cfg.width = vd->cfg->display.width; cfg.height = vd->cfg->display.height; +#if !VLC_WINSTORE_APP event_hwnd_t hwnd; if (EventThreadStart(sys->event, &hwnd, &cfg)) return VLC_EGENERIC; @@ -100,15 +106,24 @@ int CommonInit(vout_display_t *vd) } DisableScreensaver (vd); +#endif return VLC_SUCCESS; } /* */ +picture_pool_t *CommonPool(vout_display_t *vd, unsigned count) +{ + VLC_UNUSED(count); + return vd->sys->pool; +} + + +#if !VLC_WINSTORE_APP +/* */ void CommonClean(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; - if (sys->event) { CommonChangeThumbnailClip(vd, false); EventThreadStop(sys->event); @@ -118,13 +133,6 @@ void CommonClean(vout_display_t *vd) RestoreScreensaver(vd); } -/* */ -picture_pool_t *CommonPool(vout_display_t *vd, unsigned count) -{ - VLC_UNUSED(count); - return vd->sys->pool; -} - void CommonManage(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; @@ -133,7 +141,6 @@ void CommonManage(vout_display_t *vd) * messages. But since window can stay blocked into this function for a * long time (for example when you move your window on the screen), I * decided to isolate PeekMessage in another thread. */ - /* If we do not control our window, we check for geometry changes * ourselves because the parent might not send us its events. */ if (sys->hparent) { @@ -179,7 +186,6 @@ void CommonManage(vout_display_t *vd) void CommonDisplay(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; - if (!sys->is_first_display) return; @@ -195,6 +201,7 @@ void CommonDisplay(vout_display_t *vd) SWP_NOZORDER); sys->is_first_display = false; } +#endif /** * It updates a picture data/pitches. @@ -272,6 +279,7 @@ void AlignRect(RECT *r, int align_boundary, int align_size) r->right = ((r->right - r->left + align_size/2) & ~align_size) + r->left; } +#if !VLC_WINSTORE_APP /* */ static void CommonChangeThumbnailClip(vout_display_t *vd, bool show) { @@ -710,3 +718,23 @@ static void RestoreScreensaver(vout_display_t *vd) sys->i_spi_screensaveactive, NULL, 0); } } + +#else + +int CommonControl(vout_display_t *vd, int query, va_list args) +{ + switch (query) { + default: + return VLC_EGENERIC; + } +} + +void CommonManage(vout_display_t *vd) {}; +void CommonClean(vout_display_t *vd) {}; +void CommonDisplay(vout_display_t *vd) {}; +void UpdateRects(vout_display_t *vd, + const vout_display_cfg_t *cfg, + const video_format_t *source, + bool is_forced) +{}; +#endif diff --git a/modules/video_output/msw/direct3d11.c b/modules/video_output/msw/direct3d11.c index 280d710..48e5f03 100644 --- a/modules/video_output/msw/direct3d11.c +++ b/modules/video_output/msw/direct3d11.c @@ -44,7 +44,6 @@ # define D3D11CreateDevice(args...) sys->OurD3D11CreateDevice(args) # define D3DCompile(args...) sys->OurD3DCompile(args) #else -# define IDXGISwapChain_Present(args...) IDXGISwapChain_Present1(args) # define IDXGIFactory_CreateSwapChain(a,b,c,d) IDXGIFactory2_CreateSwapChainForComposition(a,b,c,NULL,d) # define DXGI_SWAP_CHAIN_DESC DXGI_SWAP_CHAIN_DESC1 #endif @@ -598,8 +597,10 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic vout_display_sys_t *sys = vd->sys; VLC_UNUSED(picture); - /* float ClearColor[4] = { 1.0f, 0.125f, 0.3f, 1.0f }; */ - /* ID3D11DeviceContext_ClearRenderTargetView(sys->d3dcontext,sys->d3drenderTargetView, ClearColor); */ +#if VLC_WINSTORE_APP /* TODO: Choose the WinRT app background clear color */ + float ClearColor[4] = { 1.0f, 0.125f, 0.3f, 1.0f }; + ID3D11DeviceContext_ClearRenderTargetView(sys->d3dcontext,sys->d3drenderTargetView, ClearColor); +#endif ID3D11DeviceContext_ClearDepthStencilView(sys->d3dcontext,sys->d3ddepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0); if (subpicture) { @@ -655,9 +656,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic static void Direct3D11Destroy(vout_display_t *vd) { - #if !VLC_WINSTORE_APP - vout_display_sys_t *sys = vd->sys; # if USE_DXGI @@ -679,9 +678,7 @@ static void Direct3D11Destroy(vout_display_t *vd) sys->hd3d11_dll = NULL; sys->hd3dcompiler_dll = NULL; #else - VLC_UNUSED(vd); - #endif } @@ -965,7 +962,9 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt) return VLC_EGENERIC; } +#if !VLC_WINSTORE_APP EventThreadUpdateTitle(sys->event, VOUT_TITLE " (Direct3D11 output)"); +#endif msg_Dbg(vd, "Direct3D11 device adapter successfully initialized"); return VLC_SUCCESS; @@ -976,12 +975,21 @@ static void Direct3D11Close(vout_display_t *vd) vout_display_sys_t *sys = vd->sys; Direct3D11DestroyResources(vd); +#if !VLC_WINSTORE_APP if (sys->dxgiswapChain) IDXGISwapChain_Release(sys->dxgiswapChain); if ( sys->d3dcontext ) ID3D11DeviceContext_Release(sys->d3dcontext); if ( sys->d3ddevice ) ID3D11Device_Release(sys->d3ddevice); +#else + if ( sys->d3dcontext ) + ID3D11DeviceContext_Flush(sys->d3dcontext); + + sys->d3dcontext = NULL; + sys->d3ddevice = NULL; + sys->dxgiswapChain = NULL; +#endif msg_Dbg(vd, "Direct3D11 device adapter closed"); } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
