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

Add emscripten support built against patched 2.0.34 emsdk #514

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

thelamer
Copy link

This is an update of toadkings PR here and I cannot take credit for these changes https://github.com/BinBashBanana using toadkings old PR got this all working:
#132

This needs to be built against a specific version of emscripten that has webgl patched.

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install 2.0.34
./emsdk activate 2.0.34
wget https://raw.githubusercontent.com/BinBashBanana/webretro/master/source/patches/emscripten.patch
patch -u -p0 -i emscripten.patch
source emsdk_env.sh

On the retroarch side should be built without ASYNC flagged as is currently defined here: (can be deleted)
https://github.com/libretro/RetroArch/blob/master/Makefile.emscripten#L61C1-L63C6

And with the additional flags:
-s TOTAL_STACK=268435456 -s TOTAL_MEMORY=536870912 -s FULL_ES3=1 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2

The results are very good even on a low end client machine:

n64.mp4

I can rewrite the guards Retroarch side as well but having a viable bc file is the first step.

Let me know if this is possible to mainline I do not have a deep enough understanding of the codebase to see if there are any breaking changes for other ports here, but most of it looks non obtrusive with guards.

@m4xw
Copy link
Collaborator

m4xw commented Jan 24, 2024

I need to check whatever i merged to my main branches already, most things still reside in emscripten_testing branch iirc

@m4xw
Copy link
Collaborator

m4xw commented Feb 5, 2024

Gonna start on this soon

@m4xw
Copy link
Collaborator

m4xw commented Feb 6, 2024

Rebased & Backported some changes onto emscripten_testing branch

@thelamer
Copy link
Author

thelamer commented Feb 7, 2024

Am I reading this correct that you are working on dynarec in emscripten?
That is one of the biggest pain points of nearly every core, the SIMD extensions lacking. Hoping for a breakthrough.

@m4xw
Copy link
Collaborator

m4xw commented Mar 26, 2024

Am I reading this correct that you are working on dynarec in emscripten? That is one of the biggest pain points of nearly every core, the SIMD extensions lacking. Hoping for a breakthrough.

Ahead of time tho, I implemented it through cached interpreter for now so i can compile in parts of the game into the core directly.

Also SIMD seems to work decently with this

@m4xw
Copy link
Collaborator

m4xw commented Mar 26, 2024

-msimd128 -ftree-vectorize -mfpu=neon

@m4xw
Copy link
Collaborator

m4xw commented Apr 11, 2024

This is progressing quite well, still too many changes to push it all but thought i give a small update

@alec4
Copy link

alec4 commented Jul 12, 2024

Hi,
i don't know if this is the right place. But i thought i try it and ask.
How does it look? It would be really cool to have this core also as emscrpten port :)!
Thank you!

@m4xw
Copy link
Collaborator

m4xw commented Jul 15, 2024

Hi, i don't know if this is the right place. But i thought i try it and ask. How does it look? It would be really cool to have this core also as emscrpten port :)! Thank you!

Its looking good, working on getting it on the last toolchain ver next

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

Successfully merging this pull request may close these issues.

3 participants