summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-08-02 13:07:31 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2022-08-04 14:53:28 +0200
commite00e215e006374a2b8e232c413de75e4d6504f5b (patch)
tree06f2d92b97710aef38a40acfce6fba5fc1ff4803 /src
parent9cbdc0f14c3c6382f5c31c9b4e39cdb0b2000c4c (diff)
rhi: vulkan: Enable all but one of the 1.0 core features
VkPhysicalDeviceVulkan11Features and co. need to be considered separately, for now we just sync the enabling of 1.0 core features between QVulkanWindow and QRhi, both in 5.15 and 6.x. For QRhi in Qt 6 this will need to be amended separately once the myriads of 1.1/1.2/1.3 features are investigated. Like everywhere else, robustBufferAccess is disabled. We do not want features that likely affect performance. To be checked later on if adding some sort of opt-in mechanism for this is sensible or not. Task-number: QTBUG-105158 Pick-to: 6.4 Change-Id: Ia3d8c1e6bb8be8643e80178954dca0aa8b92d3c0 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/gui/rhi/qrhivulkan.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index df721eb3a0..c53dcc9a0b 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -583,24 +583,22 @@ bool QRhiVulkan::create(QRhi::Flags flags)
devInfo.enabledExtensionCount = uint32_t(requestedDevExts.count());
devInfo.ppEnabledExtensionNames = requestedDevExts.constData();
+ // Enable all 1.0 core features that are reported as supported, except
+ // robustness because that potentially affects performance.
+ //
+ // Enabling all features mainly serves third-party renderers that may
+ // use the VkDevice created here. For the record, the backend here
+ // optionally relies on the following features, meaning just for our
+ // (QRhi/Quick/Quick 3D) purposes it would be sufficient to
+ // enable-if-supported only the following:
+ //
+ // wideLines, largePoints, fillModeNonSolid,
+ // tessellationShader, geometryShader
+ // textureCompressionETC2, textureCompressionASTC_LDR, textureCompressionBC
+
VkPhysicalDeviceFeatures features;
- memset(&features, 0, sizeof(features));
- if (physDevFeatures.wideLines)
- features.wideLines = VK_TRUE;
- if (physDevFeatures.largePoints)
- features.largePoints = VK_TRUE;
- if (physDevFeatures.tessellationShader)
- features.tessellationShader = VK_TRUE;
- if (physDevFeatures.textureCompressionETC2)
- features.textureCompressionETC2 = VK_TRUE;
- if (physDevFeatures.textureCompressionASTC_LDR)
- features.textureCompressionASTC_LDR = VK_TRUE;
- if (physDevFeatures.textureCompressionBC)
- features.textureCompressionBC = VK_TRUE;
- if (physDevFeatures.geometryShader)
- features.geometryShader = VK_TRUE;
- if (physDevFeatures.fillModeNonSolid)
- features.fillModeNonSolid = VK_TRUE;
+ memcpy(&features, &physDevFeatures, sizeof(features));
+ features.robustBufferAccess = VK_FALSE;
devInfo.pEnabledFeatures = &features;
VkResult err = f->vkCreateDevice(physDev, &devInfo, nullptr, &dev);