godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.38k stars 21.26k forks source link

3D of GLES2 does not really work on Android devices with GLES2 GPU #20958

Closed avril-gh closed 6 years ago

avril-gh commented 6 years ago

Godot version: Godot 3.1 master branch at 2018-08-13

OS/device including version: Tested on Android 4.4.2 - MTK6592 - 1GB - GPU Mali 450 MP4 700Mhz - GL2.0 Android 4.4.2 - BCM23550 - 1GB - GPU VideoCore IV - GL2.0 (have fiew more devices like these but since errors are exacly same on those 2, then i assume that rest will be same) Note that Godot 2.1.5 works on these devices very well.

Issue description: 2D seems to work (not really tested yet since i mostly aim at 3D features. Just placed Label on screen to show FPS and its visible) 3D mode while on GLES2 GPU android device, shows only background (sky/ground color) and nothing more, no 3D objects are visible, and if more complex 3D objects are added it crashes after splash screen..

Most simple starting cube exported from blender are invisible on android and throws many errors

0:00:00:0369 - Directional shadow framebuffer status invalid
----------
Type:Error
Description: 
Time: 0:00:00:0369
C Error: Directional shadow framebuffer status invalid
C Source: drivers\gles2\rasterizer_scene_gles2.cpp:2313
C Function: initialize

0:00:03:0482 - CubemapFilterShaderGLES2: Program linking failed:
ERROR:PREPROCESSOR-3 (line 2) #extension if a required extension extension_name is not supported, or if all is specified
----------
Type:Error
Description: 
Time: 0:00:03:0482
C Error: CubemapFilterShaderGLES2: Program linking failed:
ERROR:PREPROCESSOR-3 (line 2) #extension if a required extension extension_name is not supported, or if all is specified
C Source: drivers\gles2\shader_gles2.cpp:509
C Function: get_current_version

0:00:03:0483 - Method/Function Failed, returning: __null
----------
Type:Error
Description: 
Time: 0:00:03:0483
C Error: Method/Function Failed, returning: __null
C Source: drivers\gles2\shader_gles2.cpp:517
C Function: get_current_version

0:00:03:0483 - Condition ' !version ' is true. returned: false
----------
Type:Error
Description: 
Time: 0:00:03:0483
C Error: Condition ' !version ' is true. returned: false
C Source: drivers\gles2\shader_gles2.cpp:133
C Function: bind

0:00:03:0521 - Condition ' !version ' is true. returned: -1
----------
Type:Error
Description: 
Time: 0:00:03:0521
C Error: Condition ' !version ' is true. returned: -1
C Source: drivers\gles2/shader_gles2.h:509
C Function: _get_uniform
(this error repeated many times)

0:00:03:0747 - Too many errors! 165 errors were dropped.
----------
Type:Error
Description: Too many errors! 165 errors were dropped.
Time: 0:00:03:0747
C Error: TOO_MANY_ERRORS
C Source: :-137673423
C Function: 

Attached Project with simple cube from blender test7.zip

The same project contain another object a little more complex (Cube.tscn), If you add it to scene, it will completly crash on android with GLES2 GPU after splash screen. CSG objects are invisible on android also if you try to place them for test.

Basicaly - no 3D objects are visible in 3D mode on android with GLES2 GPU

Steps to reproduce: Run example project (test7.zip attached above) on android device with GLES2 GPU

Minimal reproduction project:

eon-s commented 6 years ago

This seems related to #20734.

karroffel commented 6 years ago

Will take a look

karroffel commented 6 years ago

So the extension in CubemapFilterShaderGLES2 can be substituted for something that might work less good but at least it will run. That fix is easy to make.

The other problem is that your device doesn't seem to support depth textures, so renderbuffers have to be used (which are write only) with an additional color attachement to write to a shader-readable texture that can be used for shadows.

The first thing is an easy thing to fix, the second one might take some more, I'll work on it and report back!

avril-gh commented 6 years ago

@karroffel I took some info from android devices mentioned above in bug report, that might be helpful.

Info taken taken by godot 2.1.5 debug for GPU Mali450 MP4

