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

direct3d11: favor the format requested by the decoder if possible

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent edea8117
......@@ -694,7 +694,10 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
# endif
#endif
// look for the request pixel format first
for (unsigned i = 0; d3d_formats[i].name != 0; i++)
{
if( fmt->i_chroma == d3d_formats[i].fourcc)
{
UINT i_formatSupport;
if( SUCCEEDED( ID3D11Device_CheckFormatSupport(sys->d3ddevice,
......@@ -707,6 +710,37 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
sys->vlcFormat = d3d_formats[i].fourcc;
sys->d3dFormatY = d3d_formats[i].formatY;
sys->d3dFormatUV = d3d_formats[i].formatUV;
break;
}
}
}
// look for any pixel format that we can handle
if ( !sys->vlcFormat )
{
for (unsigned i = 0; d3d_formats[i].name != 0; i++)
{
UINT i_formatSupport;
if( SUCCEEDED( ID3D11Device_CheckFormatSupport(sys->d3ddevice,
d3d_formats[i].formatTexture,
&i_formatSupport)) &&
( i_formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D ))
{
msg_Dbg(vd, "Using pixel format %s", d3d_formats[i].name );
sys->d3dFormatTex = d3d_formats[i].formatTexture;
sys->vlcFormat = d3d_formats[i].fourcc;
sys->d3dFormatY = d3d_formats[i].formatY;
sys->d3dFormatUV = d3d_formats[i].formatUV;
break;
}
}
}
if ( !sys->vlcFormat )
{
msg_Err(vd, "Could not get a suitable texture pixel format");
return VLC_EGENERIC;
}
switch (sys->vlcFormat)
{
case VLC_CODEC_NV12:
......@@ -728,13 +762,6 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
sys->d3dPxShader = globPixelShaderDefault;
break;
}
break;
}
}
if ( !sys->vlcFormat ) {
msg_Err(vd, "Could not get a suitable texture pixel format");
return VLC_EGENERIC;
}
UpdateRects(vd, NULL, NULL, true);
......
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