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

Building emscripten with GLES is broken #18861

Open
5 of 6 tasks
ethanaobrien opened this issue Feb 13, 2024 · 1 comment
Open
5 of 6 tasks

Building emscripten with GLES is broken #18861

ethanaobrien opened this issue Feb 13, 2024 · 1 comment

Comments

@ethanaobrien
Copy link
Contributor

ethanaobrien commented Feb 13, 2024

Platform

libretro / Retroarch

Compiler and build tool versions

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.53 (ce5114bdd2175c7297583d3c25a53ca95d22f4ce)

Operating system version

Debian GNU/Linux bookworm 12.0 x86_64

Build commands used

Using the patches mentioned here for sub modules, and this commit, disabling GLES, then linking with RetroArch using gles2 causes PPSSPP to run almost flawlessly.

As far as I can tell the emulation itself runs perfectly, playable* as long as you don't need video. Much better than it was a few months ago when I originally tried getting it to run.

And here's the fun part, of course compiling without GLES and targeting gles2 wont work, that was just to get it to run at all.
Currently, if you build with GLES enabled (specifically if you pass the USING_GLES2 definition) the page will freeze upon load. I traced the freeze here where it seems to be waiting on another thread. This only happens when GLES is enabled, with it disabled the emulation runs as well as the browser can handle it, which is suspiring.

To build this:

  1. git clone https://github.com/EmulatorJS/ppsspp.git
  2. git clone https://github.com/EmulatorJS/RetroArch.git
  3. git clone https://github.com/EmulatorJS/EmulatorJS.git
  4. cd ppsspp/libretro/
  5. Apply patches mentioned in Cleanup emscripten libretro target #17779
  6. emmake make clean && emmake make platform=emscripten -j$(nproc)
  7. cp ppsspp_libretro_emscripten.bc ../../RetroArch/dist-scripts/
  8. cd ../../RetroArch/dist-scripts/
  9. emmake ./dist-cores.sh emscripten clean
  10. Open your file explorer and navigate to EmulatorJS/data/cores/ and open the .data file with 7zip, open the .js file (not .worker.js( in a text editor and search for asyncifyStubs. Remove any definitions of this. This errors because of a bug with emscripten where its defined but does not do anything. Removing this definition will fix the issue.
  11. Download this zip to the EmulatorJS/data/cores folder
  12. Launch your favorite web server pointing at the EmulatorJS folder. Be sure to set the headers mentioned here
  13. Edit the core function to always return psp.
  14. Open a web browser and go to http://localhost:8080/index.html?debug=1&threads=1. It should warn you if threads is not properly enabled.
  15. Upload your rom to the page. It will automatically launch the game assuming you did step 13.

Through writing this (40-50 minutes) I've had ppsspp running in the browser with gles disabled (no video) and have had no crashes nor performance decreases (playing the title menu music). The only issue with the emscripten build target is gles.

A demo with gles disabled can be found here.

What happens

gles disabled log (working emulation, black screen):
gles--disabled.log

gles enabled log (freezes page):
gles-enabled.log

PPSSPP version affected

v1.17.1-11-gb41753896

Last working version

No response

Checklist

  • Test in the latest git build in case it's already fixed.
  • Make sure to run git submodule update --init --recursive before building.
  • Search for other reports of the same issue.
  • Try deleting the build directory and running the build again.
  • Check GitHub Actions, which builds every merge and PR.
  • Include logs and help us reproduce.
@hrydgard
Copy link
Owner

Emscripten isn't a platform that the project (or at least I) care about, you're on your own. I'll leave the issue open, though.

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

No branches or pull requests

2 participants