-
Notifications
You must be signed in to change notification settings - Fork 136
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] Upgrade to Embind Bindings #12
base: feat-typescript
Are you sure you want to change the base?
Conversation
This branch-in-progress grabs [the latest `embind` version from the opencascade.js repo](https://github.com/donalffons/opencascade.js/tree/embind). Thes new bindings will support much better error message reporting and detailed intellisense and typescript documentation. The bindings and WASM are mirrored through githack to bypass CORS, but it may add a small (couple minute) delay to changes.
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/zalo/cascade-studio/vJqXS1im1weuHDY2PvxAcfAvusWp |
Yeek that was miserable..
Awesome 🙂. Can't wait for this to be fully functional! |
@donalffons It's probably better to move iteration talk here rather than a closed/merged PR ( donalffons/opencascade.js#8 (comment) ). The good news: The bad news: My primary worries (in addition to the typescript definitions) are the expanded size of the binaries and the regressions in boolean operations in 7.4.0p1. CascadeStudio (which wasn't terribly fast, to begin with) now feels fairly sluggish. A fair number of things changed in the Embind PR (the OCCT version (7.4.0->7.4.0p1), compiler (optimizations?), binding system, number of exposed functions, etc.). And I'd like to help you get to the bottom of this. Suggestion 1:If it's not too much trouble, a "lite" version of the bindings (which is restricted to: Perhaps even a flag in the build script that distinguishes between "lite" and "full" versions of the library, so it can be switched at compile-time by the "user"! Suggestion 2:Revert back to the older OCCT commit (for now). The biggest modeling "feature highlights" for 7.3.0 are actually regressions when tested in the editor (see the last bullet point of the first post for the live model links). This gif of a The face around the cylinder appears to be malformed in the 7.4.0p1 version. |
I appreciate you sharing your thoughts and concerns... OCCT VersionsTo avoid confusion:
New "lite"-builds
Binary size, typescript, boolean
Binary size Typescript definitions Boolean regressions |
A new build of the "full" version has been published as @zalo, are you considering to update to the new version in CascadeStudio? As you know, this would be a breaking change for your project, due to some API changes. |
That gif is it re-tessellating on the fly? That's awesome. |
Yes, you can try it here. |
@donalffons Wow! I can hardly believe it's regenerating that whole model with every refresh! It looks quite fast! I spent some time today porting this into my new project (still not public yet, unfortunately) and I have a few questions:
The typescript definitions have been utterly invaluable for updating my module-based project; I'm hoping that they'll be similarly helpful for CascadeStudio :-) |
Just updated this branch to your new beta as well. You should even be able to see the new library's intellisense (under the Some operations are a little more brittle without the fuzzy values and tactical |
This doesn't work?! That probably means that the patches are not applied properly (once again). I will look into that.
I guess you probably want to use this move constructor?! That's not supported bindings-auto-generator. Since this is a templated method, I would have to generate one binding for every possible value of that type parameter (The
Help would be much appreciated, of course. It shouldn't be too complicated to do this. I added a ticket for that, too and just posted some more detailed information there. Let me know if you want to give this a shot. If not, I will do it (eventually 😉). |
I (think I) finally fixed the issues with |
...just a note: I just managed to get the multi-threaded build running with the bottle example. Besides the fact that it's quite messy to set up (loading a "normal" js module, a web worker and a wasm file and making sure that they all know about each other), there is very little difference in performance in this case. In this test, multi-threading is only applied during the tessellation phase. In single-threaded mode, each call to I think in this particular case, the tessellation is just not the real bottleneck. |
Hopefully the WASM -> Worker -> Main thread communication overhead isn't too high; I know workers like to serialize everything to JSON and back unless SharedArrayBuffers are used. I have seen what I think is tessellation take longer on some of the more complex .STEP files I've loaded in; perhaps it will yield a stronger signal? |
There's probably quite a bit of overhead involved with threading, since that's not natively supported in WASM (yet) and Emscripten basically does a work-around using web workers. I would expect this to use quite a bit more memory, too. After your comment, I made another quick test passing in a By the way, none of the currently released builds have multi-threading enabled. There's currently just this build (in the build artifacts) where I tested it. Enabling that feature requires to make an entire build from scratch (i.e. rebuilding the Docker Image with the correct flags), as the intermediate build products ( |
Given the limitations that Safari often exhibits around webworkers (and the minimal improvements) it's probably better to leave it out for now to reduce headaches; as far as CascadeStudio goes, I'd probably keep it disabled if there was any instability at all anyways. |
The fact that |
Why is Quantity_AbsorbedDose used in-place of Standard_Real?
Thank you for taking a look at that! That does indeed restore the I noticed the latest beta also has some funniness with the types going on; it seems like |
...that's certainly not intended. I will have a look and correct that behavior. Thanks for letting me know! |
THIS PR IS A WORK IN PROGRESS; SOME FUNCTIONALITY IS BROKEN
This branch-in-progress uses the newer
embind
version from the opencascade.js repo.The Embind refactor has a number of Pros and Cons:
Pros:
Cons:
Function_X()
variants which can be very annoying to manage (but it's not a deal-breaker with typescript definitions)..get()
to dereference...Feel free to make PRs into this PR.