Commit e34bee32 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

direct3d11: we don't need to keep vlcFormat

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3071e185
...@@ -184,7 +184,6 @@ struct vout_display_sys_t ...@@ -184,7 +184,6 @@ struct vout_display_sys_t
ID3D11RenderTargetView *d3drenderTargetView; ID3D11RenderTargetView *d3drenderTargetView;
ID3D11DepthStencilView *d3ddepthStencilView; ID3D11DepthStencilView *d3ddepthStencilView;
picture_sys_t *picsys; picture_sys_t *picsys;
vlc_fourcc_t vlcFormat;
const char *d3dPxShader; const char *d3dPxShader;
// SPU // SPU
......
...@@ -860,12 +860,15 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt) ...@@ -860,12 +860,15 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
# endif # endif
#endif #endif
vlc_fourcc_t i_src_chroma = fmt->i_chroma;
fmt->i_chroma = 0;
// look for the request pixel format first // look for the request pixel format first
UINT i_quadSupportFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_SHADER_LOAD; UINT i_quadSupportFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_SHADER_LOAD;
UINT i_formatSupport; UINT i_formatSupport;
for (unsigned i = 0; d3d_formats[i].name != 0; i++) for (unsigned i = 0; d3d_formats[i].name != 0; i++)
{ {
if( fmt->i_chroma == d3d_formats[i].fourcc) if( i_src_chroma == d3d_formats[i].fourcc)
{ {
if( SUCCEEDED( ID3D11Device_CheckFormatSupport(sys->d3ddevice, if( SUCCEEDED( ID3D11Device_CheckFormatSupport(sys->d3ddevice,
d3d_formats[i].formatTexture, d3d_formats[i].formatTexture,
...@@ -873,7 +876,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt) ...@@ -873,7 +876,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
( i_formatSupport & i_quadSupportFlags ) == i_quadSupportFlags ) ( i_formatSupport & i_quadSupportFlags ) == i_quadSupportFlags )
{ {
msg_Dbg(vd, "Using pixel format %s", d3d_formats[i].name ); msg_Dbg(vd, "Using pixel format %s", d3d_formats[i].name );
sys->vlcFormat = d3d_formats[i].fourcc; fmt->i_chroma = d3d_formats[i].fourcc;
sys->picQuadConfig.textureFormat = d3d_formats[i].formatTexture; sys->picQuadConfig.textureFormat = d3d_formats[i].formatTexture;
sys->picQuadConfig.resourceFormatYRGB = d3d_formats[i].formatY; sys->picQuadConfig.resourceFormatYRGB = d3d_formats[i].formatY;
sys->picQuadConfig.resourceFormatUV = d3d_formats[i].formatUV; sys->picQuadConfig.resourceFormatUV = d3d_formats[i].formatUV;
...@@ -883,7 +886,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt) ...@@ -883,7 +886,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
} }
// look for any pixel format that we can handle // look for any pixel format that we can handle
if ( !sys->vlcFormat ) if ( !fmt->i_chroma )
{ {
for (unsigned i = 0; d3d_formats[i].name != 0; i++) for (unsigned i = 0; d3d_formats[i].name != 0; i++)
{ {
...@@ -893,7 +896,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt) ...@@ -893,7 +896,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
( i_formatSupport & i_quadSupportFlags ) == i_quadSupportFlags ) ( i_formatSupport & i_quadSupportFlags ) == i_quadSupportFlags )
{ {
msg_Dbg(vd, "Using pixel format %s", d3d_formats[i].name ); msg_Dbg(vd, "Using pixel format %s", d3d_formats[i].name );
sys->vlcFormat = d3d_formats[i].fourcc; fmt->i_chroma = d3d_formats[i].fourcc;
sys->picQuadConfig.textureFormat = d3d_formats[i].formatTexture; sys->picQuadConfig.textureFormat = d3d_formats[i].formatTexture;
sys->picQuadConfig.resourceFormatYRGB = d3d_formats[i].formatY; sys->picQuadConfig.resourceFormatYRGB = d3d_formats[i].formatY;
sys->picQuadConfig.resourceFormatUV = d3d_formats[i].formatUV; sys->picQuadConfig.resourceFormatUV = d3d_formats[i].formatUV;
...@@ -901,7 +904,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt) ...@@ -901,7 +904,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
} }
} }
} }
if ( !sys->vlcFormat ) if ( !fmt->i_chroma )
{ {
msg_Err(vd, "Could not get a suitable texture pixel format"); msg_Err(vd, "Could not get a suitable texture pixel format");
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -927,7 +930,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt) ...@@ -927,7 +930,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
sys->d3dregion_format = DXGI_FORMAT_UNKNOWN; sys->d3dregion_format = DXGI_FORMAT_UNKNOWN;
} }
switch (sys->vlcFormat) switch (fmt->i_chroma)
{ {
case VLC_CODEC_NV12: case VLC_CODEC_NV12:
if( fmt->i_height > 576 ) if( fmt->i_height > 576 )
...@@ -1000,8 +1003,6 @@ static int Direct3D11CreateResources(vout_display_t *vd, video_format_t *fmt) ...@@ -1000,8 +1003,6 @@ static int Direct3D11CreateResources(vout_display_t *vd, video_format_t *fmt)
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
HRESULT hr; HRESULT hr;
fmt->i_chroma = sys->vlcFormat;
hr = UpdateBackBuffer(vd); hr = UpdateBackBuffer(vd);
if (FAILED(hr)) { if (FAILED(hr)) {
msg_Err(vd, "Could not update the backbuffer. (hr=0x%lX)", hr); msg_Err(vd, "Could not update the backbuffer. (hr=0x%lX)", hr);
......
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