taisei-project / taisei

A free and open-source Touhou Project fangame
https://taisei-project.org/
Other
1.12k stars 97 forks source link

Emscripten: Can't play on Pale Moon #345

Closed jobbautista9 closed 1 year ago

jobbautista9 commented 2 years ago

I'm using Pale Moon 31.1.0 on GNU/Linux, and the game's web version can't get past the loading screen. It pops-up the following error for me:

Taisei: fatal error

Required shader object 'sprite_default.frag' couldn't be loaded

For more information, see the log file at /persistent/storage/log.txt

Please report the problem to the developers at https://taisei-project.org/ if it persists.

And after exiting out of the popup, the loading screen shows the following error: Error: RuntimeError: abort(undefined). Build with -s ASSERTIONS=1 for more info.

pirate486743186 commented 2 years ago

The problem is most likely in palemoon. At this point it doesn't properly implement modern web standards.

StarWitch commented 1 year ago

Unfortunately, Pale Moon does not implement WebGL in a way that is conducive to running Taisei, and there's not much we can do about that.

See: https://linuxreviews.org/Modern_Web_Standards_Are_Leaving_Niche_Web_Browsers_Behind#Performance

Closing for now.

jobbautista9 commented 1 year ago

FWIW the game runs happily on the latest version of Pale Moon (32.1.0) with Windows x64. Still no joy in GNU/Linux.

I've done some digging, and looking at the troubleshooting info PM gives me, it seems that our Linux builds still uses GLX by default instead of EGL. That might explain why the game works on Windows (where the troubleshooting info says the browser is using EGL) but not on Linux. No promises that this will be fixed on our end, but I will do some investigation on what bugs to backport to the browser's platform as Firefox ESR on Linux clearly defaults to EGL whether it's using WebRender or OpenGL.

Btw that article you linked is outdated as we've made several improvements on the browser since that was written, notably we (finally) support WebComponents now and full ECMAScript support up to 2020 (except for BigInt).

EDIT: Actually scratch the EGL idea; I've tested Firefox 91 ESR (which doesn't enable EGL by default in X11), and the game still runs. So it might be something else, which is both a blessing as my research on Mozilla's implementation of EGL support in X11 tells me that this is going to be a hell of an undertaking to backport, and a curse because I have no idea where to look...

jobbautista9 commented 1 year ago

Hmm I just tested with Pale Moon on WSL2, and the game runs perfectly fine. I wonder if it's something wrong with my Linux system specifically... Oh well, sorry for the noise!

Akaricchi commented 1 year ago

@jobbautista9 seems like the shader failed to compile, which could be an issue with your GPU driver and/or WebGL implementation. There should be a compilation log in the javascript console (or under the "Show log" checkbox); can you please try to locate it?

jobbautista9 commented 1 year ago

The fatal error occurs before the part where it could show me the "Show log" checkbox... However it seems it has been outputting to the F12 Browser Console all along, different from the Toolkit Error Console where I usually check. If I knew about that I would've included this information from the very start, whoops. Here's the log:

[STATUS] All downloads complete.  taisei.js:6:1
[STATUS] Girls are now downloading, please wait warmly…  taisei.js:6:1
[STATUS] Preparing… taisei.js:6:1
[STATUS] All downloads complete.  taisei.js:6:1
[STATUS] Running…  taisei.js:6:1
0         I: main: Girls are now preparing, please wait warmly...  taisei.js:4:373
8         I: vfs_sync_callback: Loaded persistent storage from IndexedDB  taisei.js:4:373
8         I: vfs_setup_fixedpaths_onsync: Resource path: /data  taisei.js:4:373
10        I: vfs_setup_fixedpaths_onsync: Storage path: /persistent/storage  taisei.js:4:373
12        I: vfs_setup_fixedpaths_onsync: Cache path: /persistent/cache  taisei.js:4:373
16        I: log_version: Taisei v1.3.2-1-g0543a2c0-v1.3.x release  taisei.js:4:373
18        I: log_system_specs: CPU count: 1  taisei.js:4:373
20        I: log_system_specs: CacheLine size: 128  taisei.js:4:373
20        I: log_system_specs: RDTSC: 0  taisei.js:4:373
20        I: log_system_specs: Altivec: 0  taisei.js:4:373
22        I: log_system_specs: MMX: 0  taisei.js:4:373
22        I: log_system_specs: 3DNow: 0  taisei.js:4:373
22        I: log_system_specs: SSE: 0  taisei.js:4:373
24        I: log_system_specs: SSE2: 0  taisei.js:4:373
24        I: log_system_specs: SSE3: 0  taisei.js:4:373
24        I: log_system_specs: SSE4.1: 0  taisei.js:4:373
24        I: log_system_specs: SSE4.2: 0  taisei.js:4:373
26        I: log_system_specs: AVX: 0  taisei.js:4:373
26        I: log_system_specs: AVX2: 0  taisei.js:4:373
26        I: log_system_specs: NEON: 0  taisei.js:4:373
28        I: log_system_specs: RAM: 2048 MB  taisei.js:4:373
28        I: log_lib_versions: Compiled against zlib 1.2.11  taisei.js:4:373
28        I: log_lib_versions: Using zlib 1.2.11  taisei.js:4:373
30        I: log_lib_versions: Compiled against libpng 1.6.37  taisei.js:4:373
30        I: log_lib_versions: Using libpng 1.6.37  taisei.js:4:373
32        I: init_sdl: SDL initialized  taisei.js:4:373
32        I: init_sdl: Compiled against SDL 2.0.12  taisei.js:4:373
32        I: init_sdl: Using SDL 2.0.12  taisei.js:4:373
34        W: taskmgr_create: SDL_CreateMutex() failed: SDL not built with thread support  taisei.js:4:373
34        I: gamemode_init: Compiled without GameMode integration  taisei.js:4:373
34        I: time_init: Using the system high resolution timer  taisei.js:4:373
36        I: video_init_sdl: Available video drivers: emscripten dummy  taisei.js:4:373
36        I: video_init_sdl: Trying preferred driver #1: emscripten  taisei.js:4:373
36        I: video_init: Using driver 'emscripten'  taisei.js:4:373
42        I: glcommon_check_capabilities: OpenGL version: OpenGL ES 3.0 (WebGL 2.0)  taisei.js:4:373
42        I: glcommon_check_capabilities: OpenGL vendor: Mozilla  taisei.js:4:373
44        I: glcommon_check_capabilities: OpenGL renderer: Mozilla  taisei.js:4:373
46        I: glcommon_check_capabilities: OpenGL unmasked vendor: Unknown  taisei.js:4:373
46        I: glcommon_check_capabilities: OpenGL unmasked renderer: Unknown  taisei.js:4:373
48        I: glcommon_check_capabilities: GLSL version: OpenGL ES GLSL ES 3.00 (WebGL GLSL ES 3.00)  taisei.js:4:373
48        I: glcommon_check_capabilities: Supported extensions: EXT_color_buffer_float EXT_texture_filter_anisotropic OES_texture_float_linear WEBGL_compressed_texture_etc WEBGL_compressed_texture_s3tc WEBGL_lose_context MOZ_WEBGL_lose_context MOZ_WEBGL_compressed_texture_s3tc GL_EXT_color_buffer_float GL_EXT_texture_filter_anisotropic GL_OES_texture_float_linear GL_WEBGL_compressed_texture_etc GL_WEBGL_compressed_texture_s3tc GL_WEBGL_lose_context GL_MOZ_WEBGL_lose_context GL_MOZ_WEBGL_compressed_texture_s3tc  taisei.js:4:373
48        W: glcommon_ext_clear_texture: Extension not supported  taisei.js:4:373
50        I: glcommon_ext_color_buffer_float: Using GL_EXT_color_buffer_float  taisei.js:4:373
50        W: glcommon_ext_debug_output: Extension not supported  taisei.js:4:373
50        I: glcommon_ext_depth_texture: Using core functionality  taisei.js:4:373
52        I: glcommon_ext_draw_buffers: Using core functionality  taisei.js:4:373
52        W: glcommon_ext_float_blend: Extension not supported  taisei.js:4:373
52        I: glcommon_ext_instanced_arrays: Using core functionality  taisei.js:4:373
54        I: glcommon_ext_pixel_buffer_object: Using core functionality  taisei.js:4:373
54        I: glcommon_ext_texture_filter_anisotropic: Using EXT_texture_filter_anisotropic  taisei.js:4:373
54        I: glcommon_ext_texture_float_linear: Using GL_OES_texture_float_linear  taisei.js:4:373
56        W: glcommon_ext_texture_half_float_linear: Extension not supported  taisei.js:4:373
56        W: glcommon_ext_texture_norm16: Extension not supported  taisei.js:4:373
56        W: glcommon_ext_texture_rg: Extension not supported  taisei.js:4:373
56        I: glcommon_ext_vertex_array_object: Using core functionality  taisei.js:4:373
58        W: glcommon_ext_viewport_array: Extension not supported  taisei.js:4:373
58        W: glcommon_build_shader_lang_table_fallback: Can not reliably determine all supported GLSL versions, resorting to guesswork.  taisei.js:4:373
58        I: glcommon_build_shader_lang_table_finish: Supported GLSL versions: 300 es  taisei.js:4:373
60        I: glcommon_check_workaround: Workaround `avoid sampler uniform updates` not needed  taisei.js:4:373
60        I: gl33_init_texunits: Using 32 texturing units (192 available)  taisei.js:4:373
62        I: video_new_window: Created a new window: 800x600 (windowed), on display #0 0  taisei.js:4:373
62        I: video_update_mode_lists: Found display #0: 0  taisei.js:4:373
62        I: video_init: Video subsystem initialized  taisei.js:4:373
64        W: try_create_mutex: SDL_CreateMutex() failed: SDL not built with thread support taisei.js:4:373
74        I: load_font_face: Loaded font '/data/fonts/Exo2-Regular-Taisei.ttf' (face 0)  taisei.js:4:373
74        I: finalize_resource: Loaded font 'standard' from '/data/fonts/standard.font' (permanent)  taisei.js:4:373
88        I: finalize_resource: Loaded shader object 'sprite_default.vert' from '/data/shader/sprite_default.vert.glsl' (permanent)  taisei.js:4:373
92        W: print_info_log:   taisei.js:4:373
== Shader object compilation log (11) ==  taisei.js:4:373
0:8(31): error: no function with name 'texture'  taisei.js:4:373
0:9(57): warning: `webgl_ec40db7ceff3a443' used uninitialized  taisei.js:4:373
  taisei.js:4:373
== End of shader object compilation log (11) ==  taisei.js:4:373
96        E: load_shader_object_end: res/shader/sprite_default.frag.glsl: failed to compile shader object  taisei.js:4:373
96        F: finalize_resource: Required shader object 'sprite_default.frag' couldn't be loaded
Akaricchi commented 1 year ago
0:8(31): error: no function with name 'texture'  taisei.js:4:373

There is definitely something wrong with the shader compiler. The texture() function is an essential builtin in GLSL ES 3.00, though it did not exist in prior versions (WebGL 1). Taisei requires WebGL 2 support, and the browser seems to advertise it.

Can you show me a screenshot of https://webglreport.com/?v=2 and try a few simple WebGL 2 demos?

jobbautista9 commented 1 year ago

I've attached a full page screenshot of WebGL Report and a working screenshot of WebGL Aquarium:

Screen Shot 2023-04-19 at 22 00 51-fullpage

Screenshot_2023-04-19_22-02-32

Here are the results from http://webglsamples.org/WebGL2Samples/:

Akaricchi commented 1 year ago

WebGL Aquarium seems to only use WebGL 2 in VR, from a quick look at the source code; otherwise it's happy to run on WebGL 1.

Seeing that the vast majority of these tests fail ("no output"), it's no surprise that Taisei doesn't work either.