2008-10-29 09:00:26 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2008 Henri Verbeet for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#include "dxgi_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static inline struct dxgi_adapter *impl_from_IWineDXGIAdapter(IWineDXGIAdapter *iface)
|
2011-06-07 10:09:02 +02:00
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct dxgi_adapter, IWineDXGIAdapter_iface);
|
2011-06-07 10:09:02 +02:00
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IWineDXGIAdapter *iface, REFIID iid, void **out)
|
2008-10-29 09:00:26 +01:00
|
|
|
{
|
2014-09-15 11:03:34 +02:00
|
|
|
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2018-01-26 22:09:02 +01:00
|
|
|
if (IsEqualGUID(iid, &IID_IWineDXGIAdapter)
|
2018-10-24 07:22:02 +02:00
|
|
|
|| IsEqualGUID(iid, &IID_IDXGIAdapter4)
|
2018-01-30 15:54:56 +01:00
|
|
|
|| IsEqualGUID(iid, &IID_IDXGIAdapter3)
|
|
|
|
|| IsEqualGUID(iid, &IID_IDXGIAdapter2)
|
2018-01-26 22:09:02 +01:00
|
|
|
|| IsEqualGUID(iid, &IID_IDXGIAdapter1)
|
2014-09-15 11:03:34 +02:00
|
|
|
|| IsEqualGUID(iid, &IID_IDXGIAdapter)
|
|
|
|
|| IsEqualGUID(iid, &IID_IDXGIObject)
|
|
|
|
|| IsEqualGUID(iid, &IID_IUnknown))
|
2008-10-29 09:00:26 +01:00
|
|
|
{
|
|
|
|
IUnknown_AddRef(iface);
|
2014-09-15 11:03:34 +02:00
|
|
|
*out = iface;
|
2008-10-29 09:00:26 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-09-15 11:03:34 +02:00
|
|
|
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2014-09-15 11:03:34 +02:00
|
|
|
*out = NULL;
|
2008-10-29 09:00:26 +01:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static ULONG STDMETHODCALLTYPE dxgi_adapter_AddRef(IWineDXGIAdapter *iface)
|
2008-10-29 09:00:26 +01:00
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
2014-09-15 11:03:34 +02:00
|
|
|
ULONG refcount = InterlockedIncrement(&adapter->refcount);
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2014-09-15 11:03:34 +02:00
|
|
|
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
2008-10-29 09:00:26 +01:00
|
|
|
|
|
|
|
return refcount;
|
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IWineDXGIAdapter *iface)
|
2008-10-29 09:00:26 +01:00
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
2014-09-15 11:03:34 +02:00
|
|
|
ULONG refcount = InterlockedDecrement(&adapter->refcount);
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2014-09-15 11:03:34 +02:00
|
|
|
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
2008-10-29 09:00:26 +01:00
|
|
|
|
|
|
|
if (!refcount)
|
|
|
|
{
|
2015-02-13 10:40:49 +01:00
|
|
|
wined3d_private_store_cleanup(&adapter->private_store);
|
2018-02-14 12:35:49 +01:00
|
|
|
IWineDXGIFactory_Release(&adapter->factory->IWineDXGIFactory_iface);
|
2018-02-06 00:34:19 +01:00
|
|
|
heap_free(adapter);
|
2008-10-29 09:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return refcount;
|
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateData(IWineDXGIAdapter *iface,
|
2008-10-29 09:00:26 +01:00
|
|
|
REFGUID guid, UINT data_size, const void *data)
|
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2015-02-13 10:40:49 +01:00
|
|
|
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);
|
2008-10-29 09:00:26 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateDataInterface(IWineDXGIAdapter *iface,
|
2008-10-29 09:00:26 +01:00
|
|
|
REFGUID guid, const IUnknown *object)
|
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2015-02-13 10:40:50 +01:00
|
|
|
TRACE("iface %p, guid %s, object %p.\n", iface, debugstr_guid(guid), object);
|
|
|
|
|
|
|
|
return dxgi_set_private_data_interface(&adapter->private_store, guid, object);
|
2008-10-29 09:00:26 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetPrivateData(IWineDXGIAdapter *iface,
|
2008-10-29 09:00:26 +01:00
|
|
|
REFGUID guid, UINT *data_size, void *data)
|
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
2015-02-13 10:40:51 +01:00
|
|
|
|
|
|
|
TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2015-02-13 10:40:51 +01:00
|
|
|
return dxgi_get_private_data(&adapter->private_store, guid, data_size, data);
|
2008-10-29 09:00:26 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetParent(IWineDXGIAdapter *iface, REFIID iid, void **parent)
|
2008-10-29 09:00:26 +01:00
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2016-04-14 12:20:23 +02:00
|
|
|
TRACE("iface %p, iid %s, parent %p.\n", iface, debugstr_guid(iid), parent);
|
2008-11-20 13:32:00 +01:00
|
|
|
|
2018-02-14 12:35:49 +01:00
|
|
|
return IWineDXGIFactory_QueryInterface(&adapter->factory->IWineDXGIFactory_iface, iid, parent);
|
2008-10-29 09:00:26 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *iface,
|
2008-11-17 12:16:04 +01:00
|
|
|
UINT output_idx, IDXGIOutput **output)
|
2008-10-29 09:00:26 +01:00
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
2016-04-14 12:20:21 +02:00
|
|
|
struct dxgi_output *output_object;
|
|
|
|
HRESULT hr;
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2009-09-11 19:01:14 +02:00
|
|
|
TRACE("iface %p, output_idx %u, output %p.\n", iface, output_idx, output);
|
|
|
|
|
|
|
|
if (output_idx > 0)
|
|
|
|
{
|
|
|
|
*output = NULL;
|
|
|
|
return DXGI_ERROR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2016-04-14 12:20:21 +02:00
|
|
|
if (FAILED(hr = dxgi_output_create(adapter, &output_object)))
|
|
|
|
{
|
|
|
|
*output = NULL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:57 +01:00
|
|
|
*output = (IDXGIOutput *)&output_object->IDXGIOutput4_iface;
|
2009-09-11 19:01:14 +02:00
|
|
|
|
2016-04-14 12:20:21 +02:00
|
|
|
TRACE("Returning output %p.\n", *output);
|
2009-09-11 19:01:14 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2008-10-29 09:00:26 +01:00
|
|
|
}
|
|
|
|
|
2018-10-24 07:22:03 +02:00
|
|
|
static HRESULT dxgi_adapter_get_desc(struct dxgi_adapter *adapter, DXGI_ADAPTER_DESC3 *desc)
|
2008-10-29 09:00:26 +01:00
|
|
|
{
|
2011-11-23 21:14:57 +01:00
|
|
|
struct wined3d_adapter_identifier adapter_id;
|
2009-12-04 11:50:49 +01:00
|
|
|
char description[128];
|
|
|
|
HRESULT hr;
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2009-12-04 11:50:49 +01:00
|
|
|
adapter_id.driver_size = 0;
|
|
|
|
adapter_id.description = description;
|
|
|
|
adapter_id.description_size = sizeof(description);
|
|
|
|
adapter_id.device_name_size = 0;
|
|
|
|
|
2018-12-03 14:41:06 +01:00
|
|
|
if (FAILED(hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id)))
|
2014-01-28 10:09:25 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
if (!MultiByteToWideChar(CP_ACP, 0, description, -1, desc->Description, 128))
|
2009-12-04 11:50:49 +01:00
|
|
|
{
|
2014-01-28 10:09:25 +01:00
|
|
|
DWORD err = GetLastError();
|
|
|
|
ERR("Failed to translate description %s (%#x).\n", debugstr_a(description), err);
|
|
|
|
hr = E_FAIL;
|
2009-12-04 11:50:49 +01:00
|
|
|
}
|
|
|
|
|
2014-01-28 10:09:25 +01:00
|
|
|
desc->VendorId = adapter_id.vendor_id;
|
|
|
|
desc->DeviceId = adapter_id.device_id;
|
|
|
|
desc->SubSysId = adapter_id.subsystem_id;
|
|
|
|
desc->Revision = adapter_id.revision;
|
|
|
|
desc->DedicatedVideoMemory = adapter_id.video_memory;
|
|
|
|
desc->DedicatedSystemMemory = 0; /* FIXME */
|
2018-11-21 10:13:23 +01:00
|
|
|
desc->SharedSystemMemory = adapter_id.shared_system_memory;
|
2018-02-14 12:35:54 +01:00
|
|
|
desc->AdapterLuid = adapter_id.adapter_luid;
|
2014-01-28 10:09:25 +01:00
|
|
|
desc->Flags = 0;
|
2018-10-24 07:22:03 +02:00
|
|
|
desc->GraphicsPreemptionGranularity = 0; /* FIXME */
|
|
|
|
desc->ComputePreemptionGranularity = 0; /* FIXME */
|
2014-01-28 10:09:25 +01:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc)
|
2014-01-28 10:09:25 +01:00
|
|
|
{
|
2018-10-24 07:22:03 +02:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
|
|
|
DXGI_ADAPTER_DESC3 desc3;
|
2014-01-28 10:09:25 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("iface %p, desc %p.\n", iface, desc);
|
|
|
|
|
|
|
|
if (!desc)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2018-10-24 07:22:03 +02:00
|
|
|
if (SUCCEEDED(hr = dxgi_adapter_get_desc(adapter, &desc3)))
|
|
|
|
memcpy(desc, &desc3, sizeof(*desc));
|
2014-01-28 10:09:25 +01:00
|
|
|
|
2009-12-04 11:50:49 +01:00
|
|
|
return hr;
|
2008-10-29 09:00:26 +01:00
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAdapter *iface,
|
2008-10-29 09:00:26 +01:00
|
|
|
REFGUID guid, LARGE_INTEGER *umd_version)
|
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
2015-10-13 09:44:32 +02:00
|
|
|
struct wined3d_adapter_identifier adapter_id;
|
2018-09-25 10:33:22 +02:00
|
|
|
struct wined3d_caps caps;
|
|
|
|
struct wined3d *wined3d;
|
2015-10-13 09:44:32 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("iface %p, guid %s, umd_version %p.\n", iface, debugstr_guid(guid), umd_version);
|
|
|
|
|
|
|
|
/* This method works only for D3D10 interfaces. */
|
2018-10-21 23:40:40 +02:00
|
|
|
if (!(IsEqualGUID(guid, &IID_IDXGIDevice)
|
|
|
|
|| IsEqualGUID(guid, &IID_ID3D10Device)
|
2015-10-13 09:44:32 +02:00
|
|
|
|| IsEqualGUID(guid, &IID_ID3D10Device1)))
|
|
|
|
{
|
|
|
|
WARN("Returning DXGI_ERROR_UNSUPPORTED for %s.\n", debugstr_guid(guid));
|
|
|
|
return DXGI_ERROR_UNSUPPORTED;
|
|
|
|
}
|
2008-10-29 09:00:26 +01:00
|
|
|
|
2018-09-25 10:33:22 +02:00
|
|
|
adapter_id.driver_size = 0;
|
|
|
|
adapter_id.description_size = 0;
|
|
|
|
adapter_id.device_name_size = 0;
|
2015-10-13 09:44:32 +02:00
|
|
|
|
2018-09-25 10:33:22 +02:00
|
|
|
wined3d_mutex_lock();
|
|
|
|
wined3d = adapter->factory->wined3d;
|
|
|
|
hr = wined3d_get_device_caps(wined3d, adapter->ordinal, WINED3D_DEVICE_TYPE_HAL, &caps);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = wined3d_get_adapter_identifier(wined3d, adapter->ordinal, 0, &adapter_id);
|
|
|
|
wined3d_mutex_unlock();
|
2015-10-13 09:44:32 +02:00
|
|
|
|
2018-09-25 10:33:22 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
if (caps.max_feature_level < WINED3D_FEATURE_LEVEL_10)
|
|
|
|
return DXGI_ERROR_UNSUPPORTED;
|
2015-10-13 09:44:32 +02:00
|
|
|
|
2018-09-25 10:33:22 +02:00
|
|
|
if (umd_version)
|
2015-10-13 09:44:32 +02:00
|
|
|
*umd_version = adapter_id.driver_version;
|
|
|
|
|
|
|
|
return S_OK;
|
2008-10-29 09:00:26 +01:00
|
|
|
}
|
|
|
|
|
2018-10-24 07:22:03 +02:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC1 *desc)
|
|
|
|
{
|
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
|
|
|
DXGI_ADAPTER_DESC3 desc3;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("iface %p, desc %p.\n", iface, desc);
|
|
|
|
|
|
|
|
if (!desc)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = dxgi_adapter_get_desc(adapter, &desc3)))
|
|
|
|
memcpy(desc, &desc3, sizeof(*desc));
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc2(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC2 *desc)
|
|
|
|
{
|
2018-10-24 07:22:03 +02:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
|
|
|
DXGI_ADAPTER_DESC3 desc3;
|
|
|
|
HRESULT hr;
|
2018-01-30 15:54:56 +01:00
|
|
|
|
2018-10-24 07:22:03 +02:00
|
|
|
TRACE("iface %p, desc %p.\n", iface, desc);
|
|
|
|
|
|
|
|
if (!desc)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = dxgi_adapter_get_desc(adapter, &desc3)))
|
|
|
|
memcpy(desc, &desc3, sizeof(*desc));
|
|
|
|
|
|
|
|
return hr;
|
2018-01-30 15:54:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2018-11-21 10:13:19 +01:00
|
|
|
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",
|
2018-01-30 15:54:56 +01:00
|
|
|
iface, node_index, segment_group, memory_info);
|
|
|
|
|
2018-11-21 10:13:19 +01:00
|
|
|
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;
|
|
|
|
|
2018-12-03 14:41:06 +01:00
|
|
|
if (FAILED(hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id)))
|
2018-11-21 10:13:19 +01:00
|
|
|
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;
|
2018-01-30 15:54:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2018-10-24 07:22:02 +02:00
|
|
|
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc3(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC3 *desc)
|
|
|
|
{
|
2018-10-24 07:22:03 +02:00
|
|
|
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
2018-10-24 07:22:02 +02:00
|
|
|
|
2018-10-24 07:22:03 +02:00
|
|
|
TRACE("iface %p, desc %p.\n", iface, desc);
|
|
|
|
|
|
|
|
if (!desc)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
return dxgi_adapter_get_desc(adapter, desc);
|
2018-10-24 07:22:02 +02:00
|
|
|
}
|
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
static const struct IWineDXGIAdapterVtbl dxgi_adapter_vtbl =
|
2008-10-29 09:00:26 +01:00
|
|
|
{
|
|
|
|
dxgi_adapter_QueryInterface,
|
|
|
|
dxgi_adapter_AddRef,
|
|
|
|
dxgi_adapter_Release,
|
|
|
|
dxgi_adapter_SetPrivateData,
|
|
|
|
dxgi_adapter_SetPrivateDataInterface,
|
|
|
|
dxgi_adapter_GetPrivateData,
|
|
|
|
dxgi_adapter_GetParent,
|
2018-01-30 15:54:56 +01:00
|
|
|
/* IDXGIAdapter methods */
|
2008-10-29 09:00:26 +01:00
|
|
|
dxgi_adapter_EnumOutputs,
|
|
|
|
dxgi_adapter_GetDesc,
|
|
|
|
dxgi_adapter_CheckInterfaceSupport,
|
2018-01-30 15:54:56 +01:00
|
|
|
/* IDXGIAdapter1 methods */
|
2014-01-28 10:09:25 +01:00
|
|
|
dxgi_adapter_GetDesc1,
|
2018-01-30 15:54:56 +01:00
|
|
|
/* 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,
|
2018-10-24 07:22:02 +02:00
|
|
|
/* IDXGIAdapter4 methods */
|
|
|
|
dxgi_adapter_GetDesc3,
|
2008-10-29 09:00:26 +01:00
|
|
|
};
|
2009-09-10 16:57:19 +02:00
|
|
|
|
2018-01-30 15:54:56 +01:00
|
|
|
struct dxgi_adapter *unsafe_impl_from_IDXGIAdapter(IDXGIAdapter *iface)
|
2014-09-15 11:03:34 +02:00
|
|
|
{
|
2018-01-26 22:09:02 +01:00
|
|
|
IWineDXGIAdapter *wine_adapter;
|
|
|
|
struct dxgi_adapter *adapter;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2014-09-15 11:03:34 +02:00
|
|
|
if (!iface)
|
|
|
|
return NULL;
|
2018-01-30 15:54:56 +01:00
|
|
|
if (FAILED(hr = IDXGIAdapter_QueryInterface(iface, &IID_IWineDXGIAdapter, (void **)&wine_adapter)))
|
2018-01-26 22:09:02 +01:00
|
|
|
{
|
|
|
|
ERR("Failed to get IWineDXGIAdapter interface, hr %#x.\n", hr);
|
|
|
|
return NULL;
|
|
|
|
}
|
2018-01-30 15:54:56 +01:00
|
|
|
assert(wine_adapter->lpVtbl == &dxgi_adapter_vtbl);
|
|
|
|
adapter = CONTAINING_RECORD(wine_adapter, struct dxgi_adapter, IWineDXGIAdapter_iface);
|
2018-01-26 22:09:02 +01:00
|
|
|
IWineDXGIAdapter_Release(wine_adapter);
|
|
|
|
return adapter;
|
2014-09-15 11:03:34 +02:00
|
|
|
}
|
|
|
|
|
2016-04-14 12:20:23 +02:00
|
|
|
static void dxgi_adapter_init(struct dxgi_adapter *adapter, struct dxgi_factory *factory, UINT ordinal)
|
2009-09-10 16:57:19 +02:00
|
|
|
{
|
2018-01-30 15:54:56 +01:00
|
|
|
adapter->IWineDXGIAdapter_iface.lpVtbl = &dxgi_adapter_vtbl;
|
2009-09-10 16:57:19 +02:00
|
|
|
adapter->refcount = 1;
|
2015-02-13 10:40:49 +01:00
|
|
|
wined3d_private_store_init(&adapter->private_store);
|
2009-09-10 16:57:19 +02:00
|
|
|
adapter->ordinal = ordinal;
|
2016-04-14 12:20:23 +02:00
|
|
|
adapter->factory = factory;
|
2018-02-14 12:35:49 +01:00
|
|
|
IWineDXGIFactory_AddRef(&adapter->factory->IWineDXGIFactory_iface);
|
2016-04-14 12:20:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT dxgi_adapter_create(struct dxgi_factory *factory, UINT ordinal, struct dxgi_adapter **adapter)
|
|
|
|
{
|
2018-02-06 00:34:19 +01:00
|
|
|
if (!(*adapter = heap_alloc(sizeof(**adapter))))
|
2016-04-14 12:20:23 +02:00
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
dxgi_adapter_init(*adapter, factory, ordinal);
|
|
|
|
return S_OK;
|
2009-09-10 16:57:19 +02:00
|
|
|
}
|