[PATCH 2/5] wined3d: Pass a struct wined3d_output pointer to wined3d_check_device_format_conversion().

Zhiyi Zhang zzhang at codeweavers.com
Mon Mar 9 02:40:40 CDT 2020


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/d3d9/directx.c       | 10 ++++++++--
 dlls/wined3d/directx.c    | 11 ++++++-----
 dlls/wined3d/wined3d.spec |  2 +-
 include/wine/wined3d.h    |  2 +-
 4 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
index d006cf27435..700c3cb1456 100644
--- a/dlls/d3d9/directx.c
+++ b/dlls/d3d9/directx.c
@@ -361,14 +361,20 @@ static HRESULT WINAPI d3d9_CheckDeviceFormatConversion(IDirect3D9Ex *iface, UINT
         D3DDEVTYPE device_type, D3DFORMAT src_format, D3DFORMAT dst_format)
 {
     struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
+    unsigned int output_idx;
     HRESULT hr;
 
     TRACE("iface %p, adapter %u, device_type %#x, src_format %#x, dst_format %#x.\n",
             iface, adapter, device_type, src_format, dst_format);
 
+    output_idx = adapter;
+    if (output_idx >= d3d9->wined3d_output_count)
+        return D3DERR_INVALIDCALL;
+
     wined3d_mutex_lock();
-    hr = wined3d_check_device_format_conversion(d3d9->wined3d, adapter, device_type,
-            wined3dformat_from_d3dformat(src_format), wined3dformat_from_d3dformat(dst_format));
+    hr = wined3d_check_device_format_conversion(d3d9->wined3d_outputs[output_idx],
+            device_type, wined3dformat_from_d3dformat(src_format),
+            wined3dformat_from_d3dformat(dst_format));
     wined3d_mutex_unlock();
 
     return hr;
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index f5a94b93aa9..3f46bb6a283 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1772,11 +1772,12 @@ UINT CDECL wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT ad
     return row_pitch;
 }
 
-HRESULT CDECL wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx,
-        enum wined3d_device_type device_type, enum wined3d_format_id src_format, enum wined3d_format_id dst_format)
+HRESULT CDECL wined3d_check_device_format_conversion(const struct wined3d_output *output,
+        enum wined3d_device_type device_type, enum wined3d_format_id src_format,
+        enum wined3d_format_id dst_format)
 {
-    FIXME("wined3d %p, adapter_idx %u, device_type %s, src_format %s, dst_format %s stub!\n",
-            wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(src_format),
+    FIXME("output %p, device_type %s, src_format %s, dst_format %s stub!\n",
+            output, debug_d3ddevicetype(device_type), debug_d3dformat(src_format),
             debug_d3dformat(dst_format));
 
     return WINED3D_OK;
@@ -1838,7 +1839,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
         if (backbuffer_format == WINED3DFMT_UNKNOWN)
             backbuffer_format = display_format;
 
-        if (FAILED(wined3d_check_device_format_conversion(wined3d, adapter_idx,
+        if (FAILED(wined3d_check_device_format_conversion(&wined3d->adapters[adapter_idx]->outputs[0],
                 device_type, backbuffer_format, display_format)))
         {
             TRACE("Format conversion from %s to %s not supported.\n",
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index c426ffd0b6c..d043b91cc4e 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -4,7 +4,7 @@
 @ cdecl wined3d_calculate_format_pitch(ptr long long long)
 @ cdecl wined3d_check_depth_stencil_match(ptr long long long long long)
 @ cdecl wined3d_check_device_format(ptr long long long long long long long)
-@ cdecl wined3d_check_device_format_conversion(ptr long long long long)
+@ cdecl wined3d_check_device_format_conversion(ptr long long long)
 @ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr)
 @ cdecl wined3d_check_device_type(ptr long long long long long)
 @ cdecl wined3d_create(long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index d31f1aff490..6e4d0a2defb 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2250,7 +2250,7 @@ HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d *wined3d,
 HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT adaper_idx,
         enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage,
         unsigned int bind_flags, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id);
-HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx,
+HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d_output *output,
         enum wined3d_device_type device_type, enum wined3d_format_id source_format_id,
         enum wined3d_format_id target_format_id);
 HRESULT __cdecl wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx,
-- 
2.20.1




More information about the wine-devel mailing list