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

direct3d11: use P010 for all pixel formats with more than 8 bits per channel

parent 8d6fb616
......@@ -63,6 +63,7 @@ static void EsFormatMergeSize( es_format_t *p_dst,
static const vlc_fourcc_t pi_allowed_chromas[] = {
VLC_CODEC_I420,
VLC_CODEC_I422,
VLC_CODEC_I420_10L,
VLC_CODEC_RGB32,
VLC_CODEC_RGB24,
0
......
......@@ -60,6 +60,7 @@ static const dxgi_format_t dxgi_formats[] = {
static const d3d_format_t d3d_formats[] = {
{ "NV12", DXGI_FORMAT_NV12, VLC_CODEC_NV12, 8, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM },
{ "VA_NV12", DXGI_FORMAT_NV12, VLC_CODEC_D3D11_OPAQUE, 8, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM },
{ "P010", DXGI_FORMAT_P010, VLC_CODEC_P010, 10, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM },
{ "VA_P010", DXGI_FORMAT_P010, VLC_CODEC_D3D11_OPAQUE_10B, 10, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM },
#ifdef BROKEN_PIXEL
{ "YUY2", DXGI_FORMAT_YUY2, VLC_CODEC_I422, 8, DXGI_FORMAT_R8G8B8A8_UNORM, 0 },
......@@ -67,7 +68,6 @@ static const d3d_format_t d3d_formats[] = {
{ "Y416", DXGI_FORMAT_Y416, VLC_CODEC_I444_16L, 16, DXGI_FORMAT_R16G16B16A16_UINT, 0 },
#endif
#ifdef UNTESTED
{ "P010", DXGI_FORMAT_P010, VLC_CODEC_P010, 10, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM },
{ "Y210", DXGI_FORMAT_Y210, VLC_CODEC_I422_10L, 10, DXGI_FORMAT_R16G16B16A16_UNORM, 0 },
{ "Y410", DXGI_FORMAT_Y410, VLC_CODEC_I444, 10, DXGI_FORMAT_R10G10B10A2_UNORM, 0 },
{ "NV11", DXGI_FORMAT_NV11, VLC_CODEC_I411, 8, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM },
......
......@@ -457,7 +457,8 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
/* Fill chroma planes for biplanar YUV */
if (picture->format.i_chroma == VLC_CODEC_NV12 ||
picture->format.i_chroma == VLC_CODEC_NV21) {
picture->format.i_chroma == VLC_CODEC_NV21 ||
picture->format.i_chroma == VLC_CODEC_P010) {
for (int n = 1; n < picture->i_planes; n++) {
const plane_t *o = &picture->p[n-1];
......
......@@ -1077,6 +1077,48 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
}
}
// look for any pixel format that we can handle with enough pixels per channel
if ( !fmt->i_chroma )
{
uint8_t bits_per_channel;
switch (i_src_chroma)
{
case VLC_CODEC_D3D11_OPAQUE:
bits_per_channel = 8;
break;
case VLC_CODEC_D3D11_OPAQUE_10B:
bits_per_channel = 10;
break;
default:
{
const vlc_chroma_description_t *p_format = vlc_fourcc_GetChromaDescription(i_src_chroma);
bits_per_channel = p_format == NULL || p_format->pixel_bits == 0 ? 8 : p_format->pixel_bits;
}
break;
}
for (const d3d_format_t *output_format = GetRenderFormatList();
output_format->name != NULL; ++output_format)
{
if( bits_per_channel <= output_format->bitsPerChannel )
{
if( SUCCEEDED( ID3D11Device_CheckFormatSupport(sys->d3ddevice,
output_format->formatTexture,
&i_formatSupport)) &&
( i_formatSupport & i_quadSupportFlags ) == i_quadSupportFlags )
{
msg_Dbg( vd, "Using pixel format %s for chroma %4.4s", output_format->name,
(char *)&i_src_chroma );
fmt->i_chroma = output_format->fourcc;
DxgiFormatMask( output_format->formatTexture, fmt );
sys->picQuadConfig.textureFormat = output_format->formatTexture;
sys->picQuadConfig.resourceFormatYRGB = output_format->formatY;
sys->picQuadConfig.resourceFormatUV = output_format->formatUV;
break;
}
}
}
}
// look for any pixel format that we can handle
if ( !fmt->i_chroma )
{
......
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