[vlc-commits] [Git][videolan/vlc][3.0.x] direct3d9: keep the texture size for GetPictureWidth/Height calls

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Feb 15 14:48:39 UTC 2023



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
4b8069d7 by Steve Lhomme at 2023-02-15T14:31:14+00:00
direct3d9: keep the texture size for GetPictureWidth/Height calls

fixes #27632

- - - - -


1 changed file:

- modules/video_output/win32/direct3d9.c


Changes:

=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -154,6 +154,9 @@ struct vout_display_sys_t
     IDirect3DPixelShader9*  d3dx_shader;
     d3d9_device_t           d3d_dev;
 
+    UINT                    texture_width;
+    UINT                    texture_height;
+
     // scene objects
     LPDIRECT3DTEXTURE9      d3dtex;
     LPDIRECT3DVERTEXBUFFER9 d3dvtc;
@@ -255,12 +258,14 @@ static HINSTANCE Direct3D9LoadShaderLibrary(void)
 
 static unsigned int GetPictureWidth(const vout_display_t *vd)
 {
-    return vd->source.i_visible_width;
+    vout_display_sys_t *sys = vd->sys;
+    return sys->texture_width;
 }
 
 static unsigned int GetPictureHeight(const vout_display_t *vd)
 {
-    return vd->source.i_visible_height;
+    vout_display_sys_t *sys = vd->sys;
+    return sys->texture_height;
 }
 
 /**
@@ -1262,10 +1267,10 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
     // On nVidia & AMD, StretchRect will fail if the visible size isn't even.
     // When copying the entire buffer, the margin end up being blended in the actual picture
     // on nVidia (regardless of even/odd dimensions)
-    UINT texture_width  = fmt->i_visible_width;
-    UINT texture_height = fmt->i_visible_height;
-    if (texture_width  & 1) texture_width++;
-    if (texture_height & 1) texture_height++;
+    sys->texture_width  = fmt->i_visible_width;
+    sys->texture_height = fmt->i_visible_height;
+    if (sys->texture_width  & 1) sys->texture_width++;
+    if (sys->texture_height & 1) sys->texture_height++;
 
     /*
      * Create a texture for use when rendering a scene
@@ -1274,8 +1279,8 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
      */
     LPDIRECT3DTEXTURE9 d3dtex;
     hr = IDirect3DDevice9_CreateTexture(d3ddev,
-                                        texture_width,
-                                        texture_height,
+                                        sys->texture_width,
+                                        sys->texture_height,
                                         1,
                                         D3DUSAGE_RENDERTARGET,
                                         p_d3d9_dev->pp.BackBufferFormat,
@@ -1288,7 +1293,7 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
     }
 
 #ifndef NDEBUG
-    msg_Dbg(vd, "Direct3D created texture: %ix%i", texture_width, texture_height);
+    msg_Dbg(vd, "Direct3D created texture: %ix%i", sys->texture_width, sys->texture_height);
 #endif
 
     /*



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4b8069d7a2ad688ba7686a804a06072d392b12a0

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4b8069d7a2ad688ba7686a804a06072d392b12a0
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list