diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index d1f8872d12e..ab3a9e6810f 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; + unsigned int adapter_idx, adapter_count; + unsigned int 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_adapter = wined3d_get_adapter(d3d8->wined3d, adapter_idx); + 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..effaf3be25d 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; + unsigned int adapter_idx, adapter_count; + unsigned int 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_adapter = wined3d_get_adapter(d3d9->wined3d, adapter_idx); + 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..ccc37e0980b 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; + unsigned int 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; + adapter->wined3d_adapter = wined3d_get_adapter(factory->wined3d, ordinal); 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 f710e85687f..95d1caed4d5 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -883,6 +883,13 @@ UINT CDECL wined3d_get_adapter_count(const struct wined3d *wined3d) return wined3d->adapter_count; } +unsigned int 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); @@ -2834,6 +2841,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 0c30ffeac24..b0eb60327f1 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 f266d2a6901..2966a086036 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; + unsigned int 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 2841aa2f2e9..54af2e4785e 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); +unsigned int __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);