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>
bb10
Laszlo Agocs 2022-08-02 13:07:31 +02:00
parent 9cbdc0f14c
commit e00e215e00
1 changed files with 15 additions and 17 deletions

View File

@ -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);