[PATCH 1/5] wined3d: Introduce wined3d_enum_adapters().

Zhiyi Zhang zzhang at codeweavers.com
Mon Mar 2 02:23:37 CST 2020


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/wined3d/directx.c    | 12 ++++++++++++
 dlls/wined3d/wined3d.spec |  1 +
 include/wine/wined3d.h    |  3 +++
 3 files changed, 16 insertions(+)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 4d6f63c2ffb..cd9c8350148 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -865,6 +865,18 @@ enum wined3d_pci_device wined3d_gpu_from_feature_level(enum wined3d_pci_vendor *
     return device_id;
 }
 
+HRESULT CDECL wined3d_enum_adapters(const struct wined3d *wined3d, UINT adapter_idx,
+        struct wined3d_adapter **adapter)
+{
+    TRACE("wined3d %p, adapter_idx %u, adapter %p.\n", wined3d, adapter_idx, adapter);
+
+    if (adapter_idx >= wined3d->adapter_count)
+        return WINED3DERR_INVALIDCALL;
+
+    *adapter = wined3d->adapters[adapter_idx];
+    return WINED3D_OK;
+}
+
 UINT CDECL wined3d_get_adapter_count(const struct wined3d *wined3d)
 {
     TRACE("wined3d %p, reporting %u adapters.\n",
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 8538b3dcd6e..3299e5a78e5 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -9,6 +9,7 @@
 @ cdecl wined3d_check_device_type(ptr long long long long long)
 @ cdecl wined3d_create(long)
 @ cdecl wined3d_decref(ptr)
+@ cdecl wined3d_enum_adapters(ptr long ptr)
 @ cdecl wined3d_enum_adapter_modes(ptr long long long long ptr)
 @ cdecl wined3d_find_closest_matching_adapter_mode(ptr long ptr)
 @ cdecl wined3d_get_adapter_count(ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 908a1c92668..39286145ccf 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2178,6 +2178,7 @@ struct wined3d_parent_ops
 };
 
 struct wined3d;
+struct wined3d_adapter;
 struct wined3d_blend_state;
 struct wined3d_buffer;
 struct wined3d_device;
@@ -2257,6 +2258,8 @@ HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d, UINT ad
         enum wined3d_format_id backbuffer_format_id, BOOL windowed);
 struct wined3d * __cdecl wined3d_create(DWORD flags);
 ULONG __cdecl wined3d_decref(struct wined3d *wined3d);
+HRESULT __cdecl wined3d_enum_adapters(const struct wined3d *wined3d, UINT adapter_idx,
+        struct wined3d_adapter **adapter);
 HRESULT __cdecl wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx,
         enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering,
         UINT mode_idx, struct wined3d_display_mode *mode);
-- 
2.20.1




More information about the wine-devel mailing list