diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-03-18 19:35:52 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-04-18 05:00:57 +0200 |
commit | d5bf42f75b0ae35b7f02bb9211787ae1d44a98ba (patch) | |
tree | 3aa389137752dbe2bbaa7446e4ef0e2e1b8c55a5 /src/gui/rhi | |
parent | bf2ed624091d0239bce91a84df59b7afc843298a (diff) |
Add preliminary support for Qt for visionOS
Qt already runs on Vision Pro as "Designed for iPad", using Qt
for iOS. This change enables building Qt for visionOS directly,
which opens the door to visionOS specific APIs and use-cases
such as volumes and immersive spaces.
The platform removes some APIs we depend on, notably UIScreen,
so some code paths have been disabled or mocked to get something
up and running.
As our current window management approach on UIKit platforms
depends on UIWindow and UIScreen there is currently no way to
bring up QWindows. This will improve once we refactor our
window management to use window scenes.
To configure for visionOS, pass -platform macx-visionos-clang,
and optionally add -sdk xrsimulator to build for the simulator.
Change-Id: I4eda55fc3fd06e12d30a188928487cf68940ee07
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index e10da4ca0e..1c7b397193 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -567,9 +567,7 @@ bool QRhiMetal::create(QRhi::Flags flags) // suitable as deviceId because it does not seem stable on macOS and can // apparently change when the system is rebooted. -#ifdef Q_OS_IOS - driverInfoStruct.deviceType = QRhiDriverInfo::IntegratedDevice; -#else +#ifdef Q_OS_MACOS if (@available(macOS 10.15, *)) { const MTLDeviceLocation deviceLocation = [d->dev location]; switch (deviceLocation) { @@ -586,6 +584,8 @@ bool QRhiMetal::create(QRhi::Flags flags) break; } } +#else + driverInfoStruct.deviceType = QRhiDriverInfo::IntegratedDevice; #endif const QOperatingSystemVersion ver = QOperatingSystemVersion::current(); @@ -6465,12 +6465,12 @@ QRhiSwapChainHdrInfo QMetalSwapChain::hdrInfo() if (m_window) { // Must use m_window, not window, given this may be called before createOrResize(). -#ifdef Q_OS_MACOS +#if defined(Q_OS_MACOS) NSView *view = reinterpret_cast<NSView *>(m_window->winId()); NSScreen *screen = view.window.screen; info.limits.colorComponentValue.maxColorComponentValue = screen.maximumExtendedDynamicRangeColorComponentValue; info.limits.colorComponentValue.maxPotentialColorComponentValue = screen.maximumPotentialExtendedDynamicRangeColorComponentValue; -#else +#elif defined(Q_OS_IOS) if (@available(iOS 16.0, *)) { UIView *view = reinterpret_cast<UIView *>(m_window->winId()); UIScreen *screen = view.window.windowScene.screen; |