1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[dxgi] Implement IDXGIAdapter4

This commit is contained in:
Philip Rebohle 2020-04-28 14:50:36 +02:00
parent 26ea12b18e
commit 15f5efe4c3
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 40 additions and 8 deletions

View File

@ -89,6 +89,7 @@ namespace dxvk {
|| riid == __uuidof(IDXGIAdapter1)
|| riid == __uuidof(IDXGIAdapter2)
|| riid == __uuidof(IDXGIAdapter3)
|| riid == __uuidof(IDXGIAdapter4)
|| riid == __uuidof(IDXGIDXVKAdapter)) {
*ppvObject = ref(this);
return S_OK;
@ -158,8 +159,8 @@ namespace dxvk {
if (pDesc == nullptr)
return E_INVALIDARG;
DXGI_ADAPTER_DESC2 desc;
HRESULT hr = GetDesc2(&desc);
DXGI_ADAPTER_DESC3 desc;
HRESULT hr = GetDesc3(&desc);
if (SUCCEEDED(hr)) {
std::memcpy(pDesc->Description, desc.Description, sizeof(pDesc->Description));
@ -182,8 +183,8 @@ namespace dxvk {
if (pDesc == nullptr)
return E_INVALIDARG;
DXGI_ADAPTER_DESC2 desc;
HRESULT hr = GetDesc2(&desc);
DXGI_ADAPTER_DESC3 desc;
HRESULT hr = GetDesc3(&desc);
if (SUCCEEDED(hr)) {
std::memcpy(pDesc->Description, desc.Description, sizeof(pDesc->Description));
@ -206,6 +207,34 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE DxgiAdapter::GetDesc2(DXGI_ADAPTER_DESC2* pDesc) {
if (pDesc == nullptr)
return E_INVALIDARG;
DXGI_ADAPTER_DESC3 desc;
HRESULT hr = GetDesc3(&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;
pDesc->GraphicsPreemptionGranularity = desc.GraphicsPreemptionGranularity;
pDesc->ComputePreemptionGranularity = desc.ComputePreemptionGranularity;
}
return hr;
}
HRESULT STDMETHODCALLTYPE DxgiAdapter::GetDesc3(
DXGI_ADAPTER_DESC3* pDesc) {
if (pDesc == nullptr)
return E_INVALIDARG;
const DxgiOptions* options = m_factory->GetOptions();
@ -271,7 +300,7 @@ namespace dxvk {
pDesc->DedicatedSystemMemory = 0;
pDesc->SharedSystemMemory = sharedMemory;
pDesc->AdapterLuid = LUID { 0, 0 };
pDesc->Flags = 0;
pDesc->Flags = DXGI_ADAPTER_FLAG3_NONE;
pDesc->GraphicsPreemptionGranularity = DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY;
pDesc->ComputePreemptionGranularity = DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY;
@ -282,8 +311,8 @@ namespace dxvk {
return S_OK;
}
HRESULT STDMETHODCALLTYPE DxgiAdapter::QueryVideoMemoryInfo(
UINT NodeIndex,
DXGI_MEMORY_SEGMENT_GROUP MemorySegmentGroup,

View File

@ -75,6 +75,9 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE GetDesc2(
DXGI_ADAPTER_DESC2* pDesc) final;
HRESULT STDMETHODCALLTYPE GetDesc3(
DXGI_ADAPTER_DESC3* pDesc) final;
HRESULT STDMETHODCALLTYPE QueryVideoMemoryInfo(
UINT NodeIndex,
DXGI_MEMORY_SEGMENT_GROUP MemorySegmentGroup,

View File

@ -86,7 +86,7 @@ IDXGIVkSwapChain : public IUnknown {
* this interface.
*/
MIDL_INTERFACE("907bf281-ea3c-43b4-a8e4-9f231107b4ff")
IDXGIDXVKAdapter : public IDXGIAdapter3 {
IDXGIDXVKAdapter : public IDXGIAdapter4 {
virtual dxvk::Rc<dxvk::DxvkAdapter> STDMETHODCALLTYPE GetDXVKAdapter() = 0;
virtual dxvk::Rc<dxvk::DxvkInstance> STDMETHODCALLTYPE GetDXVKInstance() = 0;