[vlc-commits] direct3d11: only setup the staging texture format when we need it

Steve Lhomme git at videolan.org
Tue Jul 28 16:30:08 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jul 28 14:47:54 2020 +0200| [af70666c08d6ead2e22225f3aaa88ea27ba93712] | committer: Steve Lhomme

direct3d11: only setup the staging texture format when we need it

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af70666c08d6ead2e22225f3aaa88ea27ba93712
---

 modules/video_output/win32/direct3d11.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index ea4107b0f5..6b3670ac3d 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -89,7 +89,6 @@ struct vout_display_sys_t
 {
     vout_display_sys_win32_t sys;       /* only use if sys.event is not NULL */
     display_win32_area_t     area;
-    video_format_t           texture_fmt;
 
     /* Sensors */
     void *p_sensors;
@@ -298,7 +297,6 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         goto error;
 
     CommonInit(vd, &sys->area, cfg);
-    sys->texture_fmt = vd->source;
 
     sys->outside_opaque = var_InheritAddress( vd, "vout-cb-opaque" );
     sys->updateOutputCb      = var_InheritAddress( vd, "vout-cb-update-output" );
@@ -616,8 +614,8 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
             {
                 /* the decoder produced different sizes than the vout, we need to
                  * adjust the vertex */
-                sys->texture_fmt.i_width  = sys->picQuad.i_height = texDesc.Height;
-                sys->texture_fmt.i_height = sys->picQuad.i_width = texDesc.Width;
+                sys->picQuad.i_height = texDesc.Height;
+                sys->picQuad.i_width = texDesc.Width;
 
                 CommonPlacePicture(vd, &sys->area, &sys->sys);
                 UpdateSize(vd);
@@ -816,9 +814,6 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
         sys->picQuad.i_height = (sys->picQuad.i_height + 0x01) & ~0x01;
     }
 
-    sys->texture_fmt.i_width  = sys->picQuad.i_width;
-    sys->texture_fmt.i_height = sys->picQuad.i_height;
-
     CommonPlacePicture(vd, &sys->area, &sys->sys);
 
     err = QueryDisplayFormat(vd, &fmt);
@@ -1113,10 +1108,13 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
     {
         /* we need a staging texture */
         ID3D11Texture2D *textures[D3D11_MAX_SHADER_VIEW] = {0};
+        video_format_t texture_fmt = vd->source;
+        texture_fmt.i_width  = sys->picQuad.i_width;
+        texture_fmt.i_height = sys->picQuad.i_height;
         if (!is_d3d11_opaque(fmt->i_chroma))
-            sys->texture_fmt.i_chroma = sys->picQuad.textureFormat->fourcc;
+            texture_fmt.i_chroma = sys->picQuad.textureFormat->fourcc;
 
-        if (AllocateTextures(vd, sys->d3d_dev, sys->picQuad.textureFormat, &sys->texture_fmt, 1, textures, sys->stagingPlanes))
+        if (AllocateTextures(vd, sys->d3d_dev, sys->picQuad.textureFormat, &texture_fmt, 1, textures, sys->stagingPlanes))
         {
             msg_Err(vd, "Failed to allocate the staging texture");
             return VLC_EGENERIC;



More information about the vlc-commits mailing list