[vlc-devel] [PATCH 2/3] direct3d11: we don't need to keep vlcFormat

Steve Lhomme robux4 at gmail.com
Thu May 28 16:27:45 CEST 2015


---
 modules/video_output/msw/common.h     |  1 -
 modules/video_output/msw/direct3d11.c | 17 +++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/msw/common.h b/modules/video_output/msw/common.h
index 42e000b..fa03735 100644
--- a/modules/video_output/msw/common.h
+++ b/modules/video_output/msw/common.h
@@ -184,7 +184,6 @@ struct vout_display_sys_t
     ID3D11RenderTargetView   *d3drenderTargetView;
     ID3D11DepthStencilView   *d3ddepthStencilView;
     picture_sys_t            *picsys;
-    vlc_fourcc_t             vlcFormat;
     const char               *d3dPxShader;
 
     // SPU
diff --git a/modules/video_output/msw/direct3d11.c b/modules/video_output/msw/direct3d11.c
index 48e5f03..5ecb2ba 100644
--- a/modules/video_output/msw/direct3d11.c
+++ b/modules/video_output/msw/direct3d11.c
@@ -860,12 +860,15 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
 # endif
 #endif
 
+    vlc_fourcc_t i_src_chroma = fmt->i_chroma;
+    fmt->i_chroma = 0;
+
     // look for the request pixel format first
     UINT i_quadSupportFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_SHADER_LOAD;
     UINT i_formatSupport;
     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,
                                                            d3d_formats[i].formatTexture,
@@ -873,7 +876,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
                     ( i_formatSupport & i_quadSupportFlags ))
             {
                 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.resourceFormatYRGB = d3d_formats[i].formatY;
                 sys->picQuadConfig.resourceFormatUV   = d3d_formats[i].formatUV;
@@ -883,7 +886,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
     }
 
     // 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++)
         {
@@ -893,7 +896,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
                     ( i_formatSupport & i_quadSupportFlags ))
             {
                 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.resourceFormatYRGB = d3d_formats[i].formatY;
                 sys->picQuadConfig.resourceFormatUV   = d3d_formats[i].formatUV;
@@ -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");
        return VLC_EGENERIC;
@@ -927,7 +930,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
         sys->d3dregion_format = DXGI_FORMAT_UNKNOWN;
     }
 
-    switch (sys->vlcFormat)
+    switch (fmt->i_chroma)
     {
     case VLC_CODEC_NV12:
         if( fmt->i_height > 576 )
@@ -1000,8 +1003,6 @@ static int Direct3D11CreateResources(vout_display_t *vd, video_format_t *fmt)
     vout_display_sys_t *sys = vd->sys;
     HRESULT hr;
 
-    fmt->i_chroma = sys->vlcFormat;
-
     hr = UpdateBackBuffer(vd);
     if (FAILED(hr)) {
        msg_Err(vd, "Could not update the backbuffer. (hr=0x%lX)", hr);
-- 
2.4.0




More information about the vlc-devel mailing list