Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2.3] iOS Simulator with very slow running (like almost stopping) #45173

Open
gumaciel opened this issue Jan 14, 2021 · 23 comments
Open

[3.2.3] iOS Simulator with very slow running (like almost stopping) #45173

gumaciel opened this issue Jan 14, 2021 · 23 comments

Comments

@gumaciel
Copy link
Contributor

gumaciel commented Jan 14, 2021

Godot version:
3.2.3 stable

OS/device including version:
OS: 10.15.7 (19H15) Catalina
Xcode: 12.3 (12C33)
Simulator: iPhone 12 (14.3), i already tested on iPhone 8(14.3), but it's like the same thing

The specs of hardware of my computer are very good, theres no lag on Godot Editor or Android, just on iOS Simulator

Issue description:
If you try to run a Godot exported game in Simulator, the game is very slow, and it doesn't require be a big project, just have a character that moves left and right, is very bad to play like impossible to test if everything is alright with iOS project.

Ps: I already disabled "Slow Animations" but it only affects things like "native" to iOS, the performance of the game continues horrible.

Steps to reproduce:
Just test on iOS Simulator

Minimal reproduction project:
https://github.com/Poing-Studios/Godot-AdMob-Android-iOS/tree/master/example

This project doesn't lag too much because doesn't have much thing, but if add a AnimationPlayer you will notice the lag

@ViktorEvil
Copy link
Contributor

I can confirm this

Godot version:
3.2.3 stable
3.2.4 beta 5

OS/device including version:
OS: 11.1 Big Sur
Xcode: 12.3 (12C33)

Mac Mini 2014 i5
MacBook Pro 2020 M1

Tried with both Macs and both versions of Godot. Simulator is unusable and very slow (1-3 fps) using a test project of just a spinning red cube in front of a camera.

@Calinou
Copy link
Member

Calinou commented Jan 15, 2021

At this point, it seems like the simulator is using software OpenGL emulation of some kind.

Has anyone ever gotten usable performance from the iOS simulator in any Godot version (even 2.1)? Also, has anyone gotten better performance from other game engines running in the iOS simulator?

@naithar
Copy link
Contributor

naithar commented Jan 19, 2021

If anyone could provide an actual MRP without the need to change it in any way and test Godot 3.2.2 or earlier for this issue, it would help greatly.

@gumaciel
Copy link
Contributor Author

@naithar just tested in 3.2.2 and it's same thing, and still with this problem: #44681

@ViktorEvil
Copy link
Contributor

@naithar also tested a very simple scene (3D spinning cube) in 3.2.2 on an M1 Mac.

simulator is still very very slow and only running at 2-5 fps, It is also using over 100% of the CPU and over 500MB of memory.

I also tried using GLES2 but I get thousands of "DrawView: 500 errors" but it did only use 300MB or RAM in the process

@Calinou the iOS simulator was working great with over 60fps. As for better performance using other game engines I do not know but using SceneKit it is not far off native speed I would guess.

@naithar
Copy link
Contributor

naithar commented Jan 19, 2021

@naithar also tested a very simple scene (3D spinning cube) in 3.2.2 on an M1 Mac.

Can you provide one?

@Calinou the iOS simulator was working great with over 60fps. As for better performance using other game engines I do not know but using SceneKit it is not far off native speed I would guess.

When was it working great? Which machine and which Godot version were you using?
SceneKit probably uses Metal under the hood, which would explain it's performance. Simulator is probably just uses software OpenGL emulation so that probably explains where the problem comes from.

@ViktorEvil
Copy link
Contributor

Do you want an Xcode project or the Godot project?

just tried with Xcode 12.2 using Godot 3.2.2 and 3.2.4 beta6 and get the same under 5fps using intel MacMini and M1 MacBook Pro

@naithar
Copy link
Contributor

naithar commented Jan 20, 2021

Do you want an Xcode project or the Godot project?

Godot of course. There is really no point in Xcode project.

Can you also try running this project on older Godot versions? Like 3.1.x or even 2.x?

Edit:
iOS Simulator doesn't use GPU acceleration for OpenGL ES. It works only for Metal, so I guess this is the source of a problem, since Godot is shader heavy afaik. But simulator performance does not affect real device anyway.
Checking out Godot 4.0 might be a good idea, since it uses Metal via MoltenVK, so it might have a good performance in Simulator.
But I would recommend finding someone with iOS device, just to be sure.

@ViktorEvil
Copy link
Contributor

ViktorEvil commented Jan 21, 2021

just ran the test project in Xcode simulator and get this error which seems relevant

2021-01-21 12:31:10.396416+0000 Test[1474:36101] Setting up an OpenGL ES 3.0 context. Based on Project Settings "rendering/quality/driver/driver_name"
2021-01-21 12:31:10.400725+0000 Test[1474:36101] failed to make complete framebuffer object 8cd6
2021-01-21 12:31:10.400832+0000 Test[1474:36101] Failed to create frame buffer!

