VideoBackends: Pass window system info from host on creation

This commit is contained in:
Stenzek
2018-10-03 23:03:22 +10:00
parent 9c57a98723
commit eb284b5d66
26 changed files with 148 additions and 75 deletions

View File

@ -429,10 +429,13 @@ HRESULT Create(HWND wnd)
// prevent DXGI from responding to Alt+Enter, unfortunately DXGI_MWA_NO_ALT_ENTER
// does not work so we disable all monitoring of window messages. However this
// may make it more difficult for DXGI to handle display mode changes.
hr = s_dxgi_factory->MakeWindowAssociation(wnd, DXGI_MWA_NO_WINDOW_CHANGES);
if (FAILED(hr))
MessageBox(wnd, _T("Failed to associate the window"), _T("Dolphin Direct3D 11 backend"),
MB_OK | MB_ICONERROR);
if (wnd)
{
hr = s_dxgi_factory->MakeWindowAssociation(wnd, DXGI_MWA_NO_WINDOW_CHANGES);
if (FAILED(hr))
MessageBox(wnd, _T("Failed to associate the window"), _T("Dolphin Direct3D 11 backend"),
MB_OK | MB_ICONERROR);
}
SetDebugObjectName(context, "device context");

View File

@ -11,7 +11,7 @@ namespace DX11
{
class VideoBackend : public VideoBackendBase
{
bool Initialize(void* display_handle, void* window_handle) override;
bool Initialize(const WindowSystemInfo& wsi) override;
void Shutdown() override;
std::string GetName() const override;

View File

@ -127,14 +127,11 @@ void VideoBackend::InitBackendInfo()
DX11::D3D::UnloadD3D();
}
bool VideoBackend::Initialize(void* display_handle, void* window_handle)
bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
{
if (window_handle == nullptr)
return false;
InitializeShared();
if (FAILED(D3D::Create(reinterpret_cast<HWND>(window_handle))))
if (FAILED(D3D::Create(reinterpret_cast<HWND>(wsi.render_surface))))
{
PanicAlert("Failed to create D3D device.");
return false;