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