godotengine / godot

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

GLES2 Android "Directional shadow framebuffer status invalid" on Google Nexus 7 / NVIDIA Tegra 3 #26344

Closed qonnop closed 5 years ago

qonnop commented 5 years ago

Godot version: caa42667e (includes recent 01a3dd3)

OS/device including version: Google Nexus 7 (2012) with NVIDIA Tegra 3 (official 5.1.1 "nakasi" image)

Issue description: Followup issue to #24952 Godot splash is ok, black screen afterwards due to invalid directional shadow framebuffer (see relevant logcat output below)

D/libEGL  (20580): loaded /system/lib/egl/libEGL_tegra.so                                                                                                  
D/libEGL  (20580): loaded /system/lib/egl/libGLESv1_CM_tegra.so                                                                                            
D/libEGL  (20580): loaded /system/lib/egl/libGLESv2_tegra.so                                                                                               
I/OpenGLRenderer(20580): Initialized EGL, version 1.4                                                                                                      
D/OpenGLRenderer(20580): Enabling debug mode 0                                                                                                             
V/WindowManager(  510): Adding window Window{2c2d725f u0 SurfaceView} at 4 of 12 (before Window{31e53080 u0 com.example.gles2/org.godotengine.godot.Godot})
W/GodotView(20580): Trying ConfigChooser fallback                                                                                                          
W/GodotView(20580): creating OpenGL ES 2.0 context :                                                                                                       
I/godot   (20580): OpenGL ES 2.0 Renderer: NVIDIA Tegra 3                                                                                                  
E/godot   (20580): **ERROR**: Directional shadow framebuffer status invalid                                                                                
E/godot   (20580):    At: drivers\gles2\rasterizer_scene_gles2.cpp:3332:initialize() - Directional shadow framebuffer status invalid                       
I/ActivityManager(  510): Displayed com.example.gles2/org.godotengine.godot.Godot: +1s803ms                                                                
E/godot   (20580): **WARNING**: Could not create framebuffer!!                                                                                             
E/godot   (20580):    At: drivers\gles2\rasterizer_storage_gles2.cpp:4335:_render_target_allocate() - Could not create framebuffer!!                       

Steps to reproduce: Open sample project and run on tablet

Minimal reproduction project: Same as in #24952: GLES2.zip

qonnop commented 5 years ago

@usbhell Could you check whether your Google Nexus still shows the same issue based on current master?

usbhell commented 5 years ago

Still a problem, audio is playing in the background but screen is black.

I find this line of code returns null which is not correct, but perhaps unsurprising since the screen is black. var img = get_viewport().get_texture().get_data()

usbhell commented 5 years ago

btw I'm getting that "Directional shadow framebuffer status invalid error" in the console on my mac as well. so I dont know if its specific to the NEXUS 7

reduz commented 5 years ago

Can you guys download this (or a similar one) https://play.google.com/store/apps/details?id=com.realtechvr.glview&hl=en_US And paste here the list of extensions supported by Tegra3? Evidently something is needed for 32 bit depth buffers in there.

usbhell commented 5 years ago

I see this is closed, heres the info anyway.

[OpenGL-ES 2.x]

Vendor: NVIDIA Corporation Version: OpenGL ES 2.0 14.01003 Renderer: NVIDIA Tegra 3 GLSL version: OpenGL ES GLSL 1.00 Max. fragment uniform vectors: 1024 Max. vertex uniform vectors: 256 Max. varying vectors: 15 Max. vertex attributes: 16 Max. render buffer size: 3839 Max. texture units: 16 Max. combined texture units: 16 Max. cube map texture size: 2048 Max. texture size: 2048 Max. vertex texture units: 0 Max. viewport dimensions: 3839 x 3839 Shader compiler: yes Subpixel bits: 4 Extensions: GL_OES_rgb8_rgba8 GL_OES_EGL_sync GL_OES_fbo_render_mipmap GL_NV_depth_nonlinear GL_NV_draw_path GL_NV_texture_npot_2D_mipmap GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_vertex_half_float GL_OES_mapbuffer GL_NV_draw_buffers GL_NV_multiview_draw_buffers GL_EXT_Cg_shader GL_EXT_packed_float GL_OES_texture_half_float GL_EXT_texture_array GL_OES_compressed_ETC1_RGB8_texture GL_EXT_texture_compression_latc GL_NV_texture_compression_latc GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc GL_NV_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_NV_get_tex_image GL_NV_read_buffer GL_NV_shader_framebuffer_fetch GL_NV_copy_image GL_NV_fbo_color_attachments GL_EXT_bgra GL_EXT_texture_format_BGRA8888 GL_EXT_unpack_subimage GL_NV_pack_subimage GL_NV_texture_compression_s3tc_update GL_NV_read_depth GL_NV_read_stencil GL_NV_uniform_buffer_object GL_EXT_robustness GL_OES_standard_derivatives GL_NV_EGL_stream_consumer_external GL_NV_3dvision_settings GL_EXT_debug_marker GL_EXT_debug_label GL_NV_coverage_sample GL_EXT_occlusion_query_boolean GL_NV_timer_query

bluetooth_content_share.txt

qonnop commented 5 years ago

It still does not work, but it definitely sets config.depth_internalformat = GL_DEPTH_COMPONENT16; config.depth_type = GL_UNSIGNED_SHORT; in rasterizer_storage_gles2.cpp:4993 now.

The texture size seems to be irrelevant, I also tried with size 512 and 1024 (project settings).

Btw, the storage->config.use_rgba_3d_shadows condition evaluates to false in rasterizer_scene_gles2.cpp:3317, so this cannot not be the cause.

I tried to figure out the difference compared to godot 2.1, where rendering worked, but I did not find the relevant parts yet...

akien-mga commented 5 years ago

Btw, the storage->config.use_rgba_3d_shadows condition evaluates to false in rasterizer_scene_gles2.cpp:3317, so this cannot not be the cause.

That's actually a good hint, as it means you don't support GL_OES_depth_texture (and judging by the logs, neither does @usbhell), so all this logic using GL_DEPTH_COMPONENT in glTexImage2D cannot work.

glTexImage2D in OpenGL ES 2.0 doesn't support GL_DEPTH_COMPONENT format initially: https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glTexImage2D.xml (it does in OpenGL ES 3.0: https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml)

GL_OES_depth_texture adds support for it in OpenGL ES 2.0: https://www.khronos.org/registry/OpenGL/extensions/OES/OES_depth_texture.txt So for your hardware, @reduz will have to come up with an alternative.

Finally the check added in 057d3e8 for GL_OES_depth24 is wrong (and broke rendering for me, reopening #24952), as this extension is only for storage, not for glTexImage2D: https://www.khronos.org/registry/OpenGL/extensions/OES/OES_depth24.txt

@reduz will fix it later today or tomorrow.

akien-mga commented 5 years ago

Can you test if 8799f69 fixes the issue for you?

reduz commented 5 years ago

I am certain it does fix the issue, so closing unless it' s verified it happens again.

qonnop commented 5 years ago

Great! It works! 👍 Thx a lot!

usbhell commented 5 years ago

All working nicely here too, thanks.