Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/dxgi/adapter.c | 4 +++- dlls/wined3d/directx.c | 12 ++++++++++++ dlls/wined3d/wined3d.spec | 2 ++ include/wine/wined3d.h | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index d2fc629c84..477f19f3f4 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -124,11 +124,13 @@ 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);
- if (output_idx > 0) + hr = wined3d_adapter_get_output_count(adapter->factory->wined3d, adapter->ordinal, &output_count); + if (FAILED(hr) || output_idx >= output_count) { *output = NULL; return DXGI_ERROR_NOT_FOUND; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index e6abd139d0..10bbfa4c54 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -899,6 +899,18 @@ UINT CDECL wined3d_get_output_count(const struct wined3d *wined3d) return wined3d->output_count; }
+HRESULT CDECL wined3d_adapter_get_output_count(const struct wined3d *wined3d, UINT adapter_idx, UINT *count) +{ + TRACE("wined3d %p, adapter_idx %u, count %p.\n", wined3d, adapter_idx, count); + + if (adapter_idx >= wined3d->adapter_count) + return WINED3DERR_INVALIDCALL; + + *count = wined3d->adapters[adapter_idx]->output_count; + TRACE("reporting %u outputs for adapter %u.\n", *count, adapter_idx); + return WINED3D_OK; +} + HRESULT CDECL wined3d_register_software_device(struct wined3d *wined3d, void *init_function) { FIXME("wined3d %p, init_function %p stub!\n", wined3d, init_function); diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 2cd66ec215..7e13e19891 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 long 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/include/wine/wined3d.h b/include/wine/wined3d.h index 925d4111d9..f676871b25 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2283,6 +2283,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);
+HRESULT __cdecl wined3d_adapter_get_output_count(const struct wined3d *wined3d, UINT adapter_idx, UINT *count); + 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);