kodi
WinSystemWin32DX.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "HDRStatus.h"
12 #include "rendering/dx/RenderSystemDX.h"
13 #include "windowing/windows/WinSystemWin32.h"
14 
15 struct D3D10DDIARG_CREATERESOURCE;
16 
18 {
19  friend interface DX::IDeviceNotify;
20 public:
23 
24  static void Register();
25  static std::unique_ptr<CWinSystemBase> CreateWinSystem();
26 
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(); }
37 
38  void UninitHooks();
39  void InitHooks(IDXGIOutput* pOutput);
40 
41  void OnMove(int x, int y) override;
42  void OnResize(int width, int height);
43 
52  void Register(ID3DResource *resource) const
53  {
54  m_deviceResources->Register(resource);
55  };
61  void Unregister(ID3DResource *resource) const
62  {
63  m_deviceResources->Unregister(resource);
64  };
65 
66  void Register(IDispResource* resource) override { CWinSystemWin32::Register(resource); }
67  void Unregister(IDispResource* resource) override { CWinSystemWin32::Unregister(resource); }
68 
69  void FixRefreshRateIfNecessary(const D3D10DDIARG_CREATERESOURCE* pResource) const;
70 
71  // HDR OS/display override
72  bool IsHDRDisplay() override;
73  HDR_STATUS ToggleHDR() override;
74  HDR_STATUS GetOSHDRStatus() override;
75 
76  // HDR support
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;
81 
82  // Get debug info from swapchain
84 
85  bool SupportsVideoSuperResolution() override;
86 
87 protected:
88  void SetDeviceFullScreen(bool fullScreen, RESOLUTION_INFO& res) override;
89  void ReleaseBackBuffer() override;
90  void CreateBackBuffer() override;
91  void ResizeDeviceBuffers() override;
92  bool IsStereoEnabled() override;
93  void OnScreenChange(HMONITOR monitor) override;
94  bool ChangeResolution(const RESOLUTION_INFO& res, bool forceChange = false) override;
95 
96  HMODULE m_hDriverModule;
97 };
98 
void Unregister(ID3DResource *resource) const
Unregister as a dependent of the DirectX Render System Resources should call this on destruction if t...
Definition: WinSystemWin32DX.h:61
void * GetHWContext() override
Get OS specific hardware context.
Definition: WinSystemWin32DX.h:36
DEBUG_INFO_RENDER GetDebugInfo() override
Gets debug info from video renderer for use in "Debug Info OSD" (Alt + O)
Definition: WinSystemWin32DX.cpp:439
Definition: RenderSystemDX.h:25
Definition: WinSystemWin32DX.h:17
Definition: RenderSystem.h:27
Definition: DispResource.h:14
Provide info of a resolution.
Definition: Resolution.h:66
void Register(ID3DResource *resource) const
Register as a dependent of the DirectX Render System Resources should call this on construction if th...
Definition: WinSystemWin32DX.h:52
Definition: WinSystemWin32.h:76
Definition: DebugInfo.h:30
Definition: D3DResource.h:36
bool SupportsVideoSuperResolution() override
System supports Video Super Resolution HW upscaler i.e.: "NVIDIA RTX Video Super Resolution" or "Inte...
Definition: WinSystemWin32DX.cpp:444