2017-10-11 15:31:36 +02:00
|
|
|
#include "dxgi_device.h"
|
|
|
|
#include "dxgi_factory.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2017-12-02 16:47:06 +01:00
|
|
|
DxgiDevice::DxgiDevice(
|
2018-03-28 21:24:52 +02:00
|
|
|
IDXGIObject* pContainer,
|
|
|
|
IDXGIVkAdapter* pAdapter,
|
2018-03-28 18:58:53 +02:00
|
|
|
const VkPhysicalDeviceFeatures* pFeatures)
|
2018-03-28 21:24:52 +02:00
|
|
|
: m_container (pContainer),
|
|
|
|
m_adapter (pAdapter) {
|
2018-03-28 18:58:53 +02:00
|
|
|
m_device = m_adapter->GetDXVKAdapter()->createDevice(*pFeatures);
|
2017-10-11 15:31:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DxgiDevice::~DxgiDevice() {
|
2017-11-26 14:01:41 +01:00
|
|
|
|
2017-10-11 15:31:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-28 21:24:52 +02:00
|
|
|
ULONG STDMETHODCALLTYPE DxgiDevice::AddRef() {
|
|
|
|
return m_container->AddRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ULONG STDMETHODCALLTYPE DxgiDevice::Release() {
|
|
|
|
return m_container->Release();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::QueryInterface(REFIID riid, void** ppvObject) {
|
2018-03-28 21:24:52 +02:00
|
|
|
return m_container->QueryInterface(riid, ppvObject);
|
2017-10-11 15:31:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::GetParent(REFIID riid, void** ppParent) {
|
2017-10-11 15:31:36 +02:00
|
|
|
return m_adapter->QueryInterface(riid, ppParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-28 21:24:52 +02:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::GetPrivateData(
|
|
|
|
REFGUID Name, UINT* pDataSize, void* pData) {
|
|
|
|
return m_container->GetPrivateData(Name, pDataSize, pData);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::SetPrivateData(
|
|
|
|
REFGUID Name, UINT DataSize, const void* pData) {
|
|
|
|
return m_container->SetPrivateData(Name, DataSize,pData);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::SetPrivateDataInterface(
|
|
|
|
REFGUID Name, const IUnknown* pUnknown) {
|
|
|
|
return m_container->SetPrivateDataInterface(Name, pUnknown);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::CreateSurface(
|
2017-10-11 15:31:36 +02:00
|
|
|
const DXGI_SURFACE_DESC* pDesc,
|
|
|
|
UINT NumSurfaces,
|
|
|
|
DXGI_USAGE Usage,
|
|
|
|
const DXGI_SHARED_RESOURCE* pSharedResource,
|
|
|
|
IDXGISurface** ppSurface) {
|
2018-04-02 12:04:20 +02:00
|
|
|
InitReturnPtr(ppSurface);
|
|
|
|
|
2017-10-11 15:31:36 +02:00
|
|
|
Logger::err("DxgiDevice::CreateSurface: Not implemented");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::GetAdapter(
|
2017-10-11 15:31:36 +02:00
|
|
|
IDXGIAdapter** pAdapter) {
|
2018-03-28 11:56:58 +02:00
|
|
|
if (pAdapter == nullptr)
|
|
|
|
return DXGI_ERROR_INVALID_CALL;
|
|
|
|
|
2017-10-11 15:31:36 +02:00
|
|
|
*pAdapter = static_cast<IDXGIAdapter*>(m_adapter.ref());
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::GetGPUThreadPriority(
|
2017-10-11 15:31:36 +02:00
|
|
|
INT* pPriority) {
|
|
|
|
*pPriority = 0;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::QueryResourceResidency(
|
2017-10-11 15:31:36 +02:00
|
|
|
IUnknown* const* ppResources,
|
|
|
|
DXGI_RESIDENCY* pResidencyStatus,
|
|
|
|
UINT NumResources) {
|
|
|
|
Logger::err("DxgiDevice::QueryResourceResidency: Not implemented");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::SetGPUThreadPriority(
|
2017-10-11 15:31:36 +02:00
|
|
|
INT Priority) {
|
|
|
|
if (Priority < -7 || Priority > 7)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2018-04-14 12:02:55 +02:00
|
|
|
Logger::err("DXGI: SetGPUThreadPriority: Ignoring");
|
2017-10-11 15:31:36 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::GetMaximumFrameLatency(
|
2017-12-09 14:45:52 +01:00
|
|
|
UINT* pMaxLatency) {
|
|
|
|
Logger::warn("DxgiDevice::GetMaximumFrameLatency: Stub");
|
|
|
|
*pMaxLatency = 1;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::SetMaximumFrameLatency(
|
2017-12-09 14:45:52 +01:00
|
|
|
UINT MaxLatency) {
|
|
|
|
Logger::warn("DxgiDevice::SetMaximumFrameLatency: Stub");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-03-17 03:48:55 +03:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::OfferResources(
|
|
|
|
UINT NumResources,
|
|
|
|
IDXGIResource* const* ppResources,
|
|
|
|
DXGI_OFFER_RESOURCE_PRIORITY Priority) {
|
|
|
|
|
|
|
|
Logger::err("DxgiDevice::OfferResources: not implemented");
|
|
|
|
return DXGI_ERROR_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::ReclaimResources(
|
|
|
|
UINT NumResources,
|
|
|
|
IDXGIResource* const* ppResources,
|
|
|
|
BOOL* pDiscarded) {
|
|
|
|
Logger::err("DxgiDevice::ReclaimResources: not implemented");
|
|
|
|
return DXGI_ERROR_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::EnqueueSetEvent(HANDLE hEvent) {
|
|
|
|
Logger::err("DxgiDevice::EnqueueSetEvent: not implemented");
|
|
|
|
return DXGI_ERROR_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
Rc<DxvkDevice> STDMETHODCALLTYPE DxgiDevice::GetDXVKDevice() {
|
2017-10-11 15:31:36 +02:00
|
|
|
return m_device;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|