Commit 2f9037c7 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

wined3d: Introduce wined3d_adapter_get_output_count().

parent 81caeee8
......@@ -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,
......
......@@ -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,
......
......@@ -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;
......
......@@ -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;
......
......@@ -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))
{
......
......@@ -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)
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment