diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index 2ebf24e9b48e8a15b6fb424b259b41627e413532..107cd6624ed998fa0f1fdaef63c99604537597cc 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -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; diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c index b61d5abdb50a1571bc241c8968b38edf657c876f..25c2faea54543465627a1245d3cb9c810e41b2bc 100644 --- a/dlls/dxgi/device.c +++ b/dlls/dxgi/device.c @@ -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; } diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h index 2fe43310b46843482ec029fed82a8d35b3c2aca8..63736a8e6c19682c7dc4c6049fd6ce30ee8ab870 100644 --- a/dlls/dxgi/dxgi_private.h +++ b/dlls/dxgi/dxgi_private.h @@ -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 diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c index bea116b9df2f251b342537a3e22f705f2c1d23cd..267b11b9d91adf3fafbba6a8fd11c37ca2ef6f71 100644 --- a/dlls/dxgi/factory.c +++ b/dlls/dxgi/factory.c @@ -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); diff --git a/dlls/dxgi/output.c b/dlls/dxgi/output.c index 737ba29b719f9f4e0d40350cac2d9ad79d9c0d71..c93ad9a598d6c81091340e2ccbe8e85b551451af 100644 --- a/dlls/dxgi/output.c +++ b/dlls/dxgi/output.c @@ -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) diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c index 9df1f56f15a45a52e19aca2fb1bc51bb368eee35..e5d06c3d4eb162309eb32b148c552e78976203f1 100644 --- a/dlls/dxgi/swapchain.c +++ b/dlls/dxgi/swapchain.c @@ -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); diff --git a/include/wine/winedxgi.idl b/include/wine/winedxgi.idl index c3564d50800be15ca435eea7c44a5b916d02f868..6c8f774fa15b46535a65c34e6f71eefb9e441f01 100644 --- a/include/wine/winedxgi.idl +++ b/include/wine/winedxgi.idl @@ -56,7 +56,7 @@ interface IWineDXGIDeviceParent : IUnknown local, uuid(17399d75-964e-4c03-99f8-9d4fd196dd62) ] -interface IWineDXGIAdapter : IDXGIAdapter1 +interface IWineDXGIAdapter : IDXGIAdapter3 { }