[vlc-commits] direct3d9: check that we can upload the source picture to the GPU

Steve Lhomme git at videolan.org
Wed Jun 26 12:06:25 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jun 26 11:19:18 2019 +0200| [0eb54af10a579872dd0d73e4d0e613e07565627b] | committer: Steve Lhomme

direct3d9: check that we can upload the source picture to the GPU

It may be too big (for example 8K on an old GPU with little memory).

We could actually reduce the size of the output and force a filter to scale
the picture accordingly.

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

 modules/video_output/win32/direct3d9.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index fb7cc6916c..1558b2f431 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1740,6 +1740,16 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return VLC_EGENERIC;
     }
 
+    if ( vd->source.i_visible_width  > sys->d3d_dev.caps.MaxTextureWidth ||
+         vd->source.i_visible_height > sys->d3d_dev.caps.MaxTextureHeight )
+    {
+        msg_Err(vd, "Textures too large %ux%u max possible: %lx%l",
+                vd->source.i_visible_width, vd->source.i_visible_height,
+                sys->d3d_dev.caps.MaxTextureWidth,
+                sys->d3d_dev.caps.MaxTextureHeight);
+        goto error;
+    }
+
     if (sys->setupDeviceCb != LocalSwapchainSetupDevice)
         CommonPlacePicture(VLC_OBJECT(vd), &sys->area, &sys->sys);
 



More information about the vlc-commits mailing list