-
Notifications
You must be signed in to change notification settings - Fork 511
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
WIP: Add an Emscripten port #419
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This crashes somewhat reproducibly on Firefox 66.0.3 (64-bit) while rotating the view around with the middle button:
|
@q3k Yes, this is a known issue in wasm. I'd need to look at a way to make overflowing float to integer conversions defined without losing performance or compatibility. |
I've updated the branch to use upstream (i.e. LLVM's) wasm support in emscripten. This results in a very nice 5.5 MB deployable binary when built with |
Just want to tell you that this is super awesome!! Love seeing things like this being ported to the web =) |
The solver is already buildable separately. I think you can just use current code from master with possibly minor modifications if you want to use it in your own WASM application. |
How is this going. I played with the demo but it seems to have a offset on the mouse pointer location. |
@mmiscool I haven't spent much time on this PR as other SolveSpace issues seemed more important. Which browser are you using? In general, this PR probably won't be usable with real world designs until something is done with savefiles, which is a rather large task; right now there is no way to load an assembly in the web version even in principle. |
@whitequark I am using google chrome.
For file management have you looked at using local storage? The solvespace file format is just text at the moment, I could put together some javascript to handle file management. |
I'm well aware of local storage. I don't consider a solution that is limited to 5 MB of total model size (which is easily exceeded as SolveSpace serializes triangle mesh to text with high decimal precision) and requires manual synchronization between browser and desktop acceptable. |
That's a known issue. IIRC Chrome flat out broke the devicePixelRatio API several months back, at some point after I did the port. |
Assembly files can be opened one-by-one through openfile dialog. Hard, but then we can save all the assemby into one metafile (zipped folders for ex). |
Again, I don't consider that solution acceptable.
This has been the plan for the new file format for a long time, and once this is implemented, then emscripten port can actually be released. |
I would be interested in abstracting the file storage with a bit of javascript. I have another project that uses a database for managing storage of parts from a multi cad environment. If file storage was done with an array of objects that could be accessed with the addition of some javascript it would be great. |
Is that for Autodrop3d? I understand that it would be convenient for your project, but I don't think it's the right choice for upstream SolveSpace. That said, I think you'll find it fairly easy to implement file operations in a similar way to other JavaScript implementations of platform APIs, and if not, I will gladly assist you with that. |
@whitequark |
Cool! I'll see how much of that could be integrated. |
I've rebased the branch on master and fixed a few minor issues. |
dfb96de
to
3f09eaf
Compare
If anyone's interested in this Emscripten port, I've rebased this commit against current master and fixed a few errors caused by emscripten breaking changes, such as the DOM library now using |
@whitequark I think you will be glad to hear that after @verylowfreq picked up the Web emscripten port in #1275, it is now merged in trunk here 7415048a5769c78fc4bb02afa426d101059374d . He also has saving and opening of files and gestures (for touch screens/phones/tablets) working here: It still remains very experimental, but is usable for single file projects. With this I am closing this pull request. Thank you for all the great work - I can not say this enough times :-) |
More improvements in #1308 and #1310 Known issues from @whitequarkThe major missing features are:
The following are known bugs:
Additionally, there are some Firefox-specific issues:
Known issues from @verylowfreq
|
Overview
The purpose of this pull request is to give some visibility to the Emscripten port that has so far quietly existed as a branch. Its status is an early preview; enough things work that it demonstrates the concept is sound, but it cannot be used for anything useful yet. Try it out!
Other than the issues listed below, everything works to my knowledge, and it's reasonably fast. If you encounter a bug not listed, or pathological slowness, please report it in a comment.
Known issues
The major missing features are:
need to bemay be rewritten with callbacks. It is also possible to use "new Asyncify" as of 2020, and might be preferable to do so.The following are known bugs:
Additionally, there are some Firefox-specific issues:
Working on the port
The missing features can all be quickly located in the codebase by searching for the regex
FIXME\((async|emscripten)\)
. The instructions for building it are located in the updatedREADME.md
in this branch.If you implement a missing feature (please do!) you can send it as a PR against this branch.
Note on JavaScript libraries
When I was just starting on this port I was looking at implementing the HTML part of the UI in ways consistent with modern JavaScript development. My conclusion is that these are not compatible with the practices that SolveSpace generally uses and results in avoidable inessential complexity and general bloat. I am specifically opposed to using things like npm, babel, ES5, Web Components, React/Preact/Vue, and so on for this port.
My decision was to build it in standard HTML and JS; the SolveSpace platform UI implementation requires very little code and completely eliminating any build dependencies other than Emscripten provides a lot of robustness as well as simplifies things greatly. Plus, it's not really hard; the DOM manipulation and event handling functions required by the platform UI implementation are pretty consistent among all modern browsers.