Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdxgihdrinfo_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDXGIHDRINFO_P_H
5#define QDXGIHDRINFO_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/qwindow.h>
19#include <rhi/qrhi.h>
20
21#include <dxgi1_6.h>
22
24
25class Q_GUI_EXPORT QDxgiHdrInfo
26{
27public:
28 // When already having an adapter, i.e. in a D3D11/12 backend of QRhi; this
29 // is very cheap to construct.
30 QDxgiHdrInfo(IDXGIAdapter1 *adapter);
31
32 // When having the adapter LUID from somewhere (e.g.
33 // VkPhysicalDeviceIDProperties::deviceLUID); This has to create a DXGI
34 // factory and enumarate to find the matching IDXGIAdapter, so less cheap.
35 QDxgiHdrInfo(LUID luid);
36
37 // All functions below will enumerate all adapters and all their outputs
38 // every time they are called. Probably not nice. Use when there is no
39 // knowledge which GPUs will be used with QRhi.
40 QDxgiHdrInfo();
41
42 ~QDxgiHdrInfo();
43
44 // True if the window belongs to an output where HDR is enabled. Moving a
45 // window to another screen may make this function return a different value.
46 //
47 // If/how DXGI outputs map to screens, is out of our hands, but they will
48 // typically match. However, this will not be functional when WARP is used
49 // since the WARP adapter never has any outputs associated (even though
50 // there are certainly screens still).
51 //
52 bool isHdrCapable(QWindow *w);
53
54 // HDR info and white level. Or default, dummy values when the window is not
55 // on a HDR-enabled output.
56 QRhiSwapChainHdrInfo queryHdrInfo(QWindow *w);
57
58private:
59 static bool output6ForWindow(QWindow *w, IDXGIAdapter1 *adapter, IDXGIOutput6 **result);
60 static bool outputDesc1ForWindow(QWindow *w, IDXGIAdapter1 *adapter, DXGI_OUTPUT_DESC1 *result);
61 static float sdrWhiteLevelInNits(const DXGI_OUTPUT_DESC1 &outputDesc);
62
63 IDXGIFactory2 *m_factory = nullptr;
64 IDXGIAdapter1 *m_adapter = nullptr;
65};
66
67QT_END_NAMESPACE
68
69#endif