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 18:58:53 +02:00
|
|
|
IDXGIAdapterPrivate* pAdapter,
|
|
|
|
const VkPhysicalDeviceFeatures* pFeatures)
|
|
|
|
: m_adapter(pAdapter) {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE DxgiDevice::QueryInterface(REFIID riid, void** ppvObject) {
|
2017-10-15 21:50:45 +02:00
|
|
|
COM_QUERY_IFACE(riid, ppvObject, IUnknown);
|
|
|
|
COM_QUERY_IFACE(riid, ppvObject, IDXGIObject);
|
2017-10-11 15:31:36 +02:00
|
|
|
COM_QUERY_IFACE(riid, ppvObject, IDXGIDevice);
|
2017-12-09 14:45:52 +01:00
|
|
|
COM_QUERY_IFACE(riid, ppvObject, IDXGIDevice1);
|
2018-03-17 03:48:55 +03:00
|
|
|
COM_QUERY_IFACE(riid, ppvObject, IDXGIDevice2);
|
2017-11-27 15:51:53 +01:00
|
|
|
COM_QUERY_IFACE(riid, ppvObject, IDXGIDevicePrivate);
|
2017-10-11 15:31:36 +02:00
|
|
|
|
|
|
|
if (m_layer != nullptr)
|
|
|
|
return m_layer->QueryInterface(riid, ppvObject);
|
|
|
|
|
|
|
|
Logger::warn("DxgiDevice::QueryInterface: Unknown interface query");
|
2018-03-12 14:05:43 +03:00
|
|
|
Logger::warn(str::format(riid));
|
2017-10-11 15:31:36 +02:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
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;
|
|
|
|
|
|
|
|
Logger::err("DxgiDevice::SetGPUThreadPriority: Ignoring");
|
|
|
|
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
|
|
|
void STDMETHODCALLTYPE DxgiDevice::SetDeviceLayer(IUnknown* layer) {
|
2017-10-11 15:31:36 +02:00
|
|
|
m_layer = layer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
Rc<DxvkDevice> STDMETHODCALLTYPE DxgiDevice::GetDXVKDevice() {
|
2017-10-11 15:31:36 +02:00
|
|
|
return m_device;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|