Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/dxgi/factory.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c index 3f8816b3c23b..aa9cdb88fb6c 100644 --- a/dlls/dxgi/factory.c +++ b/dlls/dxgi/factory.c @@ -254,8 +254,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IDXGIFactor IWineDXGIDevice *dxgi_device; HRESULT hr;
- FIXME("iface %p, device %p, window %p, swapchain_desc %p, fullscreen_desc %p, " - "output %p, swapchain %p partial stub!\n", + TRACE("iface %p, device %p, window %p, swapchain_desc %p, fullscreen_desc %p, " + "output %p, swapchain %p.\n", iface, device, window, swapchain_desc, fullscreen_desc, output, swapchain);
if (!device || !swapchain_desc || !swapchain) @@ -309,6 +309,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IDXGIFactor FIXME("Ignoring swap effect %#x.\n", swapchain_desc->SwapEffect); if (swapchain_desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE) FIXME("Ignoring alpha mode %#x.\n", swapchain_desc->AlphaMode); + if (fullscreen_desc && fullscreen_desc->ScanlineOrdering) + FIXME("Unhandled scanline ordering %#x.\n", fullscreen_desc->ScanlineOrdering); + if (fullscreen_desc && fullscreen_desc->Scaling) + FIXME("Unhandled mode scaling %#x.\n", fullscreen_desc->Scaling);
wined3d_desc.backbuffer_width = swapchain_desc->Width; wined3d_desc.backbuffer_height = swapchain_desc->Height;
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d10_1/tests/d3d10_1.c | 2 +- dlls/d3d11/tests/d3d11.c | 2 +- dlls/dxgi/factory.c | 6 +----- dlls/dxgi/tests/device.c | 14 +++++++++----- 4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/d3d10_1/tests/d3d10_1.c b/dlls/d3d10_1/tests/d3d10_1.c index 2b18110fa6e9..7c2b3ba25111 100644 --- a/dlls/d3d10_1/tests/d3d10_1.c +++ b/dlls/d3d10_1/tests/d3d10_1.c @@ -252,7 +252,7 @@ static void test_create_device(void) swapchain_desc.OutputWindow = NULL; hr = D3D10CreateDeviceAndSwapChain1(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, supported_feature_level, D3D10_1_SDK_VERSION, &swapchain_desc, &swapchain, &device); - todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "D3D10CreateDeviceAndSwapChain1 returned %#x.\n", hr); + ok(hr == DXGI_ERROR_INVALID_CALL, "D3D10CreateDeviceAndSwapChain1 returned %#x.\n", hr); ok(!swapchain, "Got unexpected swapchain pointer %p.\n", swapchain); ok(!device, "Got unexpected device pointer %p.\n", device);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index ca71718c4e9b..2625e08f834b 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -1616,7 +1616,7 @@ static void test_create_device(void) swapchain_desc.OutputWindow = NULL; hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, 0, D3D11_SDK_VERSION, &swapchain_desc, &swapchain, &device, &feature_level, &immediate_context); - todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "D3D11CreateDeviceAndSwapChain returned %#x.\n", hr); + ok(hr == DXGI_ERROR_INVALID_CALL, "D3D11CreateDeviceAndSwapChain returned %#x.\n", hr); ok(!swapchain, "Got unexpected swapchain pointer %p.\n", swapchain); ok(!device, "Got unexpected device pointer %p.\n", device); ok(!feature_level, "Got unexpected feature level %#x.\n", feature_level); diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c index aa9cdb88fb6c..bea116b9df2f 100644 --- a/dlls/dxgi/factory.c +++ b/dlls/dxgi/factory.c @@ -258,7 +258,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IDXGIFactor "output %p, swapchain %p.\n", iface, device, window, swapchain_desc, fullscreen_desc, output, swapchain);
- if (!device || !swapchain_desc || !swapchain) + if (!device || !window || !swapchain_desc || !swapchain) { WARN("Invalid pointer.\n"); return DXGI_ERROR_INVALID_CALL; @@ -292,10 +292,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IDXGIFactor WARN("BufferCount is %u.\n", swapchain_desc->BufferCount); return DXGI_ERROR_INVALID_CALL; } - if (!window) - { - FIXME("No output window, should use factory output window.\n"); - }
if (FAILED(hr = IUnknown_QueryInterface(device, &IID_IWineDXGIDevice, (void **)&dxgi_device))) { diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c index 4ad5b9f6745c..c4bf826c6aeb 100644 --- a/dlls/dxgi/tests/device.c +++ b/dlls/dxgi/tests/device.c @@ -1077,7 +1077,6 @@ static void test_create_swapchain(void) return; }
- creation_desc.OutputWindow = 0; creation_desc.BufferDesc.Width = 800; creation_desc.BufferDesc.Height = 600; creation_desc.BufferDesc.RefreshRate.Numerator = 60; @@ -1089,14 +1088,11 @@ static void test_create_swapchain(void) creation_desc.SampleDesc.Quality = 0; creation_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; creation_desc.BufferCount = 1; - creation_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, 0, 0, 0, 0, 0, 0, 0, 0); + creation_desc.OutputWindow = NULL; creation_desc.Windowed = TRUE; creation_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; creation_desc.Flags = 0;
- memset(&initial_state, 0, sizeof(initial_state)); - capture_fullscreen_state(&initial_state.fullscreen_state, creation_desc.OutputWindow); - hr = IDXGIDevice_QueryInterface(device, &IID_IUnknown, (void **)&obj); ok(SUCCEEDED(hr), "IDXGIDevice does not implement IUnknown.\n");
@@ -1112,6 +1108,14 @@ static void test_create_swapchain(void) refcount = get_refcount((IUnknown *)device); ok(refcount == 2, "Got unexpected refcount %u.\n", refcount);
+ creation_desc.OutputWindow = NULL; + hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + + creation_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, 0, 0, 0, 0, 0, 0, 0, 0); + memset(&initial_state, 0, sizeof(initial_state)); + capture_fullscreen_state(&initial_state.fullscreen_state, creation_desc.OutputWindow); + hr = IDXGIFactory_CreateSwapChain(factory, NULL, &creation_desc, &swapchain); ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); hr = IDXGIFactory_CreateSwapChain(factory, obj, NULL, &swapchain);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/dxgi/adapter.c | 122 +++++++++++++++++++++++++++++++++++----------- dlls/dxgi/device.c | 8 +-- dlls/dxgi/dxgi_private.h | 6 +-- dlls/dxgi/factory.c | 2 +- dlls/dxgi/output.c | 6 +-- dlls/dxgi/swapchain.c | 2 +- include/wine/winedxgi.idl | 2 +- 7 files changed, 107 insertions(+), 41 deletions(-)
diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index 2ebf24e9b48e..107cd6624ed9 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 b61d5abdb50a..25c2faea5454 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 2fe43310b468..63736a8e6c19 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 bea116b9df2f..267b11b9d91a 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 737ba29b719f..c93ad9a598d6 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 9df1f56f15a4..e5d06c3d4eb1 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 c3564d50800b..6c8f774fa15b 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 { }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/dxgi/adapter.c | 2 +- dlls/dxgi/dxgi_private.h | 2 +- dlls/dxgi/output.c | 145 ++++++++++++++++++++++++++++++++++++----------- 3 files changed, 113 insertions(+), 36 deletions(-)
diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index 107cd6624ed9..64a18e60c544 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -139,7 +139,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *ifac return hr; }
- *output = &output_object->IDXGIOutput_iface; + *output = (IDXGIOutput *)&output_object->IDXGIOutput4_iface;
TRACE("Returning output %p.\n", *output);
diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h index 63736a8e6c19..19c880b2a36b 100644 --- a/dlls/dxgi/dxgi_private.h +++ b/dlls/dxgi/dxgi_private.h @@ -136,7 +136,7 @@ HRESULT dxgi_device_init(struct dxgi_device *device, struct dxgi_device_layer *l /* IDXGIOutput */ struct dxgi_output { - IDXGIOutput IDXGIOutput_iface; + IDXGIOutput4 IDXGIOutput4_iface; LONG refcount; struct wined3d_private_store private_store; struct dxgi_adapter *adapter; diff --git a/dlls/dxgi/output.c b/dlls/dxgi/output.c index c93ad9a598d6..9659c85eda6b 100644 --- a/dlls/dxgi/output.c +++ b/dlls/dxgi/output.c @@ -34,14 +34,14 @@ static void dxgi_mode_from_wined3d(DXGI_MODE_DESC *mode, const struct wined3d_di mode->Scaling = DXGI_MODE_SCALING_UNSPECIFIED; /* FIXME */ }
-static inline struct dxgi_output *impl_from_IDXGIOutput(IDXGIOutput *iface) +static inline struct dxgi_output *impl_from_IDXGIOutput4(IDXGIOutput4 *iface) { - return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput_iface); + return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput4_iface); }
/* IUnknown methods */
-static HRESULT STDMETHODCALLTYPE dxgi_output_QueryInterface(IDXGIOutput *iface, REFIID riid, void **object) +static HRESULT STDMETHODCALLTYPE dxgi_output_QueryInterface(IDXGIOutput4 *iface, REFIID riid, void **object) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
@@ -60,19 +60,19 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_QueryInterface(IDXGIOutput *iface, return E_NOINTERFACE; }
-static ULONG STDMETHODCALLTYPE dxgi_output_AddRef(IDXGIOutput *iface) +static ULONG STDMETHODCALLTYPE dxgi_output_AddRef(IDXGIOutput4 *iface) { - struct dxgi_output *This = impl_from_IDXGIOutput(iface); - ULONG refcount = InterlockedIncrement(&This->refcount); + struct dxgi_output *output = impl_from_IDXGIOutput4(iface); + ULONG refcount = InterlockedIncrement(&output->refcount);
- TRACE("%p increasing refcount to %u.\n", This, refcount); + TRACE("%p increasing refcount to %u.\n", output, refcount);
return refcount; }
-static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput *iface) +static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput4 *iface) { - struct dxgi_output *output = impl_from_IDXGIOutput(iface); + struct dxgi_output *output = impl_from_IDXGIOutput4(iface); ULONG refcount = InterlockedDecrement(&output->refcount);
TRACE("%p decreasing refcount to %u.\n", output, refcount); @@ -89,40 +89,40 @@ static ULONG STDMETHODCALLTYPE dxgi_output_Release(IDXGIOutput *iface)
/* IDXGIObject methods */
-static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateData(IDXGIOutput *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateData(IDXGIOutput4 *iface, REFGUID guid, UINT data_size, const void *data) { - struct dxgi_output *output = impl_from_IDXGIOutput(iface); + struct dxgi_output *output = impl_from_IDXGIOutput4(iface);
TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return dxgi_set_private_data(&output->private_store, guid, data_size, data); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateDataInterface(IDXGIOutput *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_SetPrivateDataInterface(IDXGIOutput4 *iface, REFGUID guid, const IUnknown *object) { - struct dxgi_output *output = impl_from_IDXGIOutput(iface); + struct dxgi_output *output = impl_from_IDXGIOutput4(iface);
TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
return dxgi_set_private_data_interface(&output->private_store, guid, object); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetPrivateData(IDXGIOutput *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetPrivateData(IDXGIOutput4 *iface, REFGUID guid, UINT *data_size, void *data) { - struct dxgi_output *output = impl_from_IDXGIOutput(iface); + struct dxgi_output *output = impl_from_IDXGIOutput4(iface);
TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
return dxgi_get_private_data(&output->private_store, guid, data_size, data); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput4 *iface, REFIID riid, void **parent) { - struct dxgi_output *output = impl_from_IDXGIOutput(iface); + struct dxgi_output *output = impl_from_IDXGIOutput4(iface);
TRACE("iface %p, riid %s, parent %p.\n", iface, debugstr_guid(riid), parent);
@@ -131,9 +131,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetParent(IDXGIOutput *iface,
/* IDXGIOutput methods */
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput *iface, DXGI_OUTPUT_DESC *desc) +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput4 *iface, DXGI_OUTPUT_DESC *desc) { - struct dxgi_output *output = impl_from_IDXGIOutput(iface); + struct dxgi_output *output = impl_from_IDXGIOutput4(iface); struct wined3d_output_desc wined3d_desc; HRESULT hr;
@@ -162,10 +162,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput *iface, DXGI_OU return S_OK; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput4 *iface, DXGI_FORMAT format, UINT flags, UINT *mode_count, DXGI_MODE_DESC *desc) { - struct dxgi_output *output = impl_from_IDXGIOutput(iface); + struct dxgi_output *output = impl_from_IDXGIOutput4(iface); enum wined3d_format_id wined3d_format; unsigned int i, max_count; struct wined3d *wined3d; @@ -225,10 +225,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa return S_OK; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode(IDXGIOutput *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode(IDXGIOutput4 *iface, const DXGI_MODE_DESC *mode, DXGI_MODE_DESC *closest_match, IUnknown *device) { - struct dxgi_output *output = impl_from_IDXGIOutput(iface); + struct dxgi_output *output = impl_from_IDXGIOutput4(iface); struct wined3d_display_mode wined3d_mode; struct dxgi_adapter *adapter; struct wined3d *wined3d; @@ -266,7 +266,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode(IDXGIOutput return hr; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput *iface) +static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput4 *iface) { static BOOL once = FALSE;
@@ -278,19 +278,19 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput *iface) return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_TakeOwnership(IDXGIOutput *iface, IUnknown *device, BOOL exclusive) +static HRESULT STDMETHODCALLTYPE dxgi_output_TakeOwnership(IDXGIOutput4 *iface, IUnknown *device, BOOL exclusive) { FIXME("iface %p, device %p, exclusive %d stub!\n", iface, device, exclusive);
return E_NOTIMPL; }
-static void STDMETHODCALLTYPE dxgi_output_ReleaseOwnership(IDXGIOutput *iface) +static void STDMETHODCALLTYPE dxgi_output_ReleaseOwnership(IDXGIOutput4 *iface) { FIXME("iface %p stub!\n", iface); }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControlCapabilities(IDXGIOutput *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControlCapabilities(IDXGIOutput4 *iface, DXGI_GAMMA_CONTROL_CAPABILITIES *gamma_caps) { FIXME("iface %p, gamma_caps %p stub!\n", iface, gamma_caps); @@ -298,7 +298,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControlCapabilities(IDXGIOu return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_SetGammaControl(IDXGIOutput *iface, +static HRESULT STDMETHODCALLTYPE dxgi_output_SetGammaControl(IDXGIOutput4 *iface, const DXGI_GAMMA_CONTROL *gamma_control) { FIXME("iface %p, gamma_control %p stub!\n", iface, gamma_control); @@ -306,35 +306,101 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_SetGammaControl(IDXGIOutput *iface, return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControl(IDXGIOutput *iface, DXGI_GAMMA_CONTROL *gamma_control) +static HRESULT STDMETHODCALLTYPE dxgi_output_GetGammaControl(IDXGIOutput4 *iface, DXGI_GAMMA_CONTROL *gamma_control) { FIXME("iface %p, gamma_control %p stub!\n", iface, gamma_control);
return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_SetDisplaySurface(IDXGIOutput *iface, IDXGISurface *surface) +static HRESULT STDMETHODCALLTYPE dxgi_output_SetDisplaySurface(IDXGIOutput4 *iface, IDXGISurface *surface) { FIXME("iface %p, surface %p stub!\n", iface, surface);
return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData(IDXGIOutput *iface, IDXGISurface *surface) +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData(IDXGIOutput4 *iface, IDXGISurface *surface) { FIXME("iface %p, surface %p stub!\n", iface, surface);
return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE dxgi_output_GetFrameStatistics(IDXGIOutput *iface, DXGI_FRAME_STATISTICS *stats) +static HRESULT STDMETHODCALLTYPE dxgi_output_GetFrameStatistics(IDXGIOutput4 *iface, DXGI_FRAME_STATISTICS *stats) { FIXME("iface %p, stats %p stub!\n", iface, stats);
return E_NOTIMPL; }
-static const struct IDXGIOutputVtbl dxgi_output_vtbl = +/* IDXGIOutput1 methods */ + +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList1(IDXGIOutput4 *iface, + DXGI_FORMAT format, UINT flags, UINT *mode_count, DXGI_MODE_DESC1 *modes) +{ + FIXME("iface %p, format %#x, flags %#x, mode_count %p, modes %p stub!\n", + iface, format, flags, mode_count, modes); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE dxgi_output_FindClosestMatchingMode1(IDXGIOutput4 *iface, + const DXGI_MODE_DESC1 *mode, DXGI_MODE_DESC1 *closest_match, IUnknown *device) +{ + FIXME("iface %p, mode %p, closest_match %p, device %p stub!\n", + iface, mode, closest_match, device); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplaySurfaceData1(IDXGIOutput4 *iface, + IDXGIResource *resource) +{ + FIXME("iface %p, resource %p stub!\n", iface, resource); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE dxgi_output_DuplicateOutput(IDXGIOutput4 *iface, + IUnknown *device, IDXGIOutputDuplication **output_duplication) +{ + FIXME("iface %p, device %p, output_duplication %p stub!\n", iface, device, output_duplication); + + return E_NOTIMPL; +} + +/* IDXGIOutput2 methods */ + +static BOOL STDMETHODCALLTYPE dxgi_output_SupportsOverlays(IDXGIOutput4 *iface) +{ + FIXME("iface %p stub!\n", iface); + + return FALSE; +} + +/* IDXGIOutput3 methods */ + +static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlaySupport(IDXGIOutput4 *iface, + DXGI_FORMAT format, IUnknown *device, UINT *flags) +{ + FIXME("iface %p, format %#x, device %p, flags %p stub!\n", iface, format, device, flags); + + return E_NOTIMPL; +} + +/* IDXGIOutput4 methods */ + +static HRESULT STDMETHODCALLTYPE dxgi_output_CheckOverlayColorSpaceSupport(IDXGIOutput4 *iface, + DXGI_FORMAT format, DXGI_COLOR_SPACE_TYPE color_space, IUnknown *device, UINT *flags) +{ + FIXME("iface %p, format %#x, color_space %#x, device %p, flags %p stub!\n", + iface, format, color_space, device, flags); + + return E_NOTIMPL; +} + +static const struct IDXGIOutput4Vtbl dxgi_output_vtbl = { dxgi_output_QueryInterface, dxgi_output_AddRef, @@ -357,11 +423,22 @@ static const struct IDXGIOutputVtbl dxgi_output_vtbl = dxgi_output_SetDisplaySurface, dxgi_output_GetDisplaySurfaceData, dxgi_output_GetFrameStatistics, + /* IDXGIOutput1 methods */ + dxgi_output_GetDisplayModeList1, + dxgi_output_FindClosestMatchingMode1, + dxgi_output_GetDisplaySurfaceData1, + dxgi_output_DuplicateOutput, + /* IDXGIOutput2 methods */ + dxgi_output_SupportsOverlays, + /* IDXGIOutput3 methods */ + dxgi_output_CheckOverlaySupport, + /* IDXGIOutput4 methods */ + dxgi_output_CheckOverlayColorSpaceSupport, };
static void dxgi_output_init(struct dxgi_output *output, struct dxgi_adapter *adapter) { - output->IDXGIOutput_iface.lpVtbl = &dxgi_output_vtbl; + output->IDXGIOutput4_iface.lpVtbl = &dxgi_output_vtbl; output->refcount = 1; wined3d_private_store_init(&output->private_store); output->adapter = adapter;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com ---
Version 2: * Use more interesting QueryInterface() implementation. * Do not crash when CreateDevice() fails.
--- dlls/dxgi/tests/device.c | 142 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+)
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c index c4bf826c6aeb..140e2647cc0c 100644 --- a/dlls/dxgi/tests/device.c +++ b/dlls/dxgi/tests/device.c @@ -3456,6 +3456,147 @@ static void test_output_desc(void) ok(!refcount, "IDXGIFactory has %u references left.\n", refcount); }
+struct dxgi_adapter +{ + IDXGIAdapter IDXGIAdapter_iface; + IDXGIAdapter *wrapped_iface; +}; + +static inline struct dxgi_adapter *impl_from_IDXGIAdapter(IDXGIAdapter *iface) +{ + return CONTAINING_RECORD(iface, struct dxgi_adapter, IDXGIAdapter_iface); +} + +static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IDXGIAdapter *iface, REFIID iid, void **out) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + + if (IsEqualGUID(iid, &IID_IDXGIAdapter) + || IsEqualGUID(iid, &IID_IDXGIObject) + || IsEqualGUID(iid, &IID_IUnknown)) + { + IDXGIAdapter_AddRef(adapter->wrapped_iface); + *out = iface; + return S_OK; + } + return IDXGIAdapter_QueryInterface(adapter->wrapped_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE dxgi_adapter_AddRef(IDXGIAdapter *iface) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + return IDXGIAdapter_AddRef(adapter->wrapped_iface); +} + +static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IDXGIAdapter *iface) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + return IDXGIAdapter_Release(adapter->wrapped_iface); +} + +static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateData(IDXGIAdapter *iface, + REFGUID guid, UINT data_size, const void *data) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + return IDXGIAdapter_SetPrivateData(adapter->wrapped_iface, guid, data_size, data); +} + +static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateDataInterface(IDXGIAdapter *iface, + REFGUID guid, const IUnknown *object) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + return IDXGIAdapter_SetPrivateDataInterface(adapter->wrapped_iface, guid, object); +} + +static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetPrivateData(IDXGIAdapter *iface, + REFGUID guid, UINT *data_size, void *data) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + return IDXGIAdapter_GetPrivateData(adapter->wrapped_iface, guid, data_size, data); +} + +static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetParent(IDXGIAdapter *iface, REFIID iid, void **parent) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + return IDXGIAdapter_GetParent(adapter->wrapped_iface, iid, parent); +} + +static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IDXGIAdapter *iface, + UINT output_idx, IDXGIOutput **output) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + return IDXGIAdapter_EnumOutputs(adapter->wrapped_iface, output_idx, output); +} + +static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + return IDXGIAdapter_GetDesc(adapter->wrapped_iface, desc); +} + +static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IDXGIAdapter *iface, + REFGUID guid, LARGE_INTEGER *umd_version) +{ + struct dxgi_adapter *adapter = impl_from_IDXGIAdapter(iface); + return IDXGIAdapter_CheckInterfaceSupport(adapter->wrapped_iface, guid, umd_version); +} + +static const struct IDXGIAdapterVtbl dxgi_adapter_vtbl = +{ + dxgi_adapter_QueryInterface, + dxgi_adapter_AddRef, + dxgi_adapter_Release, + dxgi_adapter_SetPrivateData, + dxgi_adapter_SetPrivateDataInterface, + dxgi_adapter_GetPrivateData, + dxgi_adapter_GetParent, + dxgi_adapter_EnumOutputs, + dxgi_adapter_GetDesc, + dxgi_adapter_CheckInterfaceSupport, +}; + +static void test_object_wrapping(void) +{ + struct dxgi_adapter wrapper; + DXGI_ADAPTER_DESC desc; + IDXGIAdapter *adapter; + IDXGIFactory *factory; + ID3D10Device1 *device; + ULONG refcount; + HRESULT hr; + + hr = CreateDXGIFactory(&IID_IDXGIFactory, (void **)&factory); + ok(hr == S_OK, "Failed to create DXGI factory, hr %#x.\n", hr); + + hr = IDXGIFactory_EnumAdapters(factory, 0, &adapter); + if (hr == DXGI_ERROR_NOT_FOUND) + { + skip("Could not enumerate adapters.\n"); + IDXGIFactory_Release(factory); + return; + } + ok(hr == S_OK, "Failed to enumerate adapter, hr %#x.\n", hr); + + wrapper.IDXGIAdapter_iface.lpVtbl = &dxgi_adapter_vtbl; + wrapper.wrapped_iface = adapter; + + hr = D3D10CreateDevice1(&wrapper.IDXGIAdapter_iface, D3D10_DRIVER_TYPE_HARDWARE, NULL, + 0, D3D10_FEATURE_LEVEL_10_0, D3D10_1_SDK_VERSION, &device); + if (SUCCEEDED(hr)) + { + refcount = ID3D10Device1_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + } + + hr = IDXGIAdapter_GetDesc(&wrapper.IDXGIAdapter_iface, &desc); + ok(hr == S_OK, "Failed to get adapter desc, hr %#x.\n", hr); + + refcount = IDXGIAdapter_Release(&wrapper.IDXGIAdapter_iface); + ok(!refcount, "Adapter has %u references left.\n", refcount); + refcount = IDXGIFactory_Release(factory); + ok(!refcount, "Factory has %u references left.\n", refcount); +} + START_TEST(device) { HMODULE dxgi_module = GetModuleHandleA("dxgi.dll"); @@ -3484,4 +3625,5 @@ START_TEST(device) test_swapchain_parameters(); test_maximum_frame_latency(); test_output_desc(); + test_object_wrapping(); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/dxgi/tests/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c index 140e2647cc0c..58c3bba64230 100644 --- a/dlls/dxgi/tests/device.c +++ b/dlls/dxgi/tests/device.c @@ -1126,7 +1126,7 @@ static void test_create_swapchain(void) ok(SUCCEEDED(hr), "Failed to create swapchain, hr %#x.\n", hr);
refcount = get_refcount((IUnknown *)adapter); - ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount); + ok(refcount >= expected_refcount, "Got refcount %u, expected >= %u.\n", refcount, expected_refcount); refcount = get_refcount((IUnknown *)factory); todo_wine ok(refcount == 4, "Got unexpected refcount %u.\n", refcount); refcount = get_refcount((IUnknown *)device);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com