2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "HDRStatus.h"
12 #include "rendering/dx/RenderSystemDX.h"
13 #include "windowing/windows/WinSystemWin32.h"
15 struct D3D10DDIARG_CREATERESOURCE
;
17 class CWinSystemWin32DX
: public CWinSystemWin32
, public CRenderSystemDX
19 friend interface
DX::IDeviceNotify
;
24 static void Register();
25 static std::unique_ptr
<CWinSystemBase
> CreateWinSystem();
27 // Implementation of CWinSystemBase via CWinSystemWin32
28 CRenderSystemBase
*GetRenderSystem() override
{ return this; }
29 bool CreateNewWindow(const std::string
& name
, bool fullScreen
, RESOLUTION_INFO
& res
) override
;
30 bool ResizeWindow(int newWidth
, int newHeight
, int newLeft
, int newTop
) override
;
31 bool SetFullScreen(bool fullScreen
, RESOLUTION_INFO
& res
, bool blankOtherDisplays
) override
;
32 void PresentRenderImpl(bool rendered
) override
;
33 bool DPIChanged(WORD dpi
, RECT windowRect
) const override
;
34 void SetWindow(HWND hWnd
) const;
35 bool DestroyRenderSystem() override
;
36 void* GetHWContext() override
{ return m_deviceResources
->GetD3DContext(); }
39 void InitHooks(IDXGIOutput
* pOutput
);
41 void OnMove(int x
, int y
) override
;
42 void OnResize(int width
, int height
);
45 \brief Register as a dependent of the DirectX Render System
46 Resources should call this on construction if they're dependent on the Render System
47 for survival. Any resources that registers will get callbacks on loss and reset of
48 device. In addition, callbacks for destruction and creation of the device are also called,
49 where any resources dependent on the DirectX device should be destroyed and recreated.
50 \sa Unregister, ID3DResource
52 void Register(ID3DResource
*resource
) const
54 m_deviceResources
->Register(resource
);
57 \brief Unregister as a dependent of the DirectX Render System
58 Resources should call this on destruction if they're a dependent on the Render System
59 \sa Register, ID3DResource
61 void Unregister(ID3DResource
*resource
) const
63 m_deviceResources
->Unregister(resource
);
66 void Register(IDispResource
* resource
) override
{ CWinSystemWin32::Register(resource
); }
67 void Unregister(IDispResource
* resource
) override
{ CWinSystemWin32::Unregister(resource
); }
69 void FixRefreshRateIfNecessary(const D3D10DDIARG_CREATERESOURCE
* pResource
) const;
71 // HDR OS/display override
72 bool IsHDRDisplay() override
;
73 HDR_STATUS
ToggleHDR() override
;
74 HDR_STATUS
GetOSHDRStatus() override
;
77 bool IsHDROutput() const;
78 bool IsTransferPQ() const;
79 void SetHdrMetaData(DXGI_HDR_METADATA_HDR10
& hdr10
) const;
80 void SetHdrColorSpace(const DXGI_COLOR_SPACE_TYPE colorSpace
) const;
82 // Get debug info from swapchain
83 DEBUG_INFO_RENDER
GetDebugInfo() override
;
86 void SetDeviceFullScreen(bool fullScreen
, RESOLUTION_INFO
& res
) override
;
87 void ReleaseBackBuffer() override
;
88 void CreateBackBuffer() override
;
89 void ResizeDeviceBuffers() override
;
90 bool IsStereoEnabled() override
;
91 void OnScreenChange(HMONITOR monitor
) override
;
92 bool ChangeResolution(const RESOLUTION_INFO
& res
, bool forceChange
= false) override
;
94 HMODULE m_hDriverModule
;