dxvk/src/dxgi/dxgi_factory.cpp

87 lines
2.1 KiB
C++
Raw Normal View History

2017-10-11 02:09:04 +01:00
#include "dxgi_factory.h"
#include "dxgi_swapchain.h"
namespace dxvk {
DxgiFactory::DxgiFactory()
2017-10-11 14:31:36 +01:00
: m_instance(new DxvkInstance()),
m_adapters(m_instance->enumAdapters()) {
2017-10-11 02:09:04 +01:00
TRACE(this);
}
DxgiFactory::~DxgiFactory() {
TRACE(this);
}
HRESULT DxgiFactory::QueryInterface(
REFIID riid,
void** ppvObject) {
COM_QUERY_IFACE(riid, ppvObject, IDXGIFactory);
Logger::warn("DxgiFactory::QueryInterface: Unknown interface query");
return E_NOINTERFACE;
}
HRESULT DxgiFactory::GetParent(
REFIID riid,
void** ppParent) {
Logger::warn("DxgiFactory::GetParent: Unknown interface query");
return E_NOINTERFACE;
}
HRESULT DxgiFactory::CreateSoftwareAdapter(
HMODULE Module,
IDXGIAdapter** ppAdapter) {
Logger::err("DxgiFactory::CreateSoftwareAdapter: Software adapters not supported");
return DXGI_ERROR_UNSUPPORTED;
}
HRESULT DxgiFactory::CreateSwapChain(
IUnknown* pDevice,
DXGI_SWAP_CHAIN_DESC* pDesc,
IDXGISwapChain** ppSwapChain) {
TRACE(this, pDevice, pDesc, ppSwapChain);
return DXGI_ERROR_UNSUPPORTED;
}
HRESULT DxgiFactory::EnumAdapters(
UINT Adapter,
IDXGIAdapter** ppAdapter) {
TRACE(this, Adapter, ppAdapter);
if (ppAdapter == nullptr)
return DXGI_ERROR_INVALID_CALL;
if (Adapter >= m_adapters.size())
return DXGI_ERROR_NOT_FOUND;
2017-10-11 14:31:36 +01:00
*ppAdapter = ref(new DxgiAdapter(
this, m_adapters.at(Adapter)));
2017-10-11 02:09:04 +01:00
return S_OK;
}
HRESULT DxgiFactory::GetWindowAssociation(HWND *pWindowHandle) {
if (pWindowHandle == nullptr)
return DXGI_ERROR_INVALID_CALL;
*pWindowHandle = m_associatedWindow;
return S_OK;
}
HRESULT DxgiFactory::MakeWindowAssociation(HWND WindowHandle, UINT Flags) {
TRACE(this, WindowHandle, Flags);
Logger::warn("DxgiFactory::MakeWindowAssociation: Ignoring flags");
m_associatedWindow = WindowHandle;
return S_OK;
}
}