GL_ARM_mali_program_binary
GL_ARM_mali_shader_binary
GL_ARM_rgba8
GL_EXT_blend_minmax
GL_EXT_debug_marker
GL_EXT_discard_framebuffer
GL_EXT_multisampled_render_to_texture
GL_EXT_robustness
GL_EXT_shader_texture_lod
GL_EXT_texture_format_BGRA8888
GL_KHR_debug
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_EGL_sync
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth24
GL_OES_depth_texture
GL_OES_depth_texture_cube_map
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_texture_npot
GL_OES_vertex_half_float

info from same device Mali450 MP4 taken by adb shell dumpsys SurfaceFlinger

GLES: ARM, Mali-450 MP, OpenGL ES 2.0 GL_EXT_debug_marker GL_OES_texture_npot GL_OES_compressed_ETC1_RGB8_texture GL_O ES_standard_derivatives GL_OES_EGL_image GL_OES_depth24 GL_ARM_rgba8 GL_ARM_mali _shader_binary GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_f ormat_BGRA8888 GL_OES_vertex_half_float GL_EXT_blend_minmax GL_OES_EGL_image_ext ernal GL_OES_EGL_sync GL_OES_rgb8_rgba8 GL_EXT_multisampled_render_to_texture GL _EXT_discard_framebuffer GL_OES_get_program_binary GL_ARM_mali_program_binary GL _EXT_shader_texture_lod GL_EXT_robustness GL_OES_depth_texture_cube_map GL_KHR_d ebug EGL implementation : 1.4 Linux-r4p0-00rel0 EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_gl_texture_2D_imag e EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_fence_s ync EGL_ANDROID_image_native_buffer EGL_ANDROID_recordable EGL_ANDROID_native_fe nce_sync EGL_ANDROID_framebuffer_target EGL_EXT_create_context_robustness EGL_AN DROID_blob_cache

info taken by OpenGL Extensions app from app store for device Mali450 MP4

ARM
Mali-450 MP
OpenGL ES 2.0
GL_EXT_debug_marker GL_OES_texture_npot GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_depth24 GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 GL_OES_vertex_half_float GL_EXT_blend_minmax GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_rgb8_rgba8 GL_EXT_multisampled_render_to_texture GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_ARM_mali_program_binary GL_EXT_shader_texture_lod GL_EXT_robustness GL_OES_depth_texture_cube_map GL_KHR_debug 

info from device with GPU VideoCore IV taken by adb shell dumpsys SurfaceFlinger

GLES: Broadcom, VideoCore IV HW, OpenGL ES 2.0
GL_EXT_debug_marker
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_compressed_paletted_texture
GL_OES_texture_npot
GL_OES_depth24
GL_OES_vertex_half_float GL_OES_EGL_image
GL_OES_EGL_image_external
GL_EXT_discard_framebuffer
GL_OES_rgb8_rgba8
GL_OES_depth32
GL_OES_packed_depth_stencil
GL_EXT_texture_format_BGRA8888
GL_APPLE_rgb_422
EGL implementation : 1.4
EGL_KHR_image
EGL_KHR_image_base
EGL_KHR_image_pixmap
EGL_KHR_vg_parent_image
EGL_KHR_lock_surface
EGL_ANDROID_image_native_buffer
EGL_ANDROID_swap_rectangle EGL_ANDROID_image_native_buffer

Info taken taken by godot 2.1.5 debug for device with GPU VideoCore IV

GL_APPLE_rgb_422
GL_EXT_debug_marker
GL_EXT_discard_framebuffer
GL_EXT_texture_format_BGRA8888
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_compressed_paletted_texture
GL_OES_depth24
GL_OES_depth32
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_texture_npot
GL_OES_vertex_half_float

As additional note, all 3D features of godot 2.1.5 works very well on both devices.

avril-gh commented 6 years ago

might be useful. crash log has been taken from Mali450 MP4 device. project used in test can be found in first post of this issue (test7.zip) in crash test Cube.tscn has been added to scene and simple cube has been hidden (Cube.tscn is included in project folder but not added to scene by default)

godot_crash_log_android_mali450MP4_logcat.zip

avril-gh commented 6 years ago

closing since it seems fixed at current time. (The objects are visible now, and error spam is gone)