Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
15 changes: 11 additions & 4 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ on:
deployment-target:
required: true
type: string
xcode-version:
required: false
type: string
default: '16.4'
runs-on:
required: false
type: string
default: macos-latest

env:
CMAKE_VERSION: '3.31.6'
XCODE_VERSION: '16.4'

jobs:
build:
runs-on: macos-latest
runs-on: ${{ inputs.runs-on }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v5
Expand All @@ -23,8 +30,8 @@ jobs:
cmake-version: ${{ env.CMAKE_VERSION }}


- name: Select Xcode ${{ env.XCODE_VERSION }}
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
- name: Select Xcode ${{ inputs.xcode-version }}
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer

- name: Generate iOS solution
run: |
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@ on:
required: false
type: boolean
default: false
xcode-version:
required: false
type: string
default: '16.4'
runs-on:
required: false
type: string
default: macos-latest

env:
CMAKE_VERSION: '3.31.6'
XCODE_VERSION: '16.4'

jobs:
build:
runs-on: macos-latest
runs-on: ${{ inputs.runs-on }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v5
Expand All @@ -28,8 +35,8 @@ jobs:
cmake-version: ${{ env.CMAKE_VERSION }}


- name: Select Xcode ${{ env.XCODE_VERSION }}
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
- name: Select Xcode ${{ inputs.xcode-version }}
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer

- name: Generate macOS solution
run: |
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,21 @@ jobs:
with:
deployment-target: '17.5'

# ── Win32 ─────────────────────────────────────────────────────
# ── Apple: Xcode 26 ──────────────────────────────────────────
MacOS_Xcode26:
uses: ./.github/workflows/build-macos.yml
with:
xcode-version: '26.4'
runs-on: macos-26

iOS_Xcode26:
uses: ./.github/workflows/build-ios.yml
with:
deployment-target: '26.0'
xcode-version: '26.4'
runs-on: macos-26

# ── Win32─────────────────────────────────────────────────────
Win32_x64_D3D11:
uses: ./.github/workflows/build-win32.yml
with:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test-install-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ on:
deployment-target:
required: true
type: string
xcode-version:
required: false
type: string
default: '16.4'

env:
CMAKE_VERSION: '3.31.6'
XCODE_VERSION: '16.4'

jobs:
test-install:
Expand All @@ -23,8 +26,8 @@ jobs:
cmake-version: ${{ env.CMAKE_VERSION }}


- name: Select Xcode ${{ env.XCODE_VERSION }}
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
- name: Select Xcode ${{ inputs.xcode-version }}
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer

- name: Configure
run: |
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test-install-macos.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Test Install macOS

on:
workflow_call: {}
workflow_call:
inputs:
xcode-version:
required: false
type: string
default: '16.4'

env:
CMAKE_VERSION: '3.31.6'
XCODE_VERSION: '16.4'

jobs:
test-install:
Expand All @@ -19,8 +23,8 @@ jobs:
cmake-version: ${{ env.CMAKE_VERSION }}


- name: Select Xcode ${{ env.XCODE_VERSION }}
run: sudo xcode-select --switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer
- name: Select Xcode ${{ inputs.xcode-version }}
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer

- name: Configure
run: |
Expand Down
37 changes: 33 additions & 4 deletions Core/Graphics/Source/DeviceImpl_iOS.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>


namespace
{
bool IsValidScale(float scale)
{
return !std::isinf(scale) && scale > 0;
}
}

namespace Babylon::Graphics
{
void DeviceImpl::ConfigureBgfxPlatformData(bgfx::PlatformData& pd, WindowT window)
Expand All @@ -19,12 +28,32 @@
float DeviceImpl::GetDevicePixelRatio(WindowT window)
{
// contentsScale can return 0 if it hasn't been set yet.
// Fallback to the scale from the main screen.
float scale = static_cast<float>(((CAMetalLayer*)window).contentsScale);
if (std::isinf(scale) || scale <= 0)
if (IsValidScale(scale))
{
scale = UIScreen.mainScreen.scale;
Comment thread
bghgary marked this conversation as resolved.
return scale;
}
return scale;

// 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 (IsValidScale(scale))
{
return scale;
}
}
}
}

// Fallback for older iOS versions or if no active scene was found.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return UIScreen.mainScreen.scale;
#pragma clang diagnostic pop
}
}
21 changes: 11 additions & 10 deletions Dependencies/xr/Source/ARKit/XR.mm
Original file line number Diff line number Diff line change
Expand Up @@ -257,18 +257,19 @@ - (void) UnlockAnchors {
Returns the orientation of the app
*/
- (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];
#else
if (@available(iOS 13.0, *)) {
return [[[[sharedApplication windows] firstObject] windowScene] interfaceOrientation];
UIApplication* app = [UIApplication sharedApplication];
if (@available(iOS 26.0, *)) {
UIWindowScene* windowScene = (UIWindowScene*)[[[app connectedScenes] allObjects] firstObject];
return windowScene.effectiveGeometry.interfaceOrientation;
}
else {
return [sharedApplication statusBarOrientation];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (@available(iOS 13.0, *)) {
UIWindowScene* windowScene = [[[app windows] firstObject] windowScene];
return [windowScene interfaceOrientation];
}
#endif
return [app statusBarOrientation];
#pragma clang diagnostic pop
}

/**
Expand Down
30 changes: 17 additions & 13 deletions Plugins/NativeCamera/Source/Apple/CameraDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -900,23 +900,27 @@ - (void) reset {
}

#if (TARGET_OS_IPHONE)

static UIInterfaceOrientation GetCurrentInterfaceOrientation(UIApplication* app) {
if (@available(iOS 26.0, *)) {
UIWindowScene* windowScene = (UIWindowScene*)[[[app connectedScenes] allObjects] firstObject];
return windowScene.effectiveGeometry.interfaceOrientation;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (@available(iOS 13.0, *)) {
UIWindowScene* windowScene = [[[app windows] firstObject] windowScene];
return [windowScene interfaceOrientation];
}
return [app statusBarOrientation];
#pragma clang diagnostic pop
}

/**
Updates target video orientation.
*/
- (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];
#else
if (@available(iOS 13.0, *)) {
orientation = [[[[sharedApplication windows] firstObject] windowScene] interfaceOrientation];
}
else {
orientation = [sharedApplication statusBarOrientation];
}
#endif
UIInterfaceOrientation orientation = GetCurrentInterfaceOrientation([UIApplication sharedApplication]);

// Convert from UIInterfaceOrientation to VideoOrientation.
switch (orientation)
Expand Down