test project

@naithar
Copy link
Contributor

naithar commented Jan 21, 2021

Framebuffer is created correctly later, so it's not relevant

@naithar
Copy link
Contributor

naithar commented Jan 22, 2021

Tested on both simulator and device.
On device there is no performance drop on both iPhone 8 and iPhone XS.

On simulator when testing with Xcode 12 I've encountered some issues: audio system wasn't able to initialize (crash with HALB_IOBufferManager_Client in logs) and performance drops.
Audio system simulator bug on Big Sur seems to be known since Xcode 12.1 release and doesn't seem to be fixed.
Rendering performance should be related to simulator not using GPU acceleration as glDrawArrays_IMM_ES2Exec and some other OpenGL functions takes too long to perform:
Снимок экрана 2021-01-22 в 15 09 28

Testing on Catalina with Xcode 12 resulted in same performance issues while audio worked fine.
On Xcode 11 audio system initialization also finished correctly. Performance was a little better than on Xcode 12 after initial slowdown. Can't really test it correctly on old macbook when simulator takes more than a minute to boot up.

Seems like a combination of Big Sur, Xcode 12 and Simulator is the reason for slow OpenGL rendering and additional issues.

@ViktorEvil would you be able to test Godot 4.0 with MoltenVK support?

@ViktorEvil
Copy link
Contributor

I couldn’t get the simulator to work at all with Godot 4

@gumaciel
Copy link
Contributor Author

gumaciel commented Jan 22, 2021

@naithar i think is not only for Big Sur, my Catalina also lags too much :(

@naithar
Copy link
Contributor

naithar commented Jan 22, 2021

@gustavottc as I've previously said, Catalina and Bug Sur on Xcode 12 results in same slow performance. Xcode 11 has better performance after it lags out in about 5-10 or so seconds.
It's simulator only issue and there is probably no way to properly address it, since it seems to be related to GPU acceleration, which is not used for OpenGL.

If you can, please try testing Godot 4.0 version.

@ViktorEvil
Copy link
Contributor

Couldn’t get the export templates from https://hugo.pro/projects/godot-builds/
To work with Godot 4 even after loads of fiddling around

@naithar
Copy link
Contributor

naithar commented Jan 22, 2021

Tried running Godot 4.0 on simulator, seems like it wouldn't be possible for some time due to the shader compilation error:

[mvk-error] VK_ERROR_FEATURE_NOT_PRESENT: Device Apple iOS simulator GPU does not support arrays of samplers.
2021-01-22 17:17:16.066069+0300 Test[25063:532490] ERROR: Error (-8) creating descriptor set layout for set 0
2021-01-22 17:17:16.066196+0300 Test[25063:532490]    at: shader_create (drivers/vulkan/rendering_device_vulkan.cpp:4370) - Method/function failed. Returning: RID()

On device Godot 4.0 works a little better, but some shaders still fail to compile which result in no rendering of some objects.

I guess, you should probably test your project on actual device, not a simulator if you want to test performance.

@ViktorEvil
Copy link
Contributor

I run on device iPhone 11 and iPad for performance testing, but running on the simulator is very useful for making sure the game is laid out the same on the different iOS screen sizes and notches etc.

@naithar
Copy link
Contributor

naithar commented Jan 22, 2021

running on the simulator is very useful for making sure the game is laid out the same on the different iOS screen sizes and notches etc.

I know. But lack of proper OpenGL support on simulator, its deprecation and probably removal in future in favour of Metal is not something we can address or workaround right now.
I had some better results with older Xcode version, you can try those to check if it helps.

@ViktorEvil
Copy link
Contributor

@naithar thanks, using Godot for iOS dev in the future looks like it might be tricky then without metal support

@Calinou no problem

@naithar
Copy link
Contributor

naithar commented Jan 22, 2021

it might be tricky then without metal support

Metal is already supported via MoltenVK. Some stuff is working, some isn't. But Godot 4.0 is not even in beta or alpha, so it's not a problem right now. Also new RenderDevice API should allow to implement native Metal API, if someone is able to do it.

@ViktorEvil
Copy link
Contributor

new RenderDevice API should allow to implement native Metal API, if someone is able to do it.

way beyond my skills lol, I imagine that's a lot of work to implement

@Calinou
Copy link
Member

Calinou commented Jan 22, 2021

It's not impossible that native (non-MoltenVK) Metal rendering is implemented in a future 4.x release, but it won't be done for 4.0.

@ViktorEvil
Copy link
Contributor

I know that iOS and macOS etc is not Godot's biggest market but a native Metal renderer would make it a real Unity/Unreal alternative for devs targeting these platforms for games.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants