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

Allow Angle backend selection, add initial iOS Angle support. #87028

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Jan 10, 2024

Depends on godotengine/godot-angle-static#3 (include workaround for massive leaks on macOS and iOS build config).

  • Adds project setting to select Angle backend (for all supported platforms).
  • Makes Angle over Metal usable on macOS (slow line drawing is still the issue).
  • Adds support for iOS build.

@bruvzg
Copy link
Member Author

bruvzg commented Jan 30, 2024

Update: Got it working with both ANGLE and native GL.

@Jakub-Doucek
Copy link

Great job. I've somehow managed to make it work. It was quite tricky because ios export don't work to me in this version. So I've used another exported project and just replaced the godot library.
There is no proper info how to create ANGLE build. I fortunately found this issue #8345 and found that angle_libs need to be used. But also angle libs needs to be linked when compiling ios project.

Anyway I tried 3D platformer example - https://github.com/godotengine/godot-demo-projects/tree/master/3d/platformer
And it crashed. Here is the stack trace and log:

Screenshot 2024-02-03 at 10 15 50
Godot Engine v4.3.dev.custom_build.ed40c756f - https://godotengine.org
ERROR: AudioOutputUnitStart failed, code: -50
at: start (drivers/coreaudio/audio_driver_coreaudio.cpp:251)
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
WARNING: Project setting "rendering/limits/global_shader_variables/buffer_size" exceeds maximum uniform buffer size of: 16384
at: MaterialStorage (drivers/gles3/storage/material_storage.cpp:1 114)
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
OpenGL API OpenGL ES 3.0.0 (ANGLE 2.1.21553 git hash: 430a4f559cbc) - Compatibility - Using Device: Google Inc. (Apple) - ANGLE (Apple, ANGLE Metal Renderer: Apple A10 GPU, Version 17.2 (Build 21C62))
 
ERROR: Couldn't get the CPU model name. Returning an empty string.
at: get_processor_name (platform/ios/os_ios.mm:367)
WARNING: Icon not supported by this display server.
at: set_icon (servers/display_server.cpp:587)
WARNING: MSAA is not supported on this device.
at: configure (drivers/gles3/storage/render_scene_buffers_gles3.cpp:232)
Warning: Compilation succeeded with: 

program_source:81:39: warning: writable resources in non-void vertex function
vertex __VERTEX_OUT(ANGLE_VertexOut)  main0(ANGLE_VertexIn ANGLE_vertexIn [[stage_in]], constant ANGLEUniformBlock & ANGLE_angleUniforms [[buffer(17)]], uint32_t ANGLE_instanceIdMod [[instance_id]], uint32_t ANGLE_baseInstance [[base_instance]], uint32_t gl_VertexID [[vertex_id]] , device float* ANGLE_xfbBuffer0 [[buffer(30)]] )
                                      ^
program_source:81:298: note: writable buffer defined here
vertex __VERTEX_OUT(ANGLE_VertexOut)  main0(ANGLE_VertexIn ANGLE_vertexIn [[stage_in]], constant ANGLEUniformBlock & ANGLE_angleUniforms [[buffer(17)]], uint32_t ANGLE_instanceIdMod [[instance_id]], uint32_t ANGLE_baseInstance [[base_instance]], uint32_t gl_VertexID [[vertex_id]] , device float* ANGLE_xfbBuffer0 [[buffer(30)]] )
                                                                                                                                                                                                                                                                                                         ^
Warning: Compilation succeeded with: 

program_source:81:39: warning: writable resources in non-void vertex function
vertex __VERTEX_OUT(ANGLE_VertexOut)  main0(ANGLE_VertexIn ANGLE_vertexIn [[stage_in]], constant ANGLEUniformBlock & ANGLE_angleUniforms [[buffer(17)]], uint32_t ANGLE_instanceIdMod [[instance_id]], uint32_t ANGLE_baseInstance [[base_instance]], uint32_t gl_VertexID [[vertex_id]] , device float* ANGLE_xfbBuffer0 [[buffer(30)]] )
                                      ^
program_source:81:298: note: writable buffer defined here
vertex __VERTEX_OUT(ANGLE_VertexOut)  main0(ANGLE_VertexIn ANGLE_vertexIn [[stage_in]], constant ANGLEUniformBlock & ANGLE_angleUniforms [[buffer(17)]], uint32_t ANGLE_instanceIdMod [[instance_id]], uint32_t ANGLE_baseInstance [[base_instance]], uint32_t gl_VertexID [[vertex_id]] , device float* ANGLE_xfbBuffer0 [[buffer(30)]] )
                                                                                                                                                                                                                                                                                                         ^
Warning: Compilation succeeded with: 

program_source:622:39: warning: writable resources in non-void vertex function
vertex __VERTEX_OUT(ANGLE_VertexOut)  main0(ANGLE_VertexIn ANGLE_vertexIn [[stage_in]], constant ANGLEUniformBlock & ANGLE_angleUniforms [[buffer(17)]], metal::texture2d<float> ANGLE_184_skeleton_texture_texture [[texture(0)]], metal::sampler ANGLE_185_skeleton_texture_sampler [[sampler(0)]], uint32_t ANGLE_instanceIdMod [[instance_id]], uint32_t ANGLE_baseInstance [[base_instance]], uint32_t gl_VertexID [[vertex_id]] , device float* ANGLE_xfbBuffer0 [[buffer(30)]] )
                                      ^
program_source:622:439: note: writable buffer defined here
vertex __VERTEX_OUT(ANGLE_VertexOut)  main0(ANGLE_VertexIn ANGLE_vertexIn [[stage_in]], constant ANGLEUniformBlock & ANGLE_angleUniforms [[buffer(17)]], metal::texture2d<float> ANGLE_184_skeleton_texture_texture [[texture(0)]], metal::sampler ANGLE_185_skeleton_texture_sampler [[sampler(0)]], uint32_t ANGLE_instanceIdMod [[instance_id]], uint32_t ANGLE_baseInstance [[base_instance]], uint32_t gl_VertexID [[vertex_id]] , device float* ANGLE_xfbBuffer0 [[buffer(30)]] )
                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5775: failed assertion `Draw Errors Validation
Vertex Function(main0): argument vertexBuffer.2[0] from buffer(13) with offset(16) and length(48) has space for 32 bytes, but argument has a length(48).
Vertex Function(main0): argument vertexBuffer.3[0] from buffer(14) with offset(32) and length(48) has space for 16 bytes, but argument has a length(48).
'

@Jakub-Doucek
Copy link

2D platformer example works - https://github.com/godotengine/godot-demo-projects/tree/master/2d/platformer
But the performance is quite bad. With the release build, the iPad6th has about 20fps, iPhone 13 Max Pro about 40fps.
Debug texts themselves cause quite a significant fps drop, also it looks like GPU is not used at all.
IMG_7444
IMG_7445

@Calinou
Copy link
Member

Calinou commented Feb 3, 2024

also it looks like GPU is not used at all.

This is because GPU timing readouts are broken on mobile, at least when using the Compatibility rendering method. They only tend to work reliably on desktop platforms. The GPU is being used, otherwise you wouldn't see anything on screen 🙂

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

Successfully merging this pull request may close these issues.

3 participants