[vlc-commits] direct3d9: store the device capabilities in the device handle

Steve Lhomme git at videolan.org
Thu Feb 13 09:31:40 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb 12 11:23:50 2020 +0100| [4631c798d2e4b7c5bd82a3af01d13a041f88c6b7] | committer: Steve Lhomme

direct3d9: store the device capabilities in the device handle

Don't store it in the device that will be created.

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

 modules/video_chroma/d3d9_fmt.c        |  8 ++++----
 modules/video_chroma/d3d9_fmt.h        |  2 +-
 modules/video_output/win32/direct3d9.c | 24 ++++++++++++------------
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/modules/video_chroma/d3d9_fmt.c b/modules/video_chroma/d3d9_fmt.c
index 66c753e308..c7fd35318e 100644
--- a/modules/video_chroma/d3d9_fmt.c
+++ b/modules/video_chroma/d3d9_fmt.c
@@ -117,16 +117,16 @@ d3d9_handle_t *hd3d = &sys->dec_device.hd3d;
     /*
     ** Get device capabilities
     */
-    ZeroMemory(&out->caps, sizeof(out->caps));
-    hr = IDirect3D9_GetDeviceCaps(hd3d->obj, AdapterToUse, DeviceType, &out->caps);
+    ZeroMemory(&hd3d->caps, sizeof(hd3d->caps));
+    hr = IDirect3D9_GetDeviceCaps(hd3d->obj, AdapterToUse, DeviceType, &hd3d->caps);
     if (FAILED(hr)) {
        msg_Err(o, "Could not read adapter capabilities. (hr=0x%lX)", hr);
        goto error;
     }
-    msg_Dbg(o, "D3D9 device caps 0x%lX / 0x%lX", out->caps.DevCaps, out->caps.DevCaps2);
+    msg_Dbg(o, "D3D9 device caps 0x%lX / 0x%lX", hd3d->caps.DevCaps, hd3d->caps.DevCaps2);
 
     /* TODO: need to test device capabilities and select the right render function */
-    if (!(out->caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES)) {
+    if (!(hd3d->caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES)) {
         msg_Err(o, "Device does not support stretching from textures.");
         goto error;
     }
diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h
index cb87d0cde4..fc2602656d 100644
--- a/modules/video_chroma/d3d9_fmt.h
+++ b/modules/video_chroma/d3d9_fmt.h
@@ -51,6 +51,7 @@ typedef struct
         IDirect3D9Ex        *objex;
     };
     bool                    use_ex;
+    D3DCAPS9                caps;
 } d3d9_handle_t;
 
 typedef struct
@@ -66,7 +67,6 @@ typedef struct
     /* creation parameters */
     D3DFORMAT               BufferFormat;
     UINT                    adapterId;
-    D3DCAPS9                caps;
 } d3d9_device_t;
 
 typedef struct
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 41295fea78..3533839747 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -598,14 +598,14 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
     IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
 
     // Set linear filtering quality
-    if (sys->d3d9_device->d3ddev.caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR) {
+    if (sys->d3d9_device->hd3d.caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR) {
         //msg_Dbg(vd, "Using D3DTEXF_LINEAR for minification");
         IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
     } else {
         //msg_Dbg(vd, "Using D3DTEXF_POINT for minification");
         IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
     }
-    if (sys->d3d9_device->d3ddev.caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFLINEAR) {
+    if (sys->d3d9_device->hd3d.caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFLINEAR) {
         //msg_Dbg(vd, "Using D3DTEXF_LINEAR for magnification");
         IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
     } else {
@@ -636,7 +636,7 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
     IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
     IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
 
-    if (sys->d3d9_device->d3ddev.caps.AlphaCmpCaps & D3DPCMPCAPS_GREATER) {
+    if (sys->d3d9_device->hd3d.caps.AlphaCmpCaps & D3DPCMPCAPS_GREATER) {
         IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHATESTENABLE,TRUE);
         IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHAREF, 0x00);
         IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHAFUNC,D3DCMP_GREATER);
@@ -1583,13 +1583,13 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     }
 
 
-    if ( vd->source.i_visible_width  > sys->d3d9_device->d3ddev.caps.MaxTextureWidth ||
-         vd->source.i_visible_height > sys->d3d9_device->d3ddev.caps.MaxTextureHeight )
+    if ( vd->source.i_visible_width  > sys->d3d9_device->hd3d.caps.MaxTextureWidth ||
+         vd->source.i_visible_height > sys->d3d9_device->hd3d.caps.MaxTextureHeight )
     {
         msg_Err(vd, "Textures too large %ux%u max possible: %lx%lx",
                 vd->source.i_visible_width, vd->source.i_visible_height,
-                sys->d3d9_device->d3ddev.caps.MaxTextureWidth,
-                sys->d3d9_device->d3ddev.caps.MaxTextureHeight);
+                sys->d3d9_device->hd3d.caps.MaxTextureWidth,
+                sys->d3d9_device->hd3d.caps.MaxTextureHeight);
         goto error;
     }
 
@@ -1614,11 +1614,11 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     /* Setup vout_display now that everything is fine */
     if (var_InheritBool(vd, "direct3d9-hw-blending") &&
         sys->d3dregion_format != D3DFMT_UNKNOWN &&
-        (sys->d3d9_device->d3ddev.caps.SrcBlendCaps  & D3DPBLENDCAPS_SRCALPHA) &&
-        (sys->d3d9_device->d3ddev.caps.DestBlendCaps & D3DPBLENDCAPS_INVSRCALPHA) &&
-        (sys->d3d9_device->d3ddev.caps.TextureCaps   & D3DPTEXTURECAPS_ALPHA) &&
-        (sys->d3d9_device->d3ddev.caps.TextureOpCaps & D3DTEXOPCAPS_SELECTARG1) &&
-        (sys->d3d9_device->d3ddev.caps.TextureOpCaps & D3DTEXOPCAPS_MODULATE))
+        (sys->d3d9_device->hd3d.caps.SrcBlendCaps  & D3DPBLENDCAPS_SRCALPHA) &&
+        (sys->d3d9_device->hd3d.caps.DestBlendCaps & D3DPBLENDCAPS_INVSRCALPHA) &&
+        (sys->d3d9_device->hd3d.caps.TextureCaps   & D3DPTEXTURECAPS_ALPHA) &&
+        (sys->d3d9_device->hd3d.caps.TextureOpCaps & D3DTEXOPCAPS_SELECTARG1) &&
+        (sys->d3d9_device->hd3d.caps.TextureOpCaps & D3DTEXOPCAPS_MODULATE))
         vd->info.subpicture_chromas = d3d_subpicture_chromas;
     else
         vd->info.subpicture_chromas = NULL;



More information about the vlc-commits mailing list