From d94d2c0ead4eaa15c24ca2cdc4e58d4672234399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Wed, 21 Nov 2018 10:13:19 +0100 Subject: [PATCH] dxgi: Partially implement dxgi_adapter_QueryVideoMemoryInfo(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on a patch by Matteo Bruni. Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/dxgi/adapter.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index b96904e90c0..71e15d7b7c8 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -297,10 +297,44 @@ static void STDMETHODCALLTYPE dxgi_adapter_UnregisterHardwareContentProtectionTe 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", + struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface); + struct wined3d_adapter_identifier adapter_id; + HRESULT hr; + + FIXME("iface %p, node_index %u, segment_group %#x, memory_info %p partial stub!\n", iface, node_index, segment_group, memory_info); - return E_NOTIMPL; + if (node_index) + FIXME("Ignoring node index %u.\n", node_index); + + adapter_id.driver_size = 0; + adapter_id.description_size = 0; + adapter_id.device_name_size = 0; + + wined3d_mutex_lock(); + hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id); + wined3d_mutex_unlock(); + + if (FAILED(hr)) + return hr; + + switch (segment_group) + { + case DXGI_MEMORY_SEGMENT_GROUP_LOCAL: + memory_info->Budget = adapter_id.video_memory; + memory_info->CurrentUsage = 0; + memory_info->AvailableForReservation = adapter_id.video_memory / 2; + memory_info->CurrentReservation = 0; + break; + case DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL: + memset(memory_info, 0, sizeof(*memory_info)); + break; + default: + WARN("Invalid memory segment group %#x.\n", segment_group); + return E_INVALIDARG; + } + + return hr; } static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetVideoMemoryReservation(IWineDXGIAdapter *iface,