vlc/vlc-3.0 | branch: master | Steve Lhomme <rob...@ycbcr.xyz> | Mon Feb 12 
14:25:17 2018 +0100| [6bc59720b5acf095c213c069ac67c452ed58ba42] | committer: 
Hugo Beauzée-Luyssen

direct3d11: reorder the pool allocation code

(cherry picked from commit ab3f3d4f8df0c50a6768b9bbf8990a669e17faf9)
Signed-off-by: Hugo Beauzée-Luyssen <h...@beauzee.fr>

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

 modules/video_output/win32/direct3d11.c | 39 +++++++++++++++------------------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c 
b/modules/video_output/win32/direct3d11.c
index 20783c26ff..afdfccb944 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -591,6 +591,13 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned 
pool_size)
     surface_fmt.i_width  = sys->picQuad.i_width;
     surface_fmt.i_height = sys->picQuad.i_height;
 
+    if (SetupQuad( vd, &surface_fmt, &sys->picQuad, &sys->sys.rect_src_clipped,
+                   sys->picQuadConfig, sys->picQuadPixelShader,
+                   surface_fmt.projection_mode, vd->fmt.orientation ) != 
VLC_SUCCESS) {
+        msg_Err(vd, "Could not Create the main quad picture.");
+        return NULL;
+    }
+
     if (!vd->info.is_slow) {
         HRESULT           hr;
         ID3D10Multithread *pMultithread;
@@ -601,7 +608,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned 
pool_size)
         }
     }
 
-    if (sys->picQuadConfig->formatTexture != DXGI_FORMAT_UNKNOWN)
+    if (sys->picQuadConfig->formatTexture == DXGI_FORMAT_UNKNOWN)
+        sys->sys.pool = picture_pool_NewFromFormat( &surface_fmt, pool_size );
+    else
     {
         if (AllocateTextures(VLC_OBJECT(vd), &sys->d3d_dev, 
sys->picQuadConfig, &surface_fmt, pool_size, textures))
             goto error;
@@ -638,31 +647,19 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned 
pool_size)
             /* each picture_t holds a ref to the context and release it on 
Destroy */
             ID3D11DeviceContext_AddRef(picsys->context);
         }
-    }
 
 #ifdef HAVE_ID3D11VIDEODECODER
-    if (is_d3d11_opaque(surface_fmt.i_chroma) && !sys->legacy_shader)
+        if (is_d3d11_opaque(surface_fmt.i_chroma) && !sys->legacy_shader)
 #endif
-    {
-        for (picture_count = 0; picture_count < pool_size; picture_count++) {
-            if (AllocateShaderView(VLC_OBJECT(vd), sys->d3d_dev.d3ddevice, 
sys->picQuadConfig,
-                                   pictures[picture_count]->p_sys->texture, 
picture_count,
-                                   
pictures[picture_count]->p_sys->resourceView))
-                goto error;
+        {
+            for (picture_count = 0; picture_count < pool_size; 
picture_count++) {
+                if (AllocateShaderView(VLC_OBJECT(vd), sys->d3d_dev.d3ddevice, 
sys->picQuadConfig,
+                                       
pictures[picture_count]->p_sys->texture, picture_count,
+                                       
pictures[picture_count]->p_sys->resourceView))
+                    goto error;
+            }
         }
-    }
-
-    if (SetupQuad( vd, &surface_fmt, &sys->picQuad, &sys->sys.rect_src_clipped,
-                   sys->picQuadConfig, sys->picQuadPixelShader,
-                   surface_fmt.projection_mode, vd->fmt.orientation ) != 
VLC_SUCCESS) {
-        msg_Err(vd, "Could not Create the main quad picture.");
-        return NULL;
-    }
 
-    if (sys->picQuadConfig->formatTexture == DXGI_FORMAT_UNKNOWN)
-        sys->sys.pool = picture_pool_NewFromFormat( &surface_fmt, pool_size );
-    else
-    {
         picture_pool_configuration_t pool_cfg = {
             .picture       = pictures,
             .picture_count = pool_size,

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to