summaryrefslogtreecommitdiffstats
path: root/src/qtdiag/qtdiag.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qtdiag/qtdiag.cpp')
-rw-r--r--src/qtdiag/qtdiag.cpp160
1 files changed, 159 insertions, 1 deletions
diff --git a/src/qtdiag/qtdiag.cpp b/src/qtdiag/qtdiag.cpp
index 9d45a9ee5..4fc288cd7 100644
--- a/src/qtdiag/qtdiag.cpp
+++ b/src/qtdiag/qtdiag.cpp
@@ -74,6 +74,21 @@
#include <qpa/qplatformnativeinterface.h>
#include <private/qhighdpiscaling_p.h>
+#include <QtGui/private/qrhi_p.h>
+#include <QtGui/QOffscreenSurface>
+#if QT_CONFIG(opengl)
+# include <QtGui/private/qrhigles2_p.h>
+#endif
+#if QT_CONFIG(vulkan)
+# 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
+
#ifdef QT_WIDGETS_LIB
# include <QtWidgets/QStyleFactory>
#endif
@@ -258,6 +273,142 @@ void dumpVkInfo(QTextStream &str)
}
#endif // vulkan
+void dumpRhiBackendInfo(QTextStream &str, const char *name, QRhi::Implementation impl, QRhiInitParams *initParams)
+{
+ struct RhiFeature {
+ const char *name;
+ QRhi::Feature val;
+ };
+ const RhiFeature features[] = {
+ { "MultisampleTexture", QRhi::MultisampleTexture },
+ { "MultisampleRenderBuffer", QRhi::MultisampleRenderBuffer },
+ { "DebugMarkers", QRhi::DebugMarkers },
+ { "Timestamps", QRhi::Timestamps },
+ { "Instancing", QRhi::Instancing },
+ { "CustomInstanceStepRate", QRhi::CustomInstanceStepRate },
+ { "PrimitiveRestart", QRhi::PrimitiveRestart },
+ { "NonDynamicUniformBuffers", QRhi::NonDynamicUniformBuffers },
+ { "NonFourAlignedEffectiveIndexBufferOffset", QRhi::NonFourAlignedEffectiveIndexBufferOffset },
+ { "NPOTTextureRepeat", QRhi::NPOTTextureRepeat },
+ { "RedOrAlpha8IsRed", QRhi::RedOrAlpha8IsRed },
+ { "ElementIndexUint", QRhi::ElementIndexUint },
+ { "Compute", QRhi::Compute },
+ { "WideLines", QRhi::WideLines },
+ { "VertexShaderPointSize", QRhi::VertexShaderPointSize },
+ { "BaseVertex", QRhi::BaseVertex },
+ { "BaseInstance", QRhi::BaseInstance },
+ { "TriangleFanTopology", QRhi::TriangleFanTopology },
+ { "ReadBackNonUniformBuffer", QRhi::ReadBackNonUniformBuffer },
+ { "ReadBackNonBaseMipLevel", QRhi::ReadBackNonBaseMipLevel },
+ { nullptr, QRhi::Feature(0) }
+ };
+ struct RhiTextureFormat {
+ const char *name;
+ QRhiTexture::Format val;
+ };
+ const RhiTextureFormat textureFormats[] = {
+ { "RGBA8", QRhiTexture::RGBA8 },
+ { "BGRA8", QRhiTexture::BGRA8 },
+ { "R8", QRhiTexture::R8 },
+ { "R16", QRhiTexture::R16 },
+ { "RED_OR_ALPHA8", QRhiTexture::RED_OR_ALPHA8 },
+ { "RGBA16F", QRhiTexture::RGBA16F },
+ { "RGBA32F", QRhiTexture::RGBA32F },
+ { "R16F", QRhiTexture::R16F },
+ { "R32F", QRhiTexture::R32F },
+ { "D16", QRhiTexture::D16 },
+ { "D32F", QRhiTexture::D32F },
+ { "BC1", QRhiTexture::BC1 },
+ { "BC2", QRhiTexture::BC2 },
+ { "BC3", QRhiTexture::BC3 },
+ { "BC4", QRhiTexture::BC4 },
+ { "BC5", QRhiTexture::BC5 },
+ { "BC6H", QRhiTexture::BC6H },
+ { "BC7", QRhiTexture::BC7 },
+ { "ETC2_RGB8", QRhiTexture::ETC2_RGB8 },
+ { "ETC2_RGB8A1", QRhiTexture::ETC2_RGB8A1 },
+ { "ETC2_RGBA8", QRhiTexture::ETC2_RGBA8 },
+ { "ASTC_4x4", QRhiTexture::ASTC_4x4 },
+ { "ASTC_5x4", QRhiTexture::ASTC_5x4 },
+ { "ASTC_5x5", QRhiTexture::ASTC_5x5 },
+ { "ASTC_6x5", QRhiTexture::ASTC_6x5 },
+ { "ASTC_6x6", QRhiTexture::ASTC_6x6 },
+ { "ASTC_8x5", QRhiTexture::ASTC_8x5 },
+ { "ASTC_8x6", QRhiTexture::ASTC_8x6 },
+ { "ASTC_8x8", QRhiTexture::ASTC_8x8 },
+ { "ASTC_10x5", QRhiTexture::ASTC_10x5 },
+ { "ASTC_10x6", QRhiTexture::ASTC_10x6 },
+ { "ASTC_10x8", QRhiTexture::ASTC_10x8 },
+ { "ASTC_10x10", QRhiTexture::ASTC_10x10 },
+ { "ASTC_12x10", QRhiTexture::ASTC_12x10 },
+ { "ASTC_12x12", QRhiTexture::ASTC_12x12 },
+ { nullptr, QRhiTexture::UnknownFormat }
+ };
+
+ QScopedPointer<QRhi> rhi(QRhi::create(impl, initParams, QRhi::Flags(), nullptr));
+ if (rhi) {
+ str << name << ":\n";
+ str << " Min Texture Size: " << rhi->resourceLimit(QRhi::TextureSizeMin) << "\n";
+ str << " Max Texture Size: " << rhi->resourceLimit(QRhi::TextureSizeMax) << "\n";
+ str << " Max Color Attachments: " << rhi->resourceLimit(QRhi::MaxColorAttachments) << "\n";
+ str << " Frames in Flight: " << rhi->resourceLimit(QRhi::FramesInFlight) << "\n";
+ str << " Uniform Buffer Alignment: " << rhi->ubufAlignment() << "\n";
+ QByteArrayList supportedSampleCounts;
+ for (int s : rhi->supportedSampleCounts())
+ supportedSampleCounts << QByteArray::number(s);
+ str << " Supported MSAA sample counts: " << supportedSampleCounts.join(',') << "\n";
+ str << " Features:\n";
+ for (int i = 0; features[i].name; i++) {
+ str << " " << (rhi->isFeatureSupported(features[i].val) ? "v" : "-") << " " << features[i].name << "\n";
+ }
+ str << " Texture formats:";
+ for (int i = 0; textureFormats[i].name; i++) {
+ if (rhi->isTextureFormatSupported(textureFormats[i].val))
+ str << " " << textureFormats[i].name;
+ }
+ str << "\n";
+ }
+}
+
+void dumpRhiInfo(QTextStream &str)
+{
+ str << "Qt Rendering Hardware Interface supported backends:\n";
+
+#if QT_CONFIG(opengl)
+ {
+ QRhiGles2InitParams params;
+ params.fallbackSurface = QRhiGles2InitParams::newFallbackSurface();
+ dumpRhiBackendInfo(str, "OpenGL (with default QSurfaceFormat)", QRhi::OpenGLES2, &params);
+ delete params.fallbackSurface;
+ }
+#endif
+
+#if QT_CONFIG(vulkan)
+ {
+ QVulkanInstance vulkanInstance;
+ vulkanInstance.create();
+ QRhiVulkanInitParams params;
+ params.inst = &vulkanInstance;
+ dumpRhiBackendInfo(str, "Vulkan", QRhi::Vulkan, &params);
+ vulkanInstance.destroy();
+ }
+#endif
+
+#ifdef Q_OS_WIN
+ {
+ QRhiD3D11InitParams params;
+ dumpRhiBackendInfo(str, "Direct3D 11", QRhi::D3D11, &params);
+ }
+#endif
+
+#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+ {
+ QRhiMetalInitParams params;
+ dumpRhiBackendInfo(str, "Metal", QRhi::Metal, &params);
+ }
+#endif
+}
+
#define DUMP_CAPABILITY(str, integration, capability) \
if (platformIntegration->hasCapability(QPlatformIntegration::capability)) \
str << ' ' << #capability;
@@ -663,7 +814,7 @@ QString qtDiag(unsigned flags)
#ifndef QT_NO_OPENGL
if (flags & QtDiagGl) {
dumpGlInfo(str, flags & QtDiagGlExtensions);
- str << "\n\n";
+ str << "\n";
}
#else
Q_UNUSED(flags);
@@ -687,8 +838,15 @@ QString qtDiag(unsigned flags)
if (!description.isEmpty())
str << "\nGPU #" << (i + 1) << ":\n" << description << '\n';
}
+ str << "\n";
}
}
+
+ if (flags & QtDiagRhi) {
+ dumpRhiInfo(str);
+ str << "\n";
+ }
+
return result;
}