mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-11-29 19:24:10 +01:00
[dxgi] Implemented IDXGIAdapter2
This commit is contained in:
parent
a39b9cb131
commit
979ba2d7c6
@ -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;
|
||||
@ -123,6 +121,31 @@ namespace dxvk {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,9 @@ namespace dxvk {
|
||||
HRESULT STDMETHODCALLTYPE GetDesc1(
|
||||
DXGI_ADAPTER_DESC1* pDesc) final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDesc2(
|
||||
DXGI_ADAPTER_DESC2* pDesc) final;
|
||||
|
||||
Rc<DxvkAdapter> STDMETHODCALLTYPE GetDXVKAdapter() final;
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateDevice(
|
||||
|
@ -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<dxvk::DxvkAdapter> STDMETHODCALLTYPE GetDXVKAdapter() = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user