diff --git a/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp b/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp index f636e263f..eb23c0871 100644 --- a/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp +++ b/Source/Engine/GraphicsDevice/Vulkan/GPUDeviceVulkan.cpp @@ -527,8 +527,9 @@ RenderPassVulkan::RenderPassVulkan(GPUDeviceVulkan* device, const RenderTargetLa #if PLATFORM_ANDROID attachment.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; // TODO: Adreno 640 has glitches when blend is disabled and rt data not loaded #elif PLATFORM_MAC || PLATFORM_IOS - attachment.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; // MoltenVK seams to have glitches + attachment.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; // MoltenVK seams to have glitches (tiled arch of gpu) #else + // TODO: we need render passes into high-level rendering api to perform more optimal rendering (esp. for tiled gpus) attachment.loadOp = layout.BlendEnable ? VK_ATTACHMENT_LOAD_OP_LOAD : VK_ATTACHMENT_LOAD_OP_DONT_CARE; #endif attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; diff --git a/Source/Engine/Platform/iOS/iOSPlatform.cpp b/Source/Engine/Platform/iOS/iOSPlatform.cpp index ca1655bcf..7ca27c481 100644 --- a/Source/Engine/Platform/iOS/iOSPlatform.cpp +++ b/Source/Engine/Platform/iOS/iOSPlatform.cpp @@ -9,6 +9,7 @@ #include "iOSApp.h" #include "Engine/Core/Log.h" #include "Engine/Core/Delegate.h" +#include "Engine/Core/Utilities.h" #include "Engine/Core/Types/String.h" #include "Engine/Core/Collections/Array.h" #include "Engine/Platform/Apple/AppleUtils.h" @@ -23,6 +24,7 @@ #include "Engine/Input/InputDevice.h" #include "Engine/Engine/Engine.h" #include "Engine/Engine/Globals.h" +#include "Engine/Content/Storage/ContentStorageManager.h" #include #include #include @@ -30,6 +32,7 @@ #include #include #include +#include class iOSTouchScreen : public InputDevice { @@ -327,16 +330,26 @@ MessagePipeline MainThreadPipeline; MainWindow->OnGotFocus(); } +- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application +{ + LOG(Warning, "[iOS] applicationDidReceiveMemoryWarning"); + LOG(Warning, "os_proc_available_memory: {}", Utilities::BytesToText(os_proc_available_memory())); +} + @end DialogResult MessageBox::Show(Window* parent, const StringView& text, const StringView& caption, MessageBoxButtons buttons, MessageBoxIcon icon) { NSString* title = (NSString*)AppleUtils::ToString(caption); NSString* message = (NSString*)AppleUtils::ToString(text); - UIAlertController* alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction* button = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:^(id){ }]; - [alert addAction:button]; - [MainViewController presentViewController:alert animated:YES completion:nil]; + Function func = [&title, &message]() + { + UIAlertController* alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction* button = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:^(id){ }]; + [alert addAction:button]; + [MainViewController presentViewController:alert animated:YES completion:nil]; + }; + iOSPlatform::RunOnUIThread(func, true); return DialogResult::OK; } @@ -472,6 +485,9 @@ bool iOSPlatform::Init() // TODO: add Gamepad for vibrations usability Input::CustomDevices.Add(TouchScreen = New()); + // Use more aggressive content buffers freeing to reduce peek memory + ContentStorageManager::UnusedDataChunksLifetime = TimeSpan::FromMilliseconds(30); + return false; } @@ -483,6 +499,7 @@ void iOSPlatform::LogInfo() uname(&systemInfo); NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; LOG(Info, "{3}, iOS {0}.{1}.{2}", version.majorVersion, version.minorVersion, version.patchVersion, String(systemInfo.machine)); + LOG(Info, "os_proc_available_memory: {}", Utilities::BytesToText(os_proc_available_memory())); } void iOSPlatform::Tick()