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
qrhi_platform.h
Go to the documentation of this file.
1// Copyright (C) 2023 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 QRHIPLATFORM_H
6#define QRHIPLATFORM_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is part of the RHI API, with limited compatibility guarantees.
13// Usage of this API may make your code source and binary incompatible with
14// future versions of Qt.
15//
16
17#include <rhi/qrhi.h>
18
19#if QT_CONFIG(opengl)
20#include <QtGui/qsurfaceformat.h>
21#endif
22
23#if QT_CONFIG(vulkan)
24#include <QtGui/qvulkaninstance.h>
25#endif
26
27#if QT_CONFIG(metal) || defined(Q_QDOC)
28Q_FORWARD_DECLARE_OBJC_CLASS(MTLDevice);
29Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandQueue);
30Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandBuffer);
31Q_FORWARD_DECLARE_OBJC_CLASS(MTLRenderCommandEncoder);
32#endif
33
34QT_BEGIN_NAMESPACE
35
36struct Q_GUI_EXPORT QRhiNullInitParams : public QRhiInitParams
37{
38};
39
40struct Q_GUI_EXPORT QRhiNullNativeHandles : public QRhiNativeHandles
41{
42};
43
44#if QT_CONFIG(opengl) || defined(Q_QDOC)
45
46class QOpenGLContext;
47class QOffscreenSurface;
48class QSurface;
49class QWindow;
50
51struct Q_GUI_EXPORT QRhiGles2InitParams : public QRhiInitParams
52{
53 QRhiGles2InitParams();
54
55 QSurfaceFormat format;
56 QSurface *fallbackSurface = nullptr;
57 QWindow *window = nullptr;
58 QOpenGLContext *shareContext = nullptr;
59
60 static QOffscreenSurface *newFallbackSurface(const QSurfaceFormat &format = QSurfaceFormat::defaultFormat());
61};
62
63struct Q_GUI_EXPORT QRhiGles2NativeHandles : public QRhiNativeHandles
64{
65 QOpenGLContext *context = nullptr;
66};
67
68#endif // opengl/qdoc
69
70#if (QT_CONFIG(vulkan) && __has_include(<vulkan/vulkan.h>)) || defined(Q_QDOC)
71
72struct Q_GUI_EXPORT QRhiVulkanInitParams : public QRhiInitParams
73{
74 QVulkanInstance *inst = nullptr;
75 QWindow *window = nullptr;
76 QByteArrayList deviceExtensions;
77
78 static QByteArrayList preferredInstanceExtensions();
79 static QByteArrayList preferredExtensionsForImportedDevice();
80};
81
82struct Q_GUI_EXPORT QRhiVulkanNativeHandles : public QRhiNativeHandles
83{
84 // to import a physical device (always required)
85 VkPhysicalDevice physDev = VK_NULL_HANDLE;
86 // to import a device and queue
87 VkDevice dev = VK_NULL_HANDLE;
88 quint32 gfxQueueFamilyIdx = 0;
89 quint32 gfxQueueIdx = 0;
90 // and optionally, the mem allocator
91 void *vmemAllocator = nullptr;
92
93 // only for querying (rhi->nativeHandles())
94 VkQueue gfxQueue = VK_NULL_HANDLE;
95 QVulkanInstance *inst = nullptr;
96};
97
98struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHandles
99{
100 VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
101};
102
103struct Q_GUI_EXPORT QRhiVulkanRenderPassNativeHandles : public QRhiNativeHandles
104{
105 VkRenderPass renderPass = VK_NULL_HANDLE;
106};
107
108struct Q_GUI_EXPORT QRhiVulkanQueueSubmitParams : public QRhiNativeHandles
109{
110 uint32_t waitSemaphoreCount;
111 VkSemaphore *waitSemaphores;
112 uint32_t signalSemaphoreCount;
113 VkSemaphore *signalSemaphores;
114 uint32_t presentWaitSemaphoreCount;
115 VkSemaphore *presentWaitSemaphores;
116};
117
118#endif // vulkan/qdoc
119
120#if defined(Q_OS_WIN) || defined(Q_QDOC)
121
122// no d3d includes here, to prevent precompiled header mess due to COM, hence the void pointers
123
124struct Q_GUI_EXPORT QRhiD3D11InitParams : public QRhiInitParams
125{
126 bool enableDebugLayer = false;
127};
128
129struct Q_GUI_EXPORT QRhiD3D11NativeHandles : public QRhiNativeHandles
130{
131 // to import a device and a context
132 void *dev = nullptr;
133 void *context = nullptr;
134 // alternatively, to specify the device feature level and/or the adapter to use
135 int featureLevel = 0;
136 quint32 adapterLuidLow = 0;
137 qint32 adapterLuidHigh = 0;
138};
139
140struct Q_GUI_EXPORT QRhiD3D12InitParams : public QRhiInitParams
141{
142 bool enableDebugLayer = false;
143};
144
145struct Q_GUI_EXPORT QRhiD3D12NativeHandles : public QRhiNativeHandles
146{
147 // to import a device
148 void *dev = nullptr;
149 int minimumFeatureLevel = 0;
150 // to just specify the adapter to use, set these and leave dev set to null
151 quint32 adapterLuidLow = 0;
152 qint32 adapterLuidHigh = 0;
153 // in addition, can specify the command queue to use
154 void *commandQueue = nullptr;
155};
156
157struct Q_GUI_EXPORT QRhiD3D12CommandBufferNativeHandles : public QRhiNativeHandles
158{
159 void *commandList = nullptr; // ID3D12GraphicsCommandList1
160};
161
162#endif // WIN/QDOC
163
164#if QT_CONFIG(metal) || defined(Q_QDOC)
165
166struct Q_GUI_EXPORT QRhiMetalInitParams : public QRhiInitParams
167{
168};
169
170struct Q_GUI_EXPORT QRhiMetalNativeHandles : public QRhiNativeHandles
171{
172 MTLDevice *dev = nullptr;
173 MTLCommandQueue *cmdQueue = nullptr;
174};
175
176struct Q_GUI_EXPORT QRhiMetalCommandBufferNativeHandles : public QRhiNativeHandles
177{
178 MTLCommandBuffer *commandBuffer = nullptr;
179 MTLRenderCommandEncoder *encoder = nullptr;
180};
181
182#endif // MACOS/IOS/QDOC
183
184QT_END_NAMESPACE
185
186#endif
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
Definition qbytearray.h:807
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
Definition qbytearray.h:818
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1853
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:857
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:578
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:46
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1310
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:783
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1118
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1182
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1198
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1781
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:814
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:140
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:441
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:381
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1213
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1594
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:745
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:622
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1224
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:662
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:722
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:699
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:234
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:181
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:323
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:87
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1864
\inmodule QtGui
Definition qshader.h:61
\inmodule QtGui
Definition qshader.h:182
\inmodule QtGui
Definition qshader.h:33
\inmodule QtGui
Definition qshader.h:82
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2582
bool operator<(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
Q_DECLARE_TYPEINFO(QRhiSwapChainHdrInfo, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(QShaderKey, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(QShaderCode, Q_RELOCATABLE_TYPE)
Q_GUI_EXPORT bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs) noexcept
Definition qshader.h:230
Q_GUI_EXPORT bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) noexcept
bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
Definition qshader.h:225
Q_GUI_EXPORT bool operator<(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
int main(int argc, char *argv[])
[ctor_close]
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1812
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1860
\variable QRhiReadbackResult::completed
Definition qrhi.h:810
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1835
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1556
LuminanceBehavior
\value SceneReferred Indicates that the color value of 1.0 is interpreted as 80 nits.
Definition qrhi.h:1562
LimitsType limitsType
Definition qrhi.h:1567
float maxPotentialColorComponentValue
Definition qrhi.h:1575
LimitsType
\value LuminanceInNits Indicates that the \l limits union has its luminanceInNits struct set
Definition qrhi.h:1557
LuminanceBehavior luminanceBehavior
Definition qrhi.h:1578
float maxColorComponentValue
Definition qrhi.h:1574
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1589
void * reserved[2]
Definition qrhi.h:1590