diff --git a/src/dxgi/dxgi_adapter.cpp b/src/dxgi/dxgi_adapter.cpp index 8bf91fc31..c88317bf3 100644 --- a/src/dxgi/dxgi_adapter.cpp +++ b/src/dxgi/dxgi_adapter.cpp @@ -36,6 +36,7 @@ namespace dxvk { || riid == __uuidof(IDXGIObject) || riid == __uuidof(IDXGIAdapter) || riid == __uuidof(IDXGIAdapter1) + || riid == __uuidof(IDXGIAdapter2) || riid == __uuidof(IDXGIVkAdapter)) { *ppvObject = ref(this); return S_OK; @@ -96,23 +97,20 @@ namespace dxvk { if (pDesc == nullptr) return DXGI_ERROR_INVALID_CALL; - DXGI_ADAPTER_DESC1 desc1; - HRESULT hr = this->GetDesc1(&desc1); + DXGI_ADAPTER_DESC2 desc; + HRESULT hr = GetDesc2(&desc); if (SUCCEEDED(hr)) { - std::memcpy( - pDesc->Description, - desc1.Description, - sizeof(pDesc->Description)); + std::memcpy(pDesc->Description, desc.Description, sizeof(pDesc->Description)); - pDesc->VendorId = desc1.VendorId; - pDesc->DeviceId = desc1.DeviceId; - pDesc->SubSysId = desc1.SubSysId; - pDesc->Revision = desc1.Revision; - pDesc->DedicatedVideoMemory = desc1.DedicatedVideoMemory; - pDesc->DedicatedSystemMemory = desc1.DedicatedSystemMemory; - pDesc->SharedSystemMemory = desc1.SharedSystemMemory; - pDesc->AdapterLuid = desc1.AdapterLuid; + pDesc->VendorId = desc.VendorId; + pDesc->DeviceId = desc.DeviceId; + pDesc->SubSysId = desc.SubSysId; + pDesc->Revision = desc.Revision; + pDesc->DedicatedVideoMemory = desc.DedicatedVideoMemory; + pDesc->DedicatedSystemMemory = desc.DedicatedSystemMemory; + pDesc->SharedSystemMemory = desc.SharedSystemMemory; + pDesc->AdapterLuid = desc.AdapterLuid; } return hr; @@ -122,6 +120,31 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE DxgiAdapter::GetDesc1(DXGI_ADAPTER_DESC1* pDesc) { if (pDesc == nullptr) return DXGI_ERROR_INVALID_CALL; + + DXGI_ADAPTER_DESC2 desc; + HRESULT hr = GetDesc2(&desc); + + if (SUCCEEDED(hr)) { + std::memcpy(pDesc->Description, desc.Description, sizeof(pDesc->Description)); + + pDesc->VendorId = desc.VendorId; + pDesc->DeviceId = desc.DeviceId; + pDesc->SubSysId = desc.SubSysId; + pDesc->Revision = desc.Revision; + pDesc->DedicatedVideoMemory = desc.DedicatedVideoMemory; + pDesc->DedicatedSystemMemory = desc.DedicatedSystemMemory; + pDesc->SharedSystemMemory = desc.SharedSystemMemory; + pDesc->AdapterLuid = desc.AdapterLuid; + pDesc->Flags = desc.Flags; + } + + return hr; + } + + + HRESULT STDMETHODCALLTYPE DxgiAdapter::GetDesc2(DXGI_ADAPTER_DESC2* pDesc) { + if (pDesc == nullptr) + return DXGI_ERROR_INVALID_CALL; auto deviceProp = m_adapter->deviceProperties(); auto memoryProp = m_adapter->memoryProperties(); @@ -163,15 +186,17 @@ namespace dxvk { sharedMemory = std::min(sharedMemory, maxMemory); #endif - pDesc->VendorId = deviceProp.vendorID; - pDesc->DeviceId = deviceProp.deviceID; - pDesc->SubSysId = 0; - pDesc->Revision = 0; - pDesc->DedicatedVideoMemory = deviceMemory; - pDesc->DedicatedSystemMemory = 0; - pDesc->SharedSystemMemory = sharedMemory; - pDesc->AdapterLuid = LUID { 0, 0 }; // TODO implement - pDesc->Flags = 0; + pDesc->VendorId = deviceProp.vendorID; + pDesc->DeviceId = deviceProp.deviceID; + pDesc->SubSysId = 0; + pDesc->Revision = 0; + pDesc->DedicatedVideoMemory = deviceMemory; + pDesc->DedicatedSystemMemory = 0; + pDesc->SharedSystemMemory = sharedMemory; + pDesc->AdapterLuid = LUID { 0, 0 }; // TODO implement + pDesc->Flags = 0; + pDesc->GraphicsPreemptionGranularity = DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY; + pDesc->ComputePreemptionGranularity = DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY; return S_OK; } diff --git a/src/dxgi/dxgi_adapter.h b/src/dxgi/dxgi_adapter.h index 3bdd0bcbe..02014fb09 100644 --- a/src/dxgi/dxgi_adapter.h +++ b/src/dxgi/dxgi_adapter.h @@ -43,6 +43,9 @@ namespace dxvk { HRESULT STDMETHODCALLTYPE GetDesc1( DXGI_ADAPTER_DESC1* pDesc) final; + HRESULT STDMETHODCALLTYPE GetDesc2( + DXGI_ADAPTER_DESC2* pDesc) final; + Rc STDMETHODCALLTYPE GetDXVKAdapter() final; HRESULT STDMETHODCALLTYPE CreateDevice( diff --git a/src/dxgi/dxgi_interfaces.h b/src/dxgi/dxgi_interfaces.h index 7f76f2576..821195292 100644 --- a/src/dxgi/dxgi_interfaces.h +++ b/src/dxgi/dxgi_interfaces.h @@ -40,7 +40,7 @@ IDXGIVkDevice : public IDXGIDevice2 { * this interface. */ MIDL_INTERFACE("907bf281-ea3c-43b4-a8e4-9f231107b4ff") -IDXGIVkAdapter : public IDXGIAdapter1 { +IDXGIVkAdapter : public IDXGIAdapter2 { static const GUID guid; virtual dxvk::Rc STDMETHODCALLTYPE GetDXVKAdapter() = 0;