-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Failure to build with no-fake-scoped-enums with emscripten #27
Comments
Thanks for reporting this, I have to admit that I undertested this feature. Keeping this open until I fix and add automated tests! Thanks again for your multiple contributions! |
Back at this, I realize that the issue you report is precisely why I had to use fake enums. So if you find a way to work it around properly, I would be happy to switch everything to real enums! Looking at your commit history, I bet you wanted real enums to be able to use ErrorType errorType = /* ... */;
std::cout << "Device error: " << magic_enum::enum_name<WGPUErrorType>(errorType); But of course you will have the |
Yes, you're exactly right. I ended up writing a small utility to cast the fake enum and then strip the leading I've also been working with the Dawn-derived CPP wrapper that comes with current versions of Emscripten, webgpu/webgpu_cpp.h, which I know you're familiar with. Its interface is more basic, and closer to the C API, often passing raw pointers, but it has the advantage that it provides human-readable strongly typed enums, that are still easily convertible to and from the C types. Maybe it's worth duplicating their approach to enums? |
When generating with fake scoped enums disabled, using the latest emscripten webgpu.h, I see multiple compilation errors from the
WEBGPU_CPP_IMPLEMENTATION
section of webgpu.h.To generate:
When building, I get compilation errors such as:
These could be resolved with a change like
backendType = static_cast<WGPUBackendType>(BackendType::Undefined)
.The text was updated successfully, but these errors were encountered: