bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
33.41k stars 3.26k forks source link

android mobile example blackscreen #8874

Open funsafe-ptr opened 1 year ago

funsafe-ptr commented 1 year ago

Bevy version

84de9e7f28bfaaba8e0eef4ecf185ce795add9e2

Rust version

rustc 1.70.0 (90c541806 2023-05-31) (built from a source tarball)

Relevant system information

SystemInfo { os: "Android 8.1.0 CPH1909", kernel: "4.9.77+", cpu: "", core_count: "8", memory: "2.7 GiB" } TERMUX_VERSION=0.118.0 AdapterInfo { name: "PowerVR Rogue GE8320", vendor: 0, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl } Vulkan support: no OpenGL: OpenGL ES 3.2 build 1.9@4971894

Extensions ```ignore GL_EXT_debug_marker GL_ANDROID_extension_pack_es31a GL_EXT_blend_minmax GL_EXT_buffer_storage GL_EXT_clear_texture GL_EXT_color_buffer_float GL_EXT_conservative_depth GL_EXT_copy_image GL_EXT_discard_framebuffer GL_EXT_draw_buffers GL_EXT_draw_buffers_indexed GL_EXT_draw_elements_base_vertex GL_EXT_float_blend GL_EXT_geometry_point_size GL_EXT_geometry_shader GL_EXT_gpu_shader5 GL_EXT_multi_draw_arrays GL_EXT_multisampled_render_to_texture GL_EXT_occlusion_query_boolean GL_EXT_polygon_offset_clamp GL_EXT_primitive_bounding_box GL_EXT_pvrtc_sRGB GL_EXT_read_format_bgra GL_EXT_robustness GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_group_vote GL_EXT_shader_io_blocks GL_EXT_shader_non_constant_global_initializers GL_EXT_shader_pixel_local_storage GL_EXT_shader_pixel_local_storage2 GL_EXT_shader_texture_lod GL_EXT_sparse_texture GL_EXT_sRGB_write_control GL_EXT_tessellation_point_size GL_EXT_tessellation_shader GL_EXT_texture_border_clamp GL_EXT_texture_buffer GL_EXT_texture_cube_map_array GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_sRGB_decode GL_EXT_texture_sRGB_R8 GL_EXT_texture_sRGB_RG8 GL_EXT_YUV_target GL_IMG_bindless_texture GL_IMG_framebuffer_downsample GL_IMG_multisampled_render_to_texture GL_IMG_program_binary GL_IMG_read_format GL_IMG_shader_binary GL_IMG_texture_compression_pvrtc GL_IMG_texture_compression_pvrtc2 GL_IMG_texture_format_BGRA8888 GL_IMG_texture_npot GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_KHR_debug GL_KHR_robustness GL_KHR_texture_compression_astc_ldr GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_depth_texture GL_OES_draw_buffers_indexed GL_OES_draw_elements_base_vertex GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_image_external_essl3 GL_OES_EGL_sync GL_OES_element_index_uint GL_OES_fragment_precision_high GL_OES_geometry_point_size GL_OES_geometry_shader GL_OES_get_program_binary GL_OES_gpu_shader5 GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_required_internalformat GL_OES_rgb8_rgba8 GL_OES_sample_shading GL_OES_sample_variables GL_OES_shader_image_atomic GL_OES_shader_io_blocks GL_OES_shader_multisample_interpolation GL_OES_standard_derivatives GL_OES_surfaceless_context GL_OES_tessellation_point_size GL_OES_tessellation_shader GL_OES_texture_border_clamp GL_OES_texture_buffer GL_OES_texture_cube_map_array GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_npot GL_OES_texture_stencil8 GL_OES_texture_storage_multisample_2d_array GL_OES_vertex_array_object GL_OES_vertex_half_float GL_OVR_multiview GL_OVR_multiview2 GL_OVR_multiview_multisampled_render_to_texture ```

What you did

git clone --depth 1 https://github.com/bevyengine/bevy cd examples/mobile/ cargo apk b

What went wrong

black screen

Additional information

Logcat ```ignore 06-18 02:40:20.302 24895 24913 E event crates/bevy_gilrs/src/lib.rs:36: Failed to start Gilrs. Gilrs does not support current platform. 06-18 02:40:20.322 24895 24913 E vulkan : invalid vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceVersion") call 06-18 02:40:20.322 24895 24913 E vulkan : invalid vkGetInstanceProcAddr(VK_NULL_HANDLE, "vkEnumerateInstanceVersion") call 06-18 02:40:20.328 24895 24913 D vulkan : searching for layers in '/data/app/org.bevyengine.example-3b6OVOHezVb3UaNIrlFH2g==/lib/arm64' 06-18 02:40:20.328 24895 24913 D vulkan : searching for layers in '/data/app/org.bevyengine.example-3b6OVOHezVb3UaNIrlFH2g==/base.apk!/lib/arm64-v8a' 06-18 02:40:20.410 24895 24913 I event crates/bevy_render/src/renderer/mod.rs:133: AdapterInfo { name: "PowerVR Rogue GE8320", vendor: 0, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl } 06-18 02:40:20.442 24895 24913 W log event: TODO: forward onStart notification to applicationlog.target = "winit::platform_impl::platform"; log.module_path = "winit::platform_impl::platform"; log.file = "/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.28.6/src/platform_impl/android/mod.rs"; log.line = 449; 06-18 02:40:20.524 24895 24913 I event crates/bevy_winit/src/system.rs:51: Creating new window "Bevy App" (0v0) 06-18 02:40:20.526 24895 24930 I event crates/bevy_diagnostic/src/system_information_diagnostics_plugin.rs:130: SystemInfo { os: "Android 8.1.0 CPH1909", kernel: "4.9.77+", cpu: "", core_count: "8", memory: "2.7 GiB" } 06-18 02:40:20.570 24895 24895 I Choreographer: Skipped 1 frames! The application may be doing too much work on its main thread. 06-18 02:40:20.580 24895 24913 D Surface : Surface::connect(this=0x7f00beb000,api=1) 06-18 02:40:20.580 474 525 I BufferQueueProducer: [org.bevyengine.example/android.app.NativeActivity#0](this:0x79b11a8800,id:3852,api:1,p:24895,c:-1) connect(P): api=1 producer=(24895:org.bevyengine.example) producerControlledByApp=true 06-18 02:40:20.585 466 490 I vendor.mediatek.hardware.power@1.1-impl: PowerHint hint:8, data:0 06-18 02:40:20.586 466 489 I libPerfService: 8: set gpu level: 2 06-18 02:40:20.586 24895 24912 I RustStdoutStderr: thread '' panicked at 'Error in Surface::configure: Validation Error 06-18 02:40:20.587 24895 24912 I RustStdoutStderr: 06-18 02:40:20.587 24895 24912 I RustStdoutStderr: Caused by: 06-18 02:40:20.587 24895 24912 I RustStdoutStderr: Downlevel flags DownlevelFlags(SURFACE_VIEW_FORMATS) are required but not supported on the device. 06-18 02:40:20.587 24895 24912 I RustStdoutStderr: This is not an invalid use of WebGPU: the underlying API or device does not support enough features to be a fully compliant implementation. A subset of the features can still be used. If you are running this program on native and not in a browser and wish to work around this issue, call Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current platform supports. 06-18 02:40:20.587 24895 24912 I RustStdoutStderr: ', /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.1/src/backend/direct.rs:734:18 06-18 02:40:20.587 24895 24912 I RustStdoutStderr: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 06-18 02:40:20.606 24895 24912 I RustStdoutStderr: Encountered a panic in system `bevy_render::view::window::prepare_windows`! 06-18 02:40:20.707 24895 24912 I RustStdoutStderr: thread 'Compute Task Pool (1)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:135:45 ```
blaind commented 3 months ago

I suspect this is caused by:

edit:

SURFACE_VIEW_FORMAT seems to be related to the create_view wgpu method, possible cause in https://github.com/bevyengine/bevy/blob/v0.13.0/crates/bevy_render/src/view/window/mod.rs#L86 ?

sercand commented 1 month ago

https://github.com/hrydgard/wgpu-winit-android-example/tree/main

This wgpu example works on the same Android device but crashes for the Bevy project. This project handles sRGB swapchains correctly but bevy forces sRGB formats aggressively on most places.