dxgi: Implement IDXGIAdapter3.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-01-30 15:54:56 +01:00 committed by Alexandre Julliard
parent 7e72c2d4ac
commit 7f593aa725
7 changed files with 107 additions and 41 deletions

View File

@ -24,16 +24,18 @@
WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
static inline struct dxgi_adapter *impl_from_IDXGIAdapter1(IDXGIAdapter1 *iface)
static inline struct dxgi_adapter *impl_from_IWineDXGIAdapter(IWineDXGIAdapter *iface)
{
return CONTAINING_RECORD(iface, struct dxgi_adapter, IDXGIAdapter1_iface);
return CONTAINING_RECORD(iface, struct dxgi_adapter, IWineDXGIAdapter_iface);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IDXGIAdapter1 *iface, REFIID iid, void **out)
static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IWineDXGIAdapter *iface, REFIID iid, void **out)
{
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IWineDXGIAdapter)
|| IsEqualGUID(iid, &IID_IDXGIAdapter3)
|| IsEqualGUID(iid, &IID_IDXGIAdapter2)
|| IsEqualGUID(iid, &IID_IDXGIAdapter1)
|| IsEqualGUID(iid, &IID_IDXGIAdapter)
|| IsEqualGUID(iid, &IID_IDXGIObject)
@ -50,9 +52,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IDXGIAdapter1 *ifac
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE dxgi_adapter_AddRef(IDXGIAdapter1 *iface)
static ULONG STDMETHODCALLTYPE dxgi_adapter_AddRef(IWineDXGIAdapter *iface)
{
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
ULONG refcount = InterlockedIncrement(&adapter->refcount);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
@ -60,9 +62,9 @@ static ULONG STDMETHODCALLTYPE dxgi_adapter_AddRef(IDXGIAdapter1 *iface)
return refcount;
}
static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IDXGIAdapter1 *iface)
static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IWineDXGIAdapter *iface)
{
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
ULONG refcount = InterlockedDecrement(&adapter->refcount);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
@ -77,49 +79,49 @@ static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IDXGIAdapter1 *iface)
return refcount;
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateData(IDXGIAdapter1 *iface,
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateData(IWineDXGIAdapter *iface,
REFGUID guid, UINT data_size, const void *data)
{
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return dxgi_set_private_data(&adapter->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateDataInterface(IDXGIAdapter1 *iface,
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateDataInterface(IWineDXGIAdapter *iface,
REFGUID guid, const IUnknown *object)
{
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
return dxgi_set_private_data_interface(&adapter->private_store, guid, object);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetPrivateData(IDXGIAdapter1 *iface,
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetPrivateData(IWineDXGIAdapter *iface,
REFGUID guid, UINT *data_size, void *data)
{
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return dxgi_get_private_data(&adapter->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetParent(IDXGIAdapter1 *iface, REFIID iid, void **parent)
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetParent(IWineDXGIAdapter *iface, REFIID iid, void **parent)
{
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
TRACE("iface %p, iid %s, parent %p.\n", iface, debugstr_guid(iid), parent);
return IDXGIFactory4_QueryInterface(&adapter->factory->IDXGIFactory4_iface, iid, parent);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IDXGIAdapter1 *iface,
static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *iface,
UINT output_idx, IDXGIOutput **output)
{
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
struct dxgi_output *output_object;
HRESULT hr;
@ -144,9 +146,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IDXGIAdapter1 *iface,
return S_OK;
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IDXGIAdapter1 *iface, DXGI_ADAPTER_DESC1 *desc)
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC1 *desc)
{
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
struct wined3d_adapter_identifier adapter_id;
char description[128];
HRESULT hr;
@ -188,7 +190,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IDXGIAdapter1 *iface, DXG
return hr;
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IDXGIAdapter1 *iface, DXGI_ADAPTER_DESC *desc)
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc)
{
DXGI_ADAPTER_DESC1 desc1;
HRESULT hr;
@ -205,11 +207,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IDXGIAdapter1 *iface, DXGI
return hr;
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IDXGIAdapter1 *iface,
static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAdapter *iface,
REFGUID guid, LARGE_INTEGER *umd_version)
{
static const D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0;
struct dxgi_adapter *adapter = impl_from_IDXGIAdapter1(iface);
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
struct wined3d_adapter_identifier adapter_id;
HRESULT hr;
@ -244,7 +246,60 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IDXGIAdapter
return S_OK;
}
static const struct IDXGIAdapter1Vtbl dxgi_adapter_vtbl =
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc2(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC2 *desc)
{
FIXME("iface %p, desc %p stub!\n", iface, desc);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_RegisterHardwareContentProtectionTeardownStatusEvent(
IWineDXGIAdapter *iface, HANDLE event, DWORD *cookie)
{
FIXME("iface %p, event %p, cookie %p stub!\n", iface, event, cookie);
return E_NOTIMPL;
}
static void STDMETHODCALLTYPE dxgi_adapter_UnregisterHardwareContentProtectionTeardownStatus(
IWineDXGIAdapter *iface, DWORD cookie)
{
FIXME("iface %p, cookie %#x stub!\n", iface, cookie);
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryVideoMemoryInfo(IWineDXGIAdapter *iface,
UINT node_index, DXGI_MEMORY_SEGMENT_GROUP segment_group, DXGI_QUERY_VIDEO_MEMORY_INFO *memory_info)
{
FIXME("iface %p, node_index %u, segment_group %#x, memory_info %p stub!\n",
iface, node_index, segment_group, memory_info);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetVideoMemoryReservation(IWineDXGIAdapter *iface,
UINT node_index, DXGI_MEMORY_SEGMENT_GROUP segment_group, UINT64 reservation)
{
FIXME("iface %p, node_index %u, segment_group %#x, reservation %s stub!\n",
iface, node_index, segment_group, wine_dbgstr_longlong(reservation));
return S_OK;
}
static HRESULT STDMETHODCALLTYPE dxgi_adapter_RegisterVideoMemoryBudgetChangeNotificationEvent(
IWineDXGIAdapter *iface, HANDLE event, DWORD *cookie)
{
FIXME("iface %p, event %p, cookie %p stub!\n", iface, event, cookie);
return E_NOTIMPL;
}
static void STDMETHODCALLTYPE dxgi_adapter_UnregisterVideoMemoryBudgetChangeNotification(
IWineDXGIAdapter *iface, DWORD cookie)
{
FIXME("iface %p, cookie %#x stub!\n", iface, cookie);
}
static const struct IWineDXGIAdapterVtbl dxgi_adapter_vtbl =
{
dxgi_adapter_QueryInterface,
dxgi_adapter_AddRef,
@ -253,13 +308,24 @@ static const struct IDXGIAdapter1Vtbl dxgi_adapter_vtbl =
dxgi_adapter_SetPrivateDataInterface,
dxgi_adapter_GetPrivateData,
dxgi_adapter_GetParent,
/* IDXGIAdapter methods */
dxgi_adapter_EnumOutputs,
dxgi_adapter_GetDesc,
dxgi_adapter_CheckInterfaceSupport,
/* IDXGIAdapter1 methods */
dxgi_adapter_GetDesc1,
/* IDXGIAdapter2 methods */
dxgi_adapter_GetDesc2,
/* IDXGIAdapter3 methods */
dxgi_adapter_RegisterHardwareContentProtectionTeardownStatusEvent,
dxgi_adapter_UnregisterHardwareContentProtectionTeardownStatus,
dxgi_adapter_QueryVideoMemoryInfo,
dxgi_adapter_SetVideoMemoryReservation,
dxgi_adapter_RegisterVideoMemoryBudgetChangeNotificationEvent,
dxgi_adapter_UnregisterVideoMemoryBudgetChangeNotification,
};
struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter1(IDXGIAdapter1 *iface)
struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter(IDXGIAdapter *iface)
{
IWineDXGIAdapter *wine_adapter;
struct dxgi_adapter *adapter;
@ -267,20 +333,20 @@ struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter1(IDXGIAdapter1 *iface)
if (!iface)
return NULL;
if (FAILED(hr = IDXGIAdapter1_QueryInterface(iface, &IID_IWineDXGIAdapter, (void **)&wine_adapter)))
if (FAILED(hr = IDXGIAdapter_QueryInterface(iface, &IID_IWineDXGIAdapter, (void **)&wine_adapter)))
{
ERR("Failed to get IWineDXGIAdapter interface, hr %#x.\n", hr);
return NULL;
}
assert(wine_adapter->lpVtbl == (void *)&dxgi_adapter_vtbl);
adapter = CONTAINING_RECORD(wine_adapter, struct dxgi_adapter, IDXGIAdapter1_iface);
assert(wine_adapter->lpVtbl == &dxgi_adapter_vtbl);
adapter = CONTAINING_RECORD(wine_adapter, struct dxgi_adapter, IWineDXGIAdapter_iface);
IWineDXGIAdapter_Release(wine_adapter);
return adapter;
}
static void dxgi_adapter_init(struct dxgi_adapter *adapter, struct dxgi_factory *factory, UINT ordinal)
{
adapter->IDXGIAdapter1_iface.lpVtbl = &dxgi_adapter_vtbl;
adapter->IWineDXGIAdapter_iface.lpVtbl = &dxgi_adapter_vtbl;
adapter->refcount = 1;
wined3d_private_store_init(&adapter->private_store);
adapter->ordinal = ordinal;

View File

@ -85,7 +85,7 @@ static ULONG STDMETHODCALLTYPE dxgi_device_Release(IWineDXGIDevice *iface)
wined3d_device_uninit_3d(device->wined3d_device);
wined3d_device_decref(device->wined3d_device);
wined3d_mutex_unlock();
IDXGIAdapter1_Release(device->adapter);
IWineDXGIAdapter_Release(device->adapter);
wined3d_private_store_cleanup(&device->private_store);
HeapFree(GetProcessHeap(), 0, device);
}
@ -379,7 +379,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
return E_FAIL;
}
if (!(dxgi_adapter = unsafe_impl_from_IDXGIAdapter1((IDXGIAdapter1 *)adapter)))
if (!(dxgi_adapter = unsafe_impl_from_IDXGIAdapter(adapter)))
{
WARN("This is not the adapter we're looking for.\n");
return E_FAIL;
@ -452,8 +452,8 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l
}
wined3d_mutex_unlock();
device->adapter = &dxgi_adapter->IDXGIAdapter1_iface;
IDXGIAdapter1_AddRef(device->adapter);
device->adapter = &dxgi_adapter->IWineDXGIAdapter_iface;
IWineDXGIAdapter_AddRef(device->adapter);
return S_OK;
}

View File

@ -126,7 +126,7 @@ struct dxgi_device
LONG refcount;
struct wined3d_private_store private_store;
struct wined3d_device *wined3d_device;
IDXGIAdapter1 *adapter;
IWineDXGIAdapter *adapter;
};
HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *layer,
@ -147,7 +147,7 @@ HRESULT dxgi_output_create(struct dxgi_adapter *adapter, struct dxgi_output **ou
/* IDXGIAdapter */
struct dxgi_adapter
{
IDXGIAdapter1 IDXGIAdapter1_iface;
IWineDXGIAdapter IWineDXGIAdapter_iface;
LONG refcount;
struct wined3d_private_store private_store;
UINT ordinal;
@ -156,7 +156,7 @@ struct dxgi_adapter
HRESULT dxgi_adapter_create(struct dxgi_factory *factory, UINT ordinal,
struct dxgi_adapter **adapter) DECLSPEC_HIDDEN;
struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter1(IDXGIAdapter1 *iface) DECLSPEC_HIDDEN;
struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter(IDXGIAdapter *iface) DECLSPEC_HIDDEN;
/* IDXGISwapChain */
struct dxgi_swapchain

View File

@ -155,7 +155,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters1(IDXGIFactory4 *iface
return hr;
}
*adapter = &adapter_object->IDXGIAdapter1_iface;
*adapter = (IDXGIAdapter1 *)&adapter_object->IWineDXGIAdapter_iface;
TRACE("Returning adapter %p.\n", *adapter);

View File

@ -80,7 +80,7 @@ static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput *iface)
if (!refcount)
{
wined3d_private_store_cleanup(&output->private_store);
IDXGIAdapter1_Release(&output->adapter->IDXGIAdapter1_iface);
IWineDXGIAdapter_Release(&output->adapter->IWineDXGIAdapter_iface);
HeapFree(GetProcessHeap(), 0, output);
}
@ -126,7 +126,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput *iface,
TRACE("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent);
return IDXGIAdapter1_QueryInterface(&output->adapter->IDXGIAdapter1_iface, riid, parent);
return IWineDXGIAdapter_QueryInterface(&output->adapter->IWineDXGIAdapter_iface, riid, parent);
}
/* IDXGIOutput methods */
@ -365,7 +365,7 @@ static void dxgi_output_init(struct dxgi_output *output, struct dxgi_adapter *ad
output->refcount = 1;
wined3d_private_store_init(&output->private_store);
output->adapter = adapter;
IDXGIAdapter1_AddRef(&output->adapter->IDXGIAdapter1_iface);
IWineDXGIAdapter_AddRef(&output->adapter->IWineDXGIAdapter_iface);
}
HRESULT dxgi_output_create(struct dxgi_adapter *adapter, struct dxgi_output **output)

View File

@ -665,7 +665,7 @@ HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device
*/
if (!implicit)
{
if (FAILED(hr = IDXGIAdapter1_GetParent(device->adapter, &IID_IDXGIFactory,
if (FAILED(hr = IWineDXGIAdapter_GetParent(device->adapter, &IID_IDXGIFactory,
(void **)&swapchain->factory)))
{
WARN("Failed to get adapter parent, hr %#x.\n", hr);

View File

@ -56,7 +56,7 @@ interface IWineDXGIDeviceParent : IUnknown
local,
uuid(17399d75-964e-4c03-99f8-9d4fd196dd62)
]
interface IWineDXGIAdapter : IDXGIAdapter1
interface IWineDXGIAdapter : IDXGIAdapter3
{
}