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 VkDeviceQueueCreateFlags gfxQueueFlags = 0;
91 // and optionally, the mem allocator
92 void *vmemAllocator = nullptr;
93
94 // only for querying (rhi->nativeHandles())
95 VkQueue gfxQueue = VK_NULL_HANDLE;
96 QVulkanInstance *inst = nullptr;
97};
98
99struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHandles
100{
101 VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
102};
103
104struct Q_GUI_EXPORT QRhiVulkanRenderPassNativeHandles : public QRhiNativeHandles
105{
106 VkRenderPass renderPass = VK_NULL_HANDLE;
107};
108
109struct Q_GUI_EXPORT QRhiVulkanQueueSubmitParams : public QRhiNativeHandles
110{
111 uint32_t waitSemaphoreCount;
112 VkSemaphore *waitSemaphores;
113 uint32_t signalSemaphoreCount;
114 VkSemaphore *signalSemaphores;
115 uint32_t presentWaitSemaphoreCount;
116 VkSemaphore *presentWaitSemaphores;
117};
118
119#endif // vulkan/qdoc
120
121#if defined(Q_OS_WIN) || defined(Q_QDOC)
122
123// no d3d includes here, to prevent precompiled header mess due to COM, hence the void pointers
124
125struct Q_GUI_EXPORT QRhiD3D11InitParams : public QRhiInitParams
126{
127 bool enableDebugLayer = false;
128};
129
130struct Q_GUI_EXPORT QRhiD3D11NativeHandles : public QRhiNativeHandles
131{
132 // to import a device and a context
133 void *dev = nullptr;
134 void *context = nullptr;
135 // alternatively, to specify the device feature level and/or the adapter to use
136 int featureLevel = 0;
137 quint32 adapterLuidLow = 0;
138 qint32 adapterLuidHigh = 0;
139};
140
141struct Q_GUI_EXPORT QRhiD3D12InitParams : public QRhiInitParams
142{
143 bool enableDebugLayer = false;
144};
145
146struct Q_GUI_EXPORT QRhiD3D12NativeHandles : public QRhiNativeHandles
147{
148 // to import a device
149 void *dev = nullptr;
150 int minimumFeatureLevel = 0;
151 // to just specify the adapter to use, set these and leave dev set to null
152 quint32 adapterLuidLow = 0;
153 qint32 adapterLuidHigh = 0;
154 // in addition, can specify the command queue to use
155 void *commandQueue = nullptr;
156};
157
158struct Q_GUI_EXPORT QRhiD3D12CommandBufferNativeHandles : public QRhiNativeHandles
159{
160 void *commandList = nullptr; // ID3D12GraphicsCommandList1
161};
162
163#endif // WIN/QDOC
164
165#if QT_CONFIG(metal) || defined(Q_QDOC)
166
167struct Q_GUI_EXPORT QRhiMetalInitParams : public QRhiInitParams
168{
169};
170
171struct Q_GUI_EXPORT QRhiMetalNativeHandles : public QRhiNativeHandles
172{
173 MTLDevice *dev = nullptr;
174 MTLCommandQueue *cmdQueue = nullptr;
175};
176
177struct Q_GUI_EXPORT QRhiMetalCommandBufferNativeHandles : public QRhiNativeHandles
178{
179 MTLCommandBuffer *commandBuffer = nullptr;
180 MTLRenderCommandEncoder *encoder = nullptr;
181};
182
183#endif // MACOS/IOS/QDOC
184
185QT_END_NAMESPACE
186
187#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:815
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:826
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1890
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:861
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:578
\variable QRhiIndexedIndirectDrawCommand::indexCount
Definition qrhi.h:1727
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:46
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1315
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:787
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1123
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1187
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1203
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1818
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:818
\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:1218
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1600
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:749
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:622
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1229
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:666
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:726
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:703
\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:1901
\inmodule QtGui
Definition qshader.h:60
\inmodule QtGui
Definition qshader.h:181
\inmodule QtGui
Definition qshader.h:28
\inmodule QtGui
Definition qshader.h:81
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:2618
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:229
Q_GUI_EXPORT bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) noexcept
bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
Definition qshader.h:224
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:1849
\variable QRhiIndirectDrawCommand::vertexCount
Definition qrhi.h:1714
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1897
\variable QRhiReadbackResult::completed
Definition qrhi.h:814
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1872
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1562
LuminanceBehavior
\value SceneReferred Indicates that the color value of 1.0 is interpreted as 80 nits.
Definition qrhi.h:1568
LimitsType limitsType
Definition qrhi.h:1573
float maxPotentialColorComponentValue
Definition qrhi.h:1581
LimitsType
\value LuminanceInNits Indicates that the \l limits union has its luminanceInNits struct set
Definition qrhi.h:1563
LuminanceBehavior luminanceBehavior
Definition qrhi.h:1584
float maxColorComponentValue
Definition qrhi.h:1580
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1595
void * reserved[2]
Definition qrhi.h:1596