summaryrefslogtreecommitdiffstats
path: root/tests/manual/rhi/multiwindow
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2023-04-27 13:16:29 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2023-05-21 15:42:58 +0200
commit1dd8b5ceec3a1cde987372a7f993c07f30e5af95 (patch)
tree53e8b96c8a2bf104573a45958329255a5abcd4d9 /tests/manual/rhi/multiwindow
parent30a8e79243084017d23f1c765d5f1cbb86564191 (diff)
rhi: Make it a QPA-style private but semi-public API
qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from shadertools; done separately) become "RHI APIs", following the concept of QPA APIs. Mirror completely what is done for QPA headers, but using the "rhi" prefix for the headers. This involves updating syncqt to handle the new category of headers. (a note on the regex: matching everything starting with "qrhi" is not acceptable due to incorrectly matching existing and future headers, hence specifying the four header names explicitly) There is going to be one difference to QPA: the documentation for everything RHI is going to be public and part of the regular docs, not hidden with \internal. In addition to the header renaming and adding the comments and documentation notes and warnings, there is one significant change here: there is no longer a need to do API-specific includes, such as qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a single header that is then included from qrhi.h. This means that users within Qt, and any future applications can just do #include <rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no other headers are needed. There are no changes to functionality in this patch. Only the documentation is expanded, quite a lot, to eliminate all qdoc warnings and make the generated API docs complete. An example, with a quite extensive doc page is added as well. Task-number: QTBUG-113331 Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/manual/rhi/multiwindow')
-rw-r--r--tests/manual/rhi/multiwindow/multiwindow.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/tests/manual/rhi/multiwindow/multiwindow.cpp b/tests/manual/rhi/multiwindow/multiwindow.cpp
index f25a68c621..7ff6644e26 100644
--- a/tests/manual/rhi/multiwindow/multiwindow.cpp
+++ b/tests/manual/rhi/multiwindow/multiwindow.cpp
@@ -13,33 +13,17 @@
#include <QWindow>
#include <QPlatformSurfaceEvent>
#include <QElapsedTimer>
-
-#include <QtGui/private/qshader_p.h>
#include <QFile>
-
-#ifndef QT_NO_OPENGL
-#include <QtGui/private/qrhigles2_p.h>
-#include <QOffscreenSurface>
-#endif
-
-#if QT_CONFIG(vulkan)
#include <QLoggingCategory>
-#include <QtGui/private/qrhivulkan_p.h>
-#endif
-
-#ifdef Q_OS_WIN
-#include <QtGui/private/qrhid3d11_p.h>
-#endif
-
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
-#include <QtGui/private/qrhimetal_p.h>
-#endif
+#include <QOffscreenSurface>
+#include <rhi/qrhi.h>
enum GraphicsApi
{
OpenGL,
Vulkan,
D3D11,
+ D3D12,
Metal
};
@@ -54,6 +38,8 @@ static QString graphicsApiName()
return QLatin1String("Vulkan");
case D3D11:
return QLatin1String("Direct3D 11");
+ case D3D12:
+ return QLatin1String("Direct3D 12");
case Metal:
return QLatin1String("Metal");
default:
@@ -98,6 +84,10 @@ void createRhi()
QRhiD3D11InitParams params;
params.enableDebugLayer = true;
r.r = QRhi::create(QRhi::D3D11, &params);
+ } else if (graphicsApi == D3D12) {
+ QRhiD3D12InitParams params;
+ params.enableDebugLayer = true;
+ r.r = QRhi::create(QRhi::D3D12, &params);
}
#endif
@@ -281,6 +271,7 @@ Window::Window(const QString &title, const QColor &bgColor, int axis, bool noVSy
#endif
break;
case D3D11:
+ case D3D12:
setSurfaceType(Direct3DSurface);
break;
case Metal:
@@ -494,6 +485,8 @@ int main(int argc, char **argv)
cmdLineParser.addOption(vkOption);
QCommandLineOption d3dOption({ "d", "d3d11" }, QLatin1String("Direct3D 11"));
cmdLineParser.addOption(d3dOption);
+ QCommandLineOption d3d12Option({ "D", "d3d12" }, QLatin1String("Direct3D 12"));
+ cmdLineParser.addOption(d3d12Option);
QCommandLineOption mtlOption({ "m", "metal" }, QLatin1String("Metal"));
cmdLineParser.addOption(mtlOption);
cmdLineParser.process(app);
@@ -503,6 +496,8 @@ int main(int argc, char **argv)
graphicsApi = Vulkan;
if (cmdLineParser.isSet(d3dOption))
graphicsApi = D3D11;
+ if (cmdLineParser.isSet(d3d12Option))
+ graphicsApi = D3D12;
if (cmdLineParser.isSet(mtlOption))
graphicsApi = Metal;
@@ -517,6 +512,7 @@ int main(int argc, char **argv)
r.instance = new QVulkanInstance;
if (graphicsApi == Vulkan) {
r.instance->setLayers({ "VK_LAYER_KHRONOS_validation" });
+ r.instance->setExtensions(QRhiVulkanInitParams::preferredInstanceExtensions());
if (!r.instance->create()) {
qWarning("Failed to create Vulkan instance, switching to OpenGL");
graphicsApi = OpenGL;