Commit 63be579e authored by Martell Malone's avatar Martell Malone Committed by Jean-Baptiste Kempf

d3d11 vout plugin

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent f309e643
...@@ -55,6 +55,8 @@ Video ouput: ...@@ -55,6 +55,8 @@ Video ouput:
* Large rework of the Android video outputs: there is now Surface (2.1, 2.2) * Large rework of the Android video outputs: there is now Surface (2.1, 2.2)
NativeWindow (2.3+, supports hw rotation, subpicture blending, opaque) NativeWindow (2.3+, supports hw rotation, subpicture blending, opaque)
* Support rotation in Android NativeWindow output and hardware decoders * Support rotation in Android NativeWindow output and hardware decoders
* Renamed the Direct3D output module to Direct3D9
* Added Direct3D11 video mode supporting both Windows desktop and WinRT modes.
Video filter: Video filter:
* Hardware deinterlacing on the rPI, using MMAL * Hardware deinterlacing on the rPI, using MMAL
......
...@@ -3241,7 +3241,12 @@ AS_IF([test "${enable_directx}" != "no"], [ ...@@ -3241,7 +3241,12 @@ AS_IF([test "${enable_directx}" != "no"], [
#include <GL/gl.h> #include <GL/gl.h>
]) ])
dnl Direct3D dnl Direct3D11
AC_CHECK_HEADERS(d3d11.h, [
VLC_ADD_PLUGIN([direct3d11])
])
dnl Direct3D9
AC_CHECK_HEADERS(d3d9.h, [ AC_CHECK_HEADERS(d3d9.h, [
VLC_ADD_PLUGIN([direct3d9]) VLC_ADD_PLUGIN([direct3d9])
]) ])
......
...@@ -98,6 +98,7 @@ $Id$ ...@@ -98,6 +98,7 @@ $Id$
* diracsys: BBC Dirac demuxer * diracsys: BBC Dirac demuxer
* direct2d: video output module using the Direct2D API * direct2d: video output module using the Direct2D API
* direct3d9: video output module using the Direct3D9 API * direct3d9: video output module using the Direct3D9 API
* direct3d11: video output module using the Direct3D11 API
* directdraw: video output module using the DirectDraw API * directdraw: video output module using the DirectDraw API
* directfb: Direct Framebuffer video output * directfb: Direct Framebuffer video output
* directsound: audio output module using the DirectSound API * directsound: audio output module using the DirectSound API
......
...@@ -181,6 +181,22 @@ libdirect3d9_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' ...@@ -181,6 +181,22 @@ libdirect3d9_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
vout_LTLIBRARIES += $(LTLIBdirect3d9) vout_LTLIBRARIES += $(LTLIBdirect3d9)
EXTRA_LTLIBRARIES += libdirect3d9_plugin.la 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
libdirect3d11_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
-DMODULE_NAME_IS_direct3d11
if !HAVE_WINSTORE
libdirect3d11_plugin_la_LIBADD = -lgdi32 -lole32 -luuid
else
libdirect3d11_plugin_la_LIBADD = -ld3dcompiler -lole32 -luuid
endif
libdirect3d11_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
vout_LTLIBRARIES += $(LTLIBdirect3d11)
EXTRA_LTLIBRARIES += libdirect3d11_plugin.la
libdirectdraw_plugin_la_SOURCES = video_output/msw/directdraw.c \ libdirectdraw_plugin_la_SOURCES = video_output/msw/directdraw.c \
video_output/msw/common.c video_output/msw/common.h \ video_output/msw/common.c video_output/msw/common.h \
video_output/msw/events.c video_output/msw/events.h \ video_output/msw/events.c video_output/msw/events.h \
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Gildas Bazin <gbazin@videolan.org> * Authors: Gildas Bazin <gbazin@videolan.org>
* Martell Malone <martellmalone@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by * under the terms of the GNU Lesser General Public License as published by
...@@ -117,6 +118,13 @@ void CommonClean(vout_display_t *vd) ...@@ -117,6 +118,13 @@ void CommonClean(vout_display_t *vd)
RestoreScreensaver(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) void CommonManage(vout_display_t *vd)
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
...@@ -214,6 +222,25 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback, ...@@ -214,6 +222,25 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
picture->p->i_pitch = pitch; picture->p->i_pitch = pitch;
picture->p->i_lines = picture->format.i_visible_height; picture->p->i_lines = picture->format.i_visible_height;
/* Fill chroma planes for biplanar YUV */
if (picture->format.i_chroma == VLC_CODEC_NV12 ||
picture->format.i_chroma == VLC_CODEC_NV21) {
for (int n = 1; n < picture->i_planes; n++) {
const plane_t *o = &picture->p[n-1];
plane_t *p = &picture->p[n];
p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch;
p->i_pitch = pitch;
p->i_lines = picture->format.i_visible_height;
}
/* The dx/d3d buffer is always allocated as NV12 */
if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_NV12)) {
/* TODO : Swap NV21 UV planes to match NV12 */
return VLC_EGENERIC;
}
}
/* Fill chroma planes for planar YUV */ /* Fill chroma planes for planar YUV */
if (picture->format.i_chroma == VLC_CODEC_I420 || if (picture->format.i_chroma == VLC_CODEC_I420 ||
picture->format.i_chroma == VLC_CODEC_J420 || picture->format.i_chroma == VLC_CODEC_J420 ||
...@@ -348,7 +375,7 @@ void UpdateRects(vout_display_t *vd, ...@@ -348,7 +375,7 @@ void UpdateRects(vout_display_t *vd,
SWP_NOCOPYBITS|SWP_NOZORDER|SWP_ASYNCWINDOWPOS); SWP_NOCOPYBITS|SWP_NOZORDER|SWP_ASYNCWINDOWPOS);
/* Destination image position and dimensions */ /* Destination image position and dimensions */
#if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct2d) #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11) || defined(MODULE_NAME_IS_direct2d)
rect_dest.left = 0; rect_dest.left = 0;
rect_dest.right = place.width; rect_dest.right = place.width;
rect_dest.top = 0; rect_dest.top = 0;
...@@ -425,7 +452,7 @@ void UpdateRects(vout_display_t *vd, ...@@ -425,7 +452,7 @@ void UpdateRects(vout_display_t *vd,
/* Apply overlay hardware constraints */ /* Apply overlay hardware constraints */
if (sys->use_overlay) if (sys->use_overlay)
AlignRect(&rect_src_clipped, sys->i_align_src_boundary, sys->i_align_src_size); AlignRect(&rect_src_clipped, sys->i_align_src_boundary, sys->i_align_src_size);
#elif defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct2d) #elif defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11) || defined(MODULE_NAME_IS_direct2d)
/* Needed at least with YUV content */ /* Needed at least with YUV content */
rect_src_clipped.left &= ~1; rect_src_clipped.left &= ~1;
rect_src_clipped.right &= ~1; rect_src_clipped.right &= ~1;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* *
* Authors: Gildas Bazin <gbazin@videolan.org> * Authors: Gildas Bazin <gbazin@videolan.org>
* Damien Fouilleul <damienf@videolan.org> * Damien Fouilleul <damienf@videolan.org>
* Martell Malone <martellmalone@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by * under the terms of the GNU Lesser General Public License as published by
...@@ -25,6 +26,15 @@ ...@@ -25,6 +26,15 @@
#ifdef MODULE_NAME_IS_directdraw #ifdef MODULE_NAME_IS_directdraw
# include <ddraw.h> # include <ddraw.h>
#endif #endif
#ifdef MODULE_NAME_IS_direct3d11
# include <d3d11.h>
# if VLC_WINSTORE_APP
# include <dxgi1_2.h>
# else
# include <dxgi.h>
#endif
# include <d3dcompiler.h>
#endif
#ifdef MODULE_NAME_IS_direct3d9 #ifdef MODULE_NAME_IS_direct3d9
# include <d3d9.h> # include <d3d9.h>
# include <d3dx9effect.h> # include <d3dx9effect.h>
...@@ -135,6 +145,38 @@ struct vout_display_sys_t ...@@ -135,6 +145,38 @@ struct vout_display_sys_t
ID2D1Bitmap *d2_bitmap; /* D2 bitmap */ ID2D1Bitmap *d2_bitmap; /* D2 bitmap */
#endif #endif
#ifdef MODULE_NAME_IS_direct3d11
#if !VLC_WINSTORE_APP
HINSTANCE hdxgi_dll; /* handle of the opened dxgi dll */
HINSTANCE hd3d11_dll; /* handle of the opened d3d11 dll */
HINSTANCE hd3dcompiler_dll; /* handle of the opened d3dcompiler dll */
IDXGIAdapter *dxgiadapter; /* DXGI adapter */
IDXGIFactory *dxgifactory; /* DXGI factory */
IDXGISwapChain *dxgiswapChain; /* DXGI 1.0 swap chain */
/* We should find a better way to store this or atleast a shorter name */
PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN OurD3D11CreateDeviceAndSwapChain;
PFN_D3D11_CREATE_DEVICE OurD3D11CreateDevice;
pD3DCompile OurD3DCompile;
#else
IDXGISwapChain1 *dxgiswapChain; /* DXGI 1.1 swap chain */
#endif
ID3D11Device *d3ddevice; /* D3D device */
ID3D11DeviceContext *d3dcontext; /* D3D context */
ID3D11Texture2D *d3dtexture;
ID3D11ShaderResourceView *d3dresViewY;
ID3D11ShaderResourceView *d3dresViewUV;
ID3D11RenderTargetView *d3drenderTargetView;
ID3D11DepthStencilView *d3ddepthStencilView;
ID3D11VertexShader *d3dvertexShader;
ID3D11PixelShader *d3dpixelShader;
ID3D11InputLayout *d3dvertexLayout;
ID3D11SamplerState *d3dsampState;
picture_sys_t *picsys;
D3D_FEATURE_LEVEL d3dfeaturelevel;
DXGI_FORMAT d3dFormat;
vlc_fourcc_t vlcFormat;
#endif
#ifdef MODULE_NAME_IS_direct3d9 #ifdef MODULE_NAME_IS_direct3d9
bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */ bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */
/* show video on desktop window ? */ /* show video on desktop window ? */
...@@ -209,6 +251,8 @@ void UpdateRects (vout_display_t *, ...@@ -209,6 +251,8 @@ void UpdateRects (vout_display_t *,
bool is_forced); bool is_forced);
void AlignRect(RECT *, int align_boundary, int align_size); void AlignRect(RECT *, int align_boundary, int align_size);
picture_pool_t *CommonPool(vout_display_t *, unsigned);
/***************************************************************************** /*****************************************************************************
* Constants * Constants
*****************************************************************************/ *****************************************************************************/
......
This diff is collapsed.
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Gildas Bazin <gbazin@videolan.org> * Authors: Gildas Bazin <gbazin@videolan.org>
* Martell Malone <martellmalone@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by * under the terms of the GNU Lesser General Public License as published by
...@@ -620,7 +621,7 @@ static void MouseReleased( event_thread_t *p_event, unsigned button ) ...@@ -620,7 +621,7 @@ static void MouseReleased( event_thread_t *p_event, unsigned button )
vout_display_SendEventMouseReleased( p_event->vd, button ); vout_display_SendEventMouseReleased( p_event->vd, button );
} }
#ifdef MODULE_NAME_IS_direct3d9 #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)
static int CALLBACK static int CALLBACK
enumWindowsProc(HWND hwnd, LPARAM lParam) enumWindowsProc(HWND hwnd, LPARAM lParam)
{ {
...@@ -681,7 +682,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) ...@@ -681,7 +682,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
/* Get this module's instance */ /* Get this module's instance */
hInstance = GetModuleHandle(NULL); hInstance = GetModuleHandle(NULL);
#ifdef MODULE_NAME_IS_direct3d9 #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)
if( !p_event->use_desktop ) if( !p_event->use_desktop )
#endif #endif
{ {
...@@ -692,7 +693,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) ...@@ -692,7 +693,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
else else
p_event->hparent = NULL; p_event->hparent = NULL;
} }
#ifdef MODULE_NAME_IS_direct3d9 #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)
else else
{ {
vout_display_DeleteWindow(vd, NULL); vout_display_DeleteWindow(vd, NULL);
...@@ -719,7 +720,11 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) ...@@ -719,7 +720,11 @@ static int Win32VoutCreateWindow( event_thread_t *p_event )
wc.hIcon = p_event->vlc_icon; /* load the vlc big icon */ wc.hIcon = p_event->vlc_icon; /* load the vlc big icon */
wc.hCursor = p_event->is_cursor_hidden ? p_event->cursor_empty : wc.hCursor = p_event->is_cursor_hidden ? p_event->cursor_empty :
p_event->cursor_arrow; p_event->cursor_arrow;
#if !VLC_WINSTORE_APP
wc.hbrBackground = GetStockObject(BLACK_BRUSH); /* background color */ wc.hbrBackground = GetStockObject(BLACK_BRUSH); /* background color */
#else
wc.hbrBackground = NULL;
#endif
wc.lpszMenuName = NULL; /* no menu */ wc.lpszMenuName = NULL; /* no menu */
wc.lpszClassName = p_event->class_main; /* use a special class */ wc.lpszClassName = p_event->class_main; /* use a special class */
...@@ -865,14 +870,14 @@ static void Win32VoutCloseWindow( event_thread_t *p_event ) ...@@ -865,14 +870,14 @@ static void Win32VoutCloseWindow( event_thread_t *p_event )
vout_display_t *vd = p_event->vd; vout_display_t *vd = p_event->vd;
msg_Dbg( vd, "Win32VoutCloseWindow" ); msg_Dbg( vd, "Win32VoutCloseWindow" );
#ifdef MODULE_NAME_IS_direct3d9 #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)
DestroyWindow( p_event->hvideownd ); DestroyWindow( p_event->hvideownd );
#endif #endif
DestroyWindow( p_event->hwnd ); DestroyWindow( p_event->hwnd );
if( p_event->hfswnd ) if( p_event->hfswnd )
DestroyWindow( p_event->hfswnd ); DestroyWindow( p_event->hfswnd );
#ifdef MODULE_NAME_IS_direct3d9 #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)
if( !p_event->use_desktop ) if( !p_event->use_desktop )
#endif #endif
vout_display_DeleteWindow( vd, p_event->parent_window ); vout_display_DeleteWindow( vd, p_event->parent_window );
......
...@@ -1175,6 +1175,7 @@ modules/video_output/kva.c ...@@ -1175,6 +1175,7 @@ modules/video_output/kva.c
modules/video_output/macosx.m modules/video_output/macosx.m
modules/video_output/msw/direct2d.c modules/video_output/msw/direct2d.c
modules/video_output/msw/direct3d9.c modules/video_output/msw/direct3d9.c
modules/video_output/msw/direct3d11.c
modules/video_output/msw/directdraw.c modules/video_output/msw/directdraw.c
modules/video_output/msw/events.c modules/video_output/msw/events.c
modules/video_output/msw/glwin32.c modules/video_output/msw/glwin32.c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment