Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/jobs/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ parameters:
name: ""
vmImage: ""
deploymentTarget: "15"
xcodeVersion: ""

jobs:
- job: ${{parameters.name}}
Expand All @@ -15,8 +16,8 @@ jobs:
vmImage: ${{parameters.vmImage}}

- script: |
sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: "Select Xcode $(XCODE_VERSION)"
sudo xcode-select --switch /Applications/Xcode_${{parameters.xcodeVersion}}.app/Contents/Developer
displayName: "Select Xcode ${{parameters.xcodeVersion}}"

- script: |
cmake -G Xcode -B build/iOS -D IOS=ON -D DEPLOYMENT_TARGET=${{parameters.deploymentTarget}} -D CMAKE_UNITY_BUILD=$(UNITY_BUILD) -D BABYLON_DEBUG_TRACE=ON -D CMAKE_IOS_INSTALL_COMBINED=NO
Expand Down
5 changes: 3 additions & 2 deletions .github/jobs/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ parameters:
vmImage: ""
enableSanitizers: false
generator: Xcode
xcodeVersion: ""

jobs:
- job: ${{parameters.name}}
Expand All @@ -19,8 +20,8 @@ jobs:
vmImage: ${{parameters.vmImage}}

- script: |
sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: "Select XCode $(XCODE_VERSION)"
sudo xcode-select --switch /Applications/Xcode_${{parameters.xcodeVersion}}.app/Contents/Developer
displayName: "Select Xcode ${{parameters.xcodeVersion}}"

- script: |
cmake -G "${{parameters.generator}}" -B build/macOS -D CMAKE_UNITY_BUILD=$(UNITY_BUILD) -D BABYLON_DEBUG_TRACE=ON -D ENABLE_SANITIZERS=$(SANITIZER_FLAG) -D BABYLON_NATIVE_TESTS_USE_NOOP_METAL_DEVICE=ON
Expand Down
5 changes: 3 additions & 2 deletions .github/jobs/test_install_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ parameters:
name: ""
vmImage: ""
deploymentTarget: "15"
xcodeVersion: ""

jobs:
- job: ${{parameters.name}}
Expand All @@ -15,8 +16,8 @@ jobs:
vmImage: ${{parameters.vmImage}}

- script: |
sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: "Select Xcode $(XCODE_VERSION)"
sudo xcode-select --switch /Applications/Xcode_${{parameters.xcodeVersion}}.app/Contents/Developer
displayName: "Select Xcode ${{parameters.xcodeVersion}}"

- script: |
cmake -B build/iOS -G Xcode -D IOS=ON -D DEPLOYMENT_TARGET=${{parameters.deploymentTarget}} -D CMAKE_IOS_INSTALL_COMBINED=NO -D CMAKE_UNITY_BUILD=$(UNITY_BUILD) -D BABYLON_NATIVE_BUILD_APPS=OFF -D BABYLON_DEBUG_TRACE=ON
Expand Down
5 changes: 3 additions & 2 deletions .github/jobs/test_install_macos.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
parameters:
name: ""
vmImage: ""
xcodeVersion: ""

jobs:
- job: ${{parameters.name}}
Expand All @@ -14,8 +15,8 @@ jobs:
vmImage: ${{parameters.vmImage}}

- script: |
sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: "Select XCode $(XCODE_VERSION)"
sudo xcode-select --switch /Applications/Xcode_${{parameters.xcodeVersion}}.app/Contents/Developer
displayName: "Select Xcode ${{parameters.xcodeVersion}}"

