dxgi: Implement IDXGIAdapter1.
This commit is contained in:
parent
e9f9c15016
commit
ac84e9b726
|
@ -38,6 +38,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IWineDXGIAdapter *i
|
|||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IDXGIObject)
|
||||
|| IsEqualGUID(riid, &IID_IDXGIAdapter)
|
||||
|| IsEqualGUID(riid, &IID_IDXGIAdapter1)
|
||||
|| IsEqualGUID(riid, &IID_IWineDXGIAdapter))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
|
@ -135,9 +136,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *ifac
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc)
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC1 *desc)
|
||||
{
|
||||
struct dxgi_adapter *This = impl_from_IWineDXGIAdapter(iface);
|
||||
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
|
||||
struct wined3d_adapter_identifier adapter_id;
|
||||
char description[128];
|
||||
struct wined3d *wined3d;
|
||||
|
@ -145,21 +146,23 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D
|
|||
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
||||
if (!desc) return E_INVALIDARG;
|
||||
if (!desc)
|
||||
return E_INVALIDARG;
|
||||
|
||||
wined3d = IWineDXGIFactory_get_wined3d(This->parent);
|
||||
wined3d = IWineDXGIFactory_get_wined3d(adapter->parent);
|
||||
adapter_id.driver_size = 0;
|
||||
adapter_id.description = description;
|
||||
adapter_id.description_size = sizeof(description);
|
||||
adapter_id.device_name_size = 0;
|
||||
|
||||
EnterCriticalSection(&dxgi_cs);
|
||||
hr = wined3d_get_adapter_identifier(wined3d, This->ordinal, 0, &adapter_id);
|
||||
hr = wined3d_get_adapter_identifier(wined3d, adapter->ordinal, 0, &adapter_id);
|
||||
wined3d_decref(wined3d);
|
||||
LeaveCriticalSection(&dxgi_cs);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (!MultiByteToWideChar(CP_ACP, 0, description, -1, desc->Description, 128))
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
|
@ -175,7 +178,24 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D
|
|||
desc->DedicatedSystemMemory = 0; /* FIXME */
|
||||
desc->SharedSystemMemory = 0; /* FIXME */
|
||||
memcpy(&desc->AdapterLuid, &adapter_id.adapter_luid, sizeof(desc->AdapterLuid));
|
||||
}
|
||||
desc->Flags = 0;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc)
|
||||
{
|
||||
DXGI_ADAPTER_DESC1 desc1;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, desc %p.\n", iface, desc);
|
||||
|
||||
if (!desc)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (FAILED(hr = dxgi_adapter_GetDesc1(iface, &desc1)))
|
||||
return hr;
|
||||
memcpy(desc, &desc1, sizeof(*desc));
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
@ -214,6 +234,8 @@ static const struct IWineDXGIAdapterVtbl dxgi_adapter_vtbl =
|
|||
dxgi_adapter_EnumOutputs,
|
||||
dxgi_adapter_GetDesc,
|
||||
dxgi_adapter_CheckInterfaceSupport,
|
||||
/* IDXGIAdapter1 methods */
|
||||
dxgi_adapter_GetDesc1,
|
||||
/* IWineDXGIAdapter methods */
|
||||
dxgi_adapter_get_ordinal,
|
||||
};
|
||||
|
|
|
@ -101,6 +101,8 @@ static void test_device_interfaces(IDXGIDevice *device)
|
|||
|
||||
static void test_adapter_desc(IDXGIDevice *device)
|
||||
{
|
||||
DXGI_ADAPTER_DESC1 desc1;
|
||||
IDXGIAdapter1 *adapter1;
|
||||
DXGI_ADAPTER_DESC desc;
|
||||
IDXGIAdapter *adapter;
|
||||
HRESULT hr;
|
||||
|
@ -126,6 +128,33 @@ static void test_adapter_desc(IDXGIDevice *device)
|
|||
desc.SharedSystemMemory, desc.SharedSystemMemory / (1024 * 1024));
|
||||
trace("LUID: %08x:%08x.\n", desc.AdapterLuid.HighPart, desc.AdapterLuid.LowPart);
|
||||
|
||||
hr = IDXGIAdapter_QueryInterface(adapter, &IID_IDXGIAdapter1, (void **)&adapter1);
|
||||
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE), "Got unexpected hr %#x.\n", hr);
|
||||
if (hr == E_NOINTERFACE)
|
||||
goto done;
|
||||
|
||||
hr = IDXGIAdapter1_GetDesc1(adapter1, &desc1);
|
||||
ok(SUCCEEDED(hr), "GetDesc1 failed, hr %#x.\n", hr);
|
||||
|
||||
ok(!lstrcmpW(desc.Description, desc1.Description),
|
||||
"Got unexpected description %s.\n", wine_dbgstr_w(desc1.Description));
|
||||
ok(desc1.VendorId == desc.VendorId, "Got unexpected vendor ID %04x.\n", desc1.VendorId);
|
||||
ok(desc1.DeviceId == desc.DeviceId, "Got unexpected device ID %04x.\n", desc1.DeviceId);
|
||||
ok(desc1.SubSysId == desc.SubSysId, "Got unexpected sub system ID %04x.\n", desc1.SubSysId);
|
||||
ok(desc1.Revision == desc.Revision, "Got unexpected revision %02x.\n", desc1.Revision);
|
||||
ok(desc1.DedicatedVideoMemory == desc.DedicatedVideoMemory,
|
||||
"Got unexpected dedicated video memory %lu.\n", desc1.DedicatedVideoMemory);
|
||||
ok(desc1.DedicatedSystemMemory == desc.DedicatedSystemMemory,
|
||||
"Got unexpected dedicated system memory %lu.\n", desc1.DedicatedSystemMemory);
|
||||
ok(desc1.SharedSystemMemory == desc.SharedSystemMemory,
|
||||
"Got unexpected shared system memory %lu.\n", desc1.SharedSystemMemory);
|
||||
ok(!memcmp(&desc.AdapterLuid, &desc1.AdapterLuid, sizeof(desc.AdapterLuid)),
|
||||
"Got unexpected adapter LUID %08x:%08x.\n", desc1.AdapterLuid.HighPart, desc1.AdapterLuid.LowPart);
|
||||
trace("Flags: %08x.\n", desc1.Flags);
|
||||
|
||||
IDXGIAdapter1_Release(adapter1);
|
||||
|
||||
done:
|
||||
IDXGIAdapter_Release(adapter);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ interface IWineDXGIFactory : IDXGIFactory
|
|||
local,
|
||||
uuid(ab1de34c-2963-4ffd-8493-40f580e510e5)
|
||||
]
|
||||
interface IWineDXGIAdapter : IDXGIAdapter
|
||||
interface IWineDXGIAdapter : IDXGIAdapter1
|
||||
{
|
||||
UINT get_ordinal();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue