vlc | branch: master | Steve Lhomme <[email protected]> | Wed Feb 21 09:28:51 2018 +0100| [75d0338ba7e6de66aed82812fe8430441a4086e6] | committer: Steve Lhomme
direct3d11: keep track of the pixel format used for the display > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=75d0338ba7e6de66aed82812fe8430441a4086e6 --- modules/video_output/win32/d3d11_shaders.h | 1 + modules/video_output/win32/direct3d11.c | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h index 737700e6f3..cad24c302b 100644 --- a/modules/video_output/win32/d3d11_shaders.h +++ b/modules/video_output/win32/d3d11_shaders.h @@ -44,6 +44,7 @@ typedef struct { typedef struct { const dxgi_color_space *colorspace; unsigned luminance_peak; + const d3d_format_t *pixelFormat; } display_info_t; const char* globVertexShaderFlat; diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c index 2974844436..f9b9600134 100644 --- a/modules/video_output/win32/direct3d11.c +++ b/modules/video_output/win32/direct3d11.c @@ -500,15 +500,7 @@ static void FillSwapChainDesc(vout_display_t *vd, DXGI_SWAP_CHAIN_DESC1 *out) out->SampleDesc.Quality = 0; out->Width = vd->source.i_visible_width; out->Height = vd->source.i_visible_height; - switch(vd->source.i_chroma) - { - case VLC_CODEC_D3D11_OPAQUE_10B: - out->Format = DXGI_FORMAT_R10G10B10A2_UNORM; - break; - default: - out->Format = DXGI_FORMAT_R8G8B8A8_UNORM; /* TODO: use DXGI_FORMAT_NV12 */ - break; - } + out->Format = vd->sys->display.pixelFormat->formatTexture; //out->Flags = 512; // DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO; out->SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; } @@ -1282,7 +1274,6 @@ static int Direct3D11Open(vout_display_t *vd) HRESULT hr = S_OK; DXGI_SWAP_CHAIN_DESC1 scd; - FillSwapChainDesc(vd, &scd); hr = D3D11_CreateDevice(vd, &sys->hd3d, is_d3d11_opaque(vd->source.i_chroma), @@ -1305,6 +1296,20 @@ static int Direct3D11Open(vout_display_t *vd) return VLC_EGENERIC; } + sys->display.pixelFormat = FindD3D11Format( sys->d3d_dev.d3ddevice, 0, true, + vd->source.i_chroma==VLC_CODEC_D3D11_OPAQUE_10B ? 10 : 8, + false, D3D11_FORMAT_SUPPORT_DISPLAY ); + if (unlikely(sys->display.pixelFormat == NULL)) + sys->display.pixelFormat = FindD3D11Format( sys->d3d_dev.d3ddevice, 0, false, + vd->source.i_chroma==VLC_CODEC_D3D11_OPAQUE_10B ? 10 : 8, + false, D3D11_FORMAT_SUPPORT_DISPLAY ); + if (unlikely(sys->display.pixelFormat == NULL)) { + msg_Err(vd, "Could not get the SwapChain format."); + return VLC_EGENERIC; + } + + FillSwapChainDesc(vd, &scd); + hr = IDXGIFactory2_CreateSwapChainForHwnd(dxgifactory, (IUnknown *)sys->d3d_dev.d3ddevice, sys->sys.hvideownd, &scd, NULL, NULL, &sys->dxgiswapChain); if (hr == DXGI_ERROR_INVALID_CALL && scd.Format == DXGI_FORMAT_R10G10B10A2_UNORM) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