- script: |
cmake -B build/macOS -G Xcode -D CMAKE_UNITY_BUILD=$(UNITY_BUILD) -D BABYLON_NATIVE_BUILD_APPS=OFF -D BABYLON_DEBUG_TRACE=ON
Expand Down
23 changes: 22 additions & 1 deletion Core/Graphics/Source/DeviceImpl_iOS.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,28 @@
float scale = static_cast<float>(((CAMetalLayer*)window).contentsScale);
if (std::isinf(scale) || scale <= 0)
{
scale = UIScreen.mainScreen.scale;
Copy link
Copy Markdown
Contributor

@bghgary bghgary Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand what it's doing here. Does this code actually work? The documentation says traitCollection.displayScale is 0.0 by default.

https://developer.apple.com/documentation/uikit/uitraitcollection/displayscale?language=objc

FYI @ryantrem

// UIScreen.mainScreen is deprecated in iOS 26.
// Prefer getting the scale from the active window scene's trait collection.
if (@available(iOS 17.0, *))
{
for (UIScene* scene in UIApplication.sharedApplication.connectedScenes)
{
if ([scene isKindOfClass:[UIWindowScene class]])
{
scale = static_cast<float>(((UIWindowScene*)scene).traitCollection.displayScale);
if (scale > 0) break;
}
}
}

// Fallback for older iOS versions or if no active scene was found.
if (std::isinf(scale) || scale <= 0)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
scale = UIScreen.mainScreen.scale;
#pragma clang diagnostic pop
}
}
return scale;
}
Expand Down
19 changes: 16 additions & 3 deletions Dependencies/xr/Source/ARKit/XR.mm
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,24 @@ - (void) UnlockAnchors {
- (UIInterfaceOrientation)orientation {
UIApplication* sharedApplication = [UIApplication sharedApplication];
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_13_0)
UIScene* scene = [[[sharedApplication connectedScenes] allObjects] firstObject];
return [(UIWindowScene*)scene interfaceOrientation];
UIWindowScene* windowScene = (UIWindowScene*)[[[sharedApplication connectedScenes] allObjects] firstObject];
if (@available(iOS 26.0, *)) {
return windowScene.effectiveGeometry.interfaceOrientation;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [windowScene interfaceOrientation];
#pragma clang diagnostic pop
#else
if (@available(iOS 13.0, *)) {
return [[[[sharedApplication windows] firstObject] windowScene] interfaceOrientation];
UIWindowScene* windowScene = [[[sharedApplication windows] firstObject] windowScene];
if (@available(iOS 26.0, *)) {
return windowScene.effectiveGeometry.interfaceOrientation;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [windowScene interfaceOrientation];
#pragma clang diagnostic pop
}
else {
return [sharedApplication statusBarOrientation];
Expand Down
19 changes: 16 additions & 3 deletions Plugins/NativeCamera/Source/Apple/CameraDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -907,11 +907,24 @@ - (void)updateOrientation {
UIApplication* sharedApplication{[UIApplication sharedApplication]};
UIInterfaceOrientation orientation{UIInterfaceOrientationUnknown};
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_13_0)
UIScene* scene{[[[sharedApplication connectedScenes] allObjects] firstObject]};
orientation = [(UIWindowScene*)scene interfaceOrientation];
UIWindowScene* windowScene = (UIWindowScene*)[[[sharedApplication connectedScenes] allObjects] firstObject];
if (@available(iOS 26.0, *)) {
orientation = windowScene.effectiveGeometry.interfaceOrientation;
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
orientation = [windowScene interfaceOrientation];
#pragma clang diagnostic pop
}
#else
if (@available(iOS 13.0, *)) {
if (@available(iOS 26.0, *)) {
UIWindowScene* windowScene = [[[sharedApplication windows] firstObject] windowScene];
orientation = windowScene.effectiveGeometry.interfaceOrientation;
} else if (@available(iOS 13.0, *)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
orientation = [[[[sharedApplication windows] firstObject] windowScene] interfaceOrientation];
#pragma clang diagnostic pop
}
else {
orientation = [sharedApplication statusBarOrientation];
Expand Down
23 changes: 21 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,57 @@ variables:
value: 28.2.13676358
- name: UNITY_BUILD
value: true
- name: XCODE_VERSION
value: 16.4

jobs:
# Apple
- template: .github/jobs/macos.yml
parameters:
name: MacOS
vmImage: macOS-latest
xcodeVersion: "16.4"

- template: .github/jobs/macos.yml
parameters:
name: MacOS_Ninja
vmImage: macOS-latest
xcodeVersion: "16.4"
generator: Ninja Multi-Config

- template: .github/jobs/macos.yml
parameters:
name: MacOS_Sanitizers
vmImage: macOS-latest
xcodeVersion: "16.4"
enableSanitizers: true

- template: .github/jobs/ios.yml
parameters:
name: iOS_iOS180
vmImage: macOS-latest
xcodeVersion: "16.4"
deploymentTarget: 18.0

- template: .github/jobs/ios.yml
parameters:
name: iOS_iOS175
vmImage: macOS-latest
xcodeVersion: "16.4"
deploymentTarget: 17.5

# Xcode 26
- template: .github/jobs/macos.yml
parameters:
name: MacOS_Xcode26
vmImage: macOS-latest
xcodeVersion: "26.3"

- template: .github/jobs/ios.yml
parameters:
name: iOS_Xcode26
vmImage: macOS-latest
xcodeVersion: "26.3"
deploymentTarget: 26.0

# Win32
- template: .github/jobs/win32.yml
parameters:
Expand Down Expand Up @@ -168,6 +185,7 @@ jobs:
parameters:
name: iOS_Installation
vmImage: macOS-latest
xcodeVersion: "16.4"
deploymentTarget: 17.2
- template: .github/jobs/test_install_linux.yml
parameters:
Expand All @@ -177,6 +195,7 @@ jobs:
parameters:
name: MacOS_Installation
vmImage: macOS-latest
xcodeVersion: "16.4"
- template: .github/jobs/test_install_win32.yml
parameters:
name: Win32_Installation
Expand Down
Loading