vulkan: Add flag to opt out from enumerating Portability phys.devices
Task-number: QTBUG-106912 Change-Id: I1cb4adae4bed62f31d781a89a03b70885411f91f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
parent
7fbc741d10
commit
b018bc6e2d
@ -217,7 +217,8 @@ void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_enabledExtensions.append("VK_KHR_surface");
|
m_enabledExtensions.append("VK_KHR_surface");
|
||||||
m_enabledExtensions.append("VK_KHR_portability_enumeration");
|
if (!flags.testFlag(QVulkanInstance::NoPortabilityDrivers))
|
||||||
|
m_enabledExtensions.append("VK_KHR_portability_enumeration");
|
||||||
if (!flags.testFlag(QVulkanInstance::NoDebugOutputRedirect))
|
if (!flags.testFlag(QVulkanInstance::NoDebugOutputRedirect))
|
||||||
m_enabledExtensions.append("VK_EXT_debug_utils");
|
m_enabledExtensions.append("VK_EXT_debug_utils");
|
||||||
|
|
||||||
@ -258,7 +259,8 @@ void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const
|
|||||||
VkInstanceCreateInfo instInfo = {};
|
VkInstanceCreateInfo instInfo = {};
|
||||||
instInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
instInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
instInfo.pApplicationInfo = &appInfo;
|
instInfo.pApplicationInfo = &appInfo;
|
||||||
instInfo.flags = 0x00000001; // VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR
|
if (!flags.testFlag(QVulkanInstance::NoPortabilityDrivers))
|
||||||
|
instInfo.flags |= 0x00000001; // VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR
|
||||||
|
|
||||||
QList<const char *> layerNameVec;
|
QList<const char *> layerNameVec;
|
||||||
for (const QByteArray &ba : qAsConst(m_enabledLayers))
|
for (const QByteArray &ba : qAsConst(m_enabledLayers))
|
||||||
|
@ -206,6 +206,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
the behavior of create().
|
the behavior of create().
|
||||||
|
|
||||||
\value NoDebugOutputRedirect Disables Vulkan debug output (\c{VK_EXT_debug_utils}) redirection to qDebug.
|
\value NoDebugOutputRedirect Disables Vulkan debug output (\c{VK_EXT_debug_utils}) redirection to qDebug.
|
||||||
|
\value NoPortabilityDrivers Disables enumerating physical devices marked as Vulkan Portability.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QVulkanInstancePrivate::ensureVulkan()
|
bool QVulkanInstancePrivate::ensureVulkan()
|
||||||
@ -484,7 +485,8 @@ void QVulkanInstance::setLayers(const QByteArrayList &layers)
|
|||||||
VK_KHR_win32_surface) will always be added automatically, no need to
|
VK_KHR_win32_surface) will always be added automatically, no need to
|
||||||
include them in this list.
|
include them in this list.
|
||||||
|
|
||||||
\note \c VK_KHR_portability_enumeration is added automatically.
|
\note \c VK_KHR_portability_enumeration is added automatically unless the
|
||||||
|
NoPortabilityDrivers flag is set. This value was introduced in Qt 6.5.
|
||||||
|
|
||||||
\note This function can only be called before create() and has no effect if
|
\note This function can only be called before create() and has no effect if
|
||||||
called afterwards.
|
called afterwards.
|
||||||
@ -543,9 +545,10 @@ void QVulkanInstance::setApiVersion(const QVersionNumber &vulkanVersion)
|
|||||||
The Vulkan instance and library is available as long as this
|
The Vulkan instance and library is available as long as this
|
||||||
QVulkanInstance exists, or until destroy() is called.
|
QVulkanInstance exists, or until destroy() is called.
|
||||||
|
|
||||||
The VkInstance is always created with the flag
|
By default the VkInstance is created with the flag
|
||||||
\l{https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkInstanceCreateFlagBits.html}{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR}
|
\l{https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkInstanceCreateFlagBits.html}{VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR}
|
||||||
set. This means that Vulkan Portability physical devices get enumerated as well.
|
set. This means that Vulkan Portability physical devices get enumerated as
|
||||||
|
well. If this is not desired, set the NoPortabilityDrivers flag.
|
||||||
*/
|
*/
|
||||||
bool QVulkanInstance::create()
|
bool QVulkanInstance::create()
|
||||||
{
|
{
|
||||||
|
@ -135,7 +135,8 @@ public:
|
|||||||
~QVulkanInstance();
|
~QVulkanInstance();
|
||||||
|
|
||||||
enum Flag {
|
enum Flag {
|
||||||
NoDebugOutputRedirect = 0x01
|
NoDebugOutputRedirect = 0x01,
|
||||||
|
NoPortabilityDrivers = 0x02
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(Flags, Flag)
|
Q_DECLARE_FLAGS(Flags, Flag)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user