[vlc-commits] direct3d11: pretend we have the right amount of textures for direct rendering

Steve Lhomme git at videolan.org
Tue Feb 20 10:03:35 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Feb 20 09:08:18 2018 +0100| [85403e56e2656f68faffeecbb4a7a116e62029b6] | committer: Hugo Beauzée-Luyssen

direct3d11: pretend we have the right amount of textures for direct rendering

But don't allocate too much if we're going to use the decoder pool.

(cherry picked from commit c5bc37e56f7ddc15a53be16a37e5d3041f80b00f)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/video_output/win32/direct3d11.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 6cfe80e571..4e5ac5eb4f 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -577,6 +577,8 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
     picture_t *picture;
     unsigned  picture_count = 0;
 
+    memset(textures, 0, sizeof(textures));
+
     if (sys->sys.pool)
         return sys->sys.pool;
 
@@ -587,10 +589,6 @@ 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 (is_d3d11_opaque(surface_fmt.i_chroma) && !CanUseVoutPool(&sys->d3d_dev, pool_size))
-        /* only provide enough for the filters, we can still do direct rendering */
-        pool_size = __MIN(pool_size, 6);
-
     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) {
@@ -612,7 +610,12 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
         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))
+        unsigned slices = pool_size;
+        if (!CanUseVoutPool(&sys->d3d_dev, pool_size))
+            /* only provide enough for the filters, we can still do direct rendering */
+            slices = __MIN(slices, 6);
+
+        if (AllocateTextures(VLC_OBJECT(vd), &sys->d3d_dev, sys->picQuadConfig, &surface_fmt, slices, textures))
             goto error;
 
         pictures = calloc(pool_size, sizeof(*pictures));
@@ -654,6 +657,8 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
         {
             sys->picQuad.resourceCount = DxgiResourceCount(sys->picQuadConfig);
             for (picture_count = 0; picture_count < pool_size; picture_count++) {
+                if (!pictures[picture_count]->p_sys->texture[0])
+                    continue;
                 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))



More information about the vlc-commits mailing list