summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/rhioffscreen/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/doc/snippets/rhioffscreen/main.cpp')
-rw-r--r--src/gui/doc/snippets/rhioffscreen/main.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/doc/snippets/rhioffscreen/main.cpp b/src/gui/doc/snippets/rhioffscreen/main.cpp
index b3fac4b520..c2c6f74dc1 100644
--- a/src/gui/doc/snippets/rhioffscreen/main.cpp
+++ b/src/gui/doc/snippets/rhioffscreen/main.cpp
@@ -11,15 +11,17 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
+#if QT_CONFIG(vulkan)
+ QVulkanInstance inst;
+#endif
std::unique_ptr<QRhi> rhi;
#if defined(Q_OS_WIN)
QRhiD3D12InitParams params;
rhi.reset(QRhi::create(QRhi::D3D12, &params));
-#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#elif QT_CONFIG(metal)
QRhiMetalInitParams params;
rhi.reset(QRhi::create(QRhi::Metal, &params));
#elif QT_CONFIG(vulkan)
- QVulkanInstance inst;
inst.setExtensions(QRhiVulkanInitParams::preferredInstanceExtensions());
if (inst.create()) {
QRhiVulkanInitParams params;
@@ -82,9 +84,7 @@ int main(int argc, char **argv)
ps->setTargetBlends({ premulAlphaBlend });
static auto getShader = [](const QString &name) {
QFile f(name);
- if (f.open(QIODevice::ReadOnly))
- return QShader::fromSerialized(f.readAll());
- return QShader();
+ return f.open(QIODevice::ReadOnly) ? QShader::fromSerialized(f.readAll()) : QShader();
};
ps->setShaderStages({
{ QRhiShaderStage::Vertex, getShader(QLatin1String("color.vert.qsb")) },