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
4#ifndef QRHIPLATFORM_H
5#define QRHIPLATFORM_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the RHI API, with limited compatibility guarantees.
12// Usage of this API may make your code source and binary incompatible with
13// future versions of Qt.
14//
15
16#include <rhi/qrhi.h>
17
18#if QT_CONFIG(opengl)
19#include <QtGui/qsurfaceformat.h>
20#endif
21
22#if QT_CONFIG(vulkan)
23#include <QtGui/qvulkaninstance.h>
24#endif
25
26#if QT_CONFIG(metal) || defined(Q_QDOC)
27Q_FORWARD_DECLARE_OBJC_CLASS(MTLDevice);
28Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandQueue);
29Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandBuffer);
30Q_FORWARD_DECLARE_OBJC_CLASS(MTLRenderCommandEncoder);
31#endif
32
33QT_BEGIN_NAMESPACE
34
35struct Q_GUI_EXPORT QRhiNullInitParams : public QRhiInitParams
36{
37};
38
39struct Q_GUI_EXPORT QRhiNullNativeHandles : public QRhiNativeHandles
40{
41};
42
43#if QT_CONFIG(opengl) || defined(Q_QDOC)
44
45class QOpenGLContext;
46class QOffscreenSurface;
47class QSurface;
48class QWindow;
49
50struct Q_GUI_EXPORT QRhiGles2InitParams : public QRhiInitParams
51{
52 QRhiGles2InitParams();
53
54 QSurfaceFormat format;
55 QSurface *fallbackSurface = nullptr;
56 QWindow *window = nullptr;
57 QOpenGLContext *shareContext = nullptr;
58
59 static QOffscreenSurface *newFallbackSurface(const QSurfaceFormat &format = QSurfaceFormat::defaultFormat());
60};
61
62struct Q_GUI_EXPORT QRhiGles2NativeHandles : public QRhiNativeHandles
63{
64 QOpenGLContext *context = nullptr;
65};
66
67#endif // opengl/qdoc
68
69#if (QT_CONFIG(vulkan) && __has_include(<vulkan/vulkan.h>)) || defined(Q_QDOC)
70
71struct Q_GUI_EXPORT QRhiVulkanInitParams : public QRhiInitParams
72{
73 QVulkanInstance *inst = nullptr;
74 QWindow *window = nullptr;
75 QByteArrayList deviceExtensions;
76
77 static QByteArrayList preferredInstanceExtensions();
78 static QByteArrayList preferredExtensionsForImportedDevice();
79};
80
81struct Q_GUI_EXPORT QRhiVulkanNativeHandles : public QRhiNativeHandles
82{
83 // to import a physical device (always required)
84 VkPhysicalDevice physDev = VK_NULL_HANDLE;
85 // to import a device and queue
86 VkDevice dev = VK_NULL_HANDLE;
87 quint32 gfxQueueFamilyIdx = 0;
88 quint32 gfxQueueIdx = 0;
89 // and optionally, the mem allocator
90 void *vmemAllocator = nullptr;
91
92 // only for querying (rhi->nativeHandles())
93 VkQueue gfxQueue = VK_NULL_HANDLE;
94 QVulkanInstance *inst = nullptr;
95};
96
97struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHandles
98{
99 VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
100};
101
102struct Q_GUI_EXPORT QRhiVulkanRenderPassNativeHandles : public QRhiNativeHandles
103{
104 VkRenderPass renderPass = VK_NULL_HANDLE;
105};
106
107struct Q_GUI_EXPORT QRhiVulkanQueueSubmitParams : public QRhiNativeHandles
108{
109 uint32_t waitSemaphoreCount;
110 VkSemaphore *waitSemaphores;
111 uint32_t signalSemaphoreCount;
112 VkSemaphore *signalSemaphores;
113 uint32_t presentWaitSemaphoreCount;
114 VkSemaphore *presentWaitSemaphores;
115};
116
117#endif // vulkan/qdoc
118
119#if defined(Q_OS_WIN) || defined(Q_QDOC)
120
121// no d3d includes here, to prevent precompiled header mess due to COM, hence the void pointers
122
123struct Q_GUI_EXPORT QRhiD3D11InitParams : public QRhiInitParams
124{
125 bool enableDebugLayer = false;
126};
127
128struct Q_GUI_EXPORT QRhiD3D11NativeHandles : public QRhiNativeHandles
129{
130 // to import a device and a context
131 void *dev = nullptr;
132 void *context = nullptr;
133 // alternatively, to specify the device feature level and/or the adapter to use
134 int featureLevel = 0;
135 quint32 adapterLuidLow = 0;
136 qint32 adapterLuidHigh = 0;
137};
138
139struct Q_GUI_EXPORT QRhiD3D12InitParams : public QRhiInitParams
140{
141 bool enableDebugLayer = false;
142};
143
144struct Q_GUI_EXPORT QRhiD3D12NativeHandles : public QRhiNativeHandles
145{
146 // to import a device
147 void *dev = nullptr;
148 int minimumFeatureLevel = 0;
149 // to just specify the adapter to use, set these and leave dev set to null
150 quint32 adapterLuidLow = 0;
151 qint32 adapterLuidHigh = 0;
152 // in addition, can specify the command queue to use
153 void *commandQueue = nullptr;
154};
155
156struct Q_GUI_EXPORT QRhiD3D12CommandBufferNativeHandles : public QRhiNativeHandles
157{
158 void *commandList = nullptr; // ID3D12GraphicsCommandList1
159};
160
161#endif // WIN/QDOC
162
163#if QT_CONFIG(metal) || defined(Q_QDOC)
164
165struct Q_GUI_EXPORT QRhiMetalInitParams : public QRhiInitParams
166{
167};
168
169struct Q_GUI_EXPORT QRhiMetalNativeHandles : public QRhiNativeHandles
170{
171 MTLDevice *dev = nullptr;
172 MTLCommandQueue *cmdQueue = nullptr;
173};
174
175struct Q_GUI_EXPORT QRhiMetalCommandBufferNativeHandles : public QRhiNativeHandles
176{
177 MTLCommandBuffer *commandBuffer = nullptr;
178 MTLRenderCommandEncoder *encoder = nullptr;
179};
180
181#endif // MACOS/IOS/QDOC
182
183QT_END_NAMESPACE
184
185#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:801
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:812
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1848
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:856
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:577
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:45
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1309
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:782
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1117
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1181
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1197
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1776
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:813
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:139
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:440
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:380
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1212
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1589
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:744
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:621
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1223
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:661
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:721
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:698
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:233
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:180
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:322
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:86
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1859
\inmodule QtGui
Definition qshader.h:60
\inmodule QtGui
Definition qshader.h:179
\inmodule QtGui
Definition qshader.h:32
\inmodule QtGui
Definition qshader.h:81
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
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:227
Q_GUI_EXPORT bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) noexcept
bool operator!=(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
Definition qshader.h:222
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:1807
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1855
\variable QRhiReadbackResult::completed
Definition qrhi.h:809
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1830
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1551
LuminanceBehavior
\value SceneReferred Indicates that the color value of 1.0 is interpreted as 80 nits.
Definition qrhi.h:1557
LimitsType limitsType
Definition qrhi.h:1562
float maxPotentialColorComponentValue
Definition qrhi.h:1570
LimitsType
\value LuminanceInNits Indicates that the \l limits union has its luminanceInNits struct set
Definition qrhi.h:1552
LuminanceBehavior luminanceBehavior
Definition qrhi.h:1573
float maxColorComponentValue
Definition qrhi.h:1569
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1584
void * reserved[2]
Definition qrhi.h:1585