1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-21 02:52:10 +01:00
dxvk/src/dxgi/dxgi_device.cpp

138 lines
3.9 KiB
C++
Raw Normal View History

2017-10-11 15:31:36 +02:00
#include "dxgi_device.h"
#include "dxgi_factory.h"
namespace dxvk {
DxgiDevice::DxgiDevice(
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);
COM_QUERY_IFACE(riid, ppvObject, IDXGIDevice1);
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");
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) {
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(
UINT* pMaxLatency) {
Logger::warn("DxgiDevice::GetMaximumFrameLatency: Stub");
*pMaxLatency = 1;
return S_OK;
}
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE DxgiDevice::SetMaximumFrameLatency(
UINT MaxLatency) {
Logger::warn("DxgiDevice::SetMaximumFrameLatency: Stub");
return S_OK;
}
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;
}
}