[vlc-commits] [Git][videolan/vlc][master] 2 commits: direct3d9: keep the texture size

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Feb 15 13:31:33 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b5fe5131 by Steve Lhomme at 2023-02-15T13:02:51+00:00
direct3d9: keep the texture size

- - - - -
2ece2ae8 by Steve Lhomme at 2023-02-15T13:02:51+00:00
direct3d9: fix crop texture size

The Direct3D9SetupVertices() call needs the size of the raw texture. It is not
the visible parameters when cropping.

fixes #27632

- - - - -


1 changed file:

- modules/video_output/win32/direct3d9.c


Changes:

=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -145,6 +145,9 @@ typedef struct vout_display_sys_t
     HINSTANCE               hxdll;      /* handle of the opened d3d9x dll */
     IDirect3DPixelShader9*  d3dx_shader;
 
+    UINT                    texture_width;
+    UINT                    texture_height;
+
     // scene objects
     IDirect3DTexture9       *sceneTexture;
     IDirect3DVertexBuffer9  *sceneVertexBuffer;
@@ -360,21 +363,19 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
     };
     RECT texture_visible_rect = {
         .left   = 0,
-        .right  = vd->source->i_visible_width,
+        .right  = sys->texture_width,
         .top    = 0,
-        .bottom = vd->source->i_visible_height,
+        .bottom = sys->texture_height,
     };
     // 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)
-    if (texture_visible_rect.right & 1)
+    if (source_visible_rect.right & 1)
     {
-        texture_visible_rect.right++;
         source_visible_rect.right++;
     }
-    if (texture_visible_rect.bottom & 1)
+    if (source_visible_rect.bottom & 1)
     {
-        texture_visible_rect.bottom++;
         source_visible_rect.bottom++;
     }
 
@@ -543,13 +544,13 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
     IDirect3DDevice9        *d3ddev = sys->d3d9_device->d3ddev.dev;
     HRESULT hr;
 
-    UINT width  = fmt->i_visible_width;
-    UINT height = fmt->i_visible_height;
+    sys->texture_width  = fmt->i_visible_width;
+    sys->texture_height = fmt->i_visible_height;
     // 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)
-    if (height & 1) height++;
-    if (width  & 1) width++;
+    if (sys->texture_height & 1) sys->texture_height++;
+    if (sys->texture_width  & 1) sys->texture_width++;
 
     /*
      * Create a texture for use when rendering a scene
@@ -557,8 +558,8 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
      * which would usually be a RGB format
      */
     hr = IDirect3DDevice9_CreateTexture(d3ddev,
-                                        width,
-                                        height,
+                                        sys->texture_width,
+                                        sys->texture_height,
                                         1,
                                         D3DUSAGE_RENDERTARGET,
                                         sys->BufferFormat,
@@ -571,7 +572,7 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
     }
 
 #ifndef NDEBUG
-    msg_Dbg(vd, "Direct3D created texture: %ix%i", width, 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/-/compare/1f3ccdd0e983c1c5656f93b5c090017ba5108ca4...2ece2ae8d3a619cb22fd71c695edb3834372fa05

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1f3ccdd0e983c1c5656f93b5c090017ba5108ca4...2ece2ae8d3a619cb22fd71c695edb3834372fa05
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