From b80f2350904a7ca19bb5ed5cf18c9b52956d35b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 5 Mar 2026 13:40:07 +0100 Subject: [PATCH] More iOS cleanup --- ios/ViewController.mm | 19 ++----------------- ios/ViewControllerCommon.mm | 6 +++--- ios/ViewControllerMetal.mm | 11 ----------- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/ios/ViewController.mm b/ios/ViewController.mm index ec3b1698cc..3a8f86c047 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -95,9 +95,6 @@ PPSSPPBaseViewController *sharedViewController; @interface PPSSPPViewControllerGL () { IOSGLESContext *graphicsContext; - - int imageRequestId; - NSString *imageFilename; } @property (nonatomic, strong) EAGLContext *glContext; @@ -105,8 +102,6 @@ PPSSPPBaseViewController *sharedViewController; @property (nonatomic, strong) CADisplayLink *displayLink; @property (nonatomic, assign) NSTimeInterval lastTimestamp; -@property (nonatomic, strong) EAGLContext* context; - @end @implementation PPSSPPViewControllerGL {} @@ -144,12 +139,12 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { - (bool)runGLRenderLoop { if (!graphicsContext) { - ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); + ERROR_LOG(Log::G3D, "runGLRenderLoop: Tried to enter without a created graphics context."); return false; } if (g_renderLoopThread.joinable()) { - ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Already running"); + ERROR_LOG(Log::G3D, "runGLRenderLoop: Already running"); return false; } @@ -239,7 +234,6 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { [self hideKeyboard]; - // Initialize the motion manager for accelerometer control. INFO_LOG(Log::G3D, "Done with viewDidLoad."); } @@ -340,15 +334,6 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { _dbg_assert_(graphicsContext); - if (self.context) { - if ([EAGLContext currentContext] == self.context) { - [EAGLContext setCurrentContext:nil]; - } - self.context = nil; - } - - [[NSNotificationCenter defaultCenter] removeObserver:self]; - graphicsContext->BeginShutdown(); // Skipping GL calls here because the old context is lost. graphicsContext->ThreadFrameUntilCondition([]() -> bool { diff --git a/ios/ViewControllerCommon.mm b/ios/ViewControllerCommon.mm index b7eae300bf..86c26d2dbd 100644 --- a/ios/ViewControllerCommon.mm +++ b/ios/ViewControllerCommon.mm @@ -110,7 +110,7 @@ // This needs to be called really late during startup, unfortunately. #if PPSSPP_PLATFORM(IOS_APP_STORE) [IAPManager sharedIAPManager]; // Kick off the IAPManager early. - NSLog(@"Metal viewDidAppear. updating icon"); + NSLog(@"viewDidAppear. updating icon"); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [[IAPManager sharedIAPManager] updateIcon:false]; [self hideKeyboard]; @@ -443,9 +443,9 @@ extern float g_safeInsetBottom; } - (void)updateResolutionWithView:(UIView *)view { - // 1. Get the scale from the window scene (safest for Metal) + // 1. Get the scale from the window scene CGFloat scale = 1.0; - if (view.window.windowScene) { + if (view.window && view.window.windowScene) { scale = view.window.windowScene.screen.nativeScale; } else { scale = [UITraitCollection currentTraitCollection].displayScale; diff --git a/ios/ViewControllerMetal.mm b/ios/ViewControllerMetal.mm index 70382a2a62..5b4fae85f4 100644 --- a/ios/ViewControllerMetal.mm +++ b/ios/ViewControllerMetal.mm @@ -81,19 +81,8 @@ bool IOSVulkanContext::InitFromRenderThread(CAMetalLayer *layer, int desiredBack VkPresentModeKHR presentMode = ConfigPresentModeToVulkan(draw_); - // This MUST run on the main thread. We're taking our chances with a dispatch_sync here. g_Vulkan->InitSwapchain(presentMode); - if (false) { - delete draw_; - ERROR_LOG(Log::G3D, "InitSwapchain failed"); - g_Vulkan->DestroySwapchain(); - g_Vulkan->DestroySurface(); - g_Vulkan->DestroyDevice(); - g_Vulkan->DestroyInstance(); - return false; - } - SetGPUBackend(GPUBackend::VULKAN); bool shaderSuccess = draw_->CreatePresets(); // Doesn't fail, we ship the compiler. _assert_msg_(shaderSuccess, "Failed to compile preset shaders");