Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/d3d8/directx.c | 13 ++++++++++--- dlls/d3d9/directx.c | 13 ++++++++++--- dlls/dxgi/adapter.c | 5 ++++- dlls/dxgi/dxgi_private.h | 1 + dlls/wined3d/directx.c | 8 ++++++++ dlls/wined3d/wined3d.spec | 2 ++ dlls/wined3d/wined3d_private.h | 1 + include/wine/wined3d.h | 2 ++ 8 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index d1f8872d12e..e6acfff3654 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -93,15 +93,22 @@ static HRESULT WINAPI d3d8_RegisterSoftwareDevice(IDirect3D8 *iface, void *init_ static UINT WINAPI d3d8_GetAdapterCount(IDirect3D8 *iface) { struct d3d8 *d3d8 = impl_from_IDirect3D8(iface); - UINT count; + struct wined3d_adapter *wined3d_adapter; + UINT adapter_idx, adapter_count; + UINT output_count = 0;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - count = wined3d_get_adapter_count(d3d8->wined3d); + adapter_count = wined3d_get_adapter_count(d3d8->wined3d); + for (adapter_idx = 0; adapter_idx < adapter_count; ++adapter_idx) + { + wined3d_enum_adapters(d3d8->wined3d, adapter_idx, &wined3d_adapter); + output_count += wined3d_adapter_get_output_count(wined3d_adapter); + } wined3d_mutex_unlock();
- return count; + return output_count; }
static HRESULT WINAPI d3d8_GetAdapterIdentifier(IDirect3D8 *iface, UINT adapter, diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index b552c3b910c..a0b6d142113 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -108,15 +108,22 @@ static HRESULT WINAPI d3d9_RegisterSoftwareDevice(IDirect3D9Ex *iface, void *ini static UINT WINAPI d3d9_GetAdapterCount(IDirect3D9Ex *iface) { struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface); - UINT ret; + struct wined3d_adapter *wined3d_adapter; + UINT adapter_idx, adapter_count; + UINT output_count = 0;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - ret = wined3d_get_adapter_count(d3d9->wined3d); + adapter_count = wined3d_get_adapter_count(d3d9->wined3d); + for (adapter_idx = 0; adapter_idx < adapter_count; ++adapter_idx) + { + wined3d_enum_adapters(d3d9->wined3d, adapter_idx, &wined3d_adapter); + output_count += wined3d_adapter_get_output_count(wined3d_adapter); + } wined3d_mutex_unlock();
- return ret; + return output_count; }
static HRESULT WINAPI d3d9_GetAdapterIdentifier(IDirect3D9Ex *iface, UINT adapter, diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index 7cdf7bd0d69..590f9f13cc3 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -124,6 +124,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *ifac { struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface); struct dxgi_output *output_object; + UINT output_count; HRESULT hr;
TRACE("iface %p, output_idx %u, output %p.\n", iface, output_idx, output); @@ -131,7 +132,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *ifac if (!output) return E_INVALIDARG;
- if (output_idx > 0) + output_count = wined3d_adapter_get_output_count(adapter->wined3d_adapter); + if (output_idx >= output_count) { *output = NULL; return DXGI_ERROR_NOT_FOUND; @@ -450,6 +452,7 @@ static void dxgi_adapter_init(struct dxgi_adapter *adapter, struct dxgi_factory { adapter->IWineDXGIAdapter_iface.lpVtbl = &dxgi_adapter_vtbl; adapter->refcount = 1; + wined3d_enum_adapters(factory->wined3d, ordinal, &adapter->wined3d_adapter); wined3d_private_store_init(&adapter->private_store); adapter->ordinal = ordinal; adapter->factory = factory; diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h index 5b934498349..56939e2aaa6 100644 --- a/dlls/dxgi/dxgi_private.h +++ b/dlls/dxgi/dxgi_private.h @@ -156,6 +156,7 @@ struct dxgi_adapter { IWineDXGIAdapter IWineDXGIAdapter_iface; LONG refcount; + struct wined3d_adapter *wined3d_adapter; struct wined3d_private_store private_store; UINT ordinal; struct dxgi_factory *factory; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index cd9c8350148..4133bedb335 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -885,6 +885,13 @@ UINT CDECL wined3d_get_adapter_count(const struct wined3d *wined3d) return wined3d->adapter_count; }
+UINT CDECL wined3d_adapter_get_output_count(const struct wined3d_adapter *adapter) +{ + TRACE("adapter %p, reporting %u outputs.\n", adapter, adapter->output_count); + + return adapter->output_count; +} + HRESULT CDECL wined3d_register_software_device(struct wined3d *wined3d, void *init_function) { FIXME("wined3d %p, init_function %p stub!\n", wined3d, init_function); @@ -2836,6 +2843,7 @@ BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, unsigned int ordinal, ERR("Failed to initialise output, hr %#x.\n", hr); return FALSE; } + adapter->output_count = 1;
if (!AllocateLocallyUniqueId(&adapter->luid)) { diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 3299e5a78e5..44b4d22e312 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -26,6 +26,8 @@ @ cdecl wined3d_set_adapter_display_mode(ptr long ptr) @ cdecl wined3d_unregister_windows(ptr)
+@ cdecl wined3d_adapter_get_output_count(ptr) + @ cdecl wined3d_blend_state_create(ptr ptr ptr ptr ptr) @ cdecl wined3d_blend_state_decref(ptr) @ cdecl wined3d_blend_state_get_parent(ptr) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 744e647008e..e2e03683b8c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2914,6 +2914,7 @@ struct wined3d_adapter struct wined3d_d3d_info d3d_info; struct wined3d_driver_info driver_info; struct wined3d_output output; + UINT output_count; UINT64 vram_bytes_used; GUID driver_uuid; GUID device_uuid; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 39286145ccf..fd587934757 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2287,6 +2287,8 @@ HRESULT __cdecl wined3d_set_adapter_display_mode(struct wined3d *wined3d, UINT adapter_idx, const struct wined3d_display_mode *mode); void __cdecl wined3d_unregister_windows(struct wined3d *wined3d);
+UINT __cdecl wined3d_adapter_get_output_count(const struct wined3d_adapter *adapter); + HRESULT __cdecl wined3d_buffer_create(struct wined3d_device *device, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer);