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

WebGPU: Add uncapturedErrorCallbackInfo to requestDevice descriptor #22044

Closed

Conversation

beaufortfrancois
Copy link
Contributor

Following up on https://github.com/beaufortfrancois/webgpu-cross-platform-app/pull/7/files#r1602327969, I'm adding uncapturedErrorCallbackInfo to requestDevice descriptor.

@beaufortfrancois beaufortfrancois marked this pull request as draft June 3, 2024 12:27
@beaufortfrancois beaufortfrancois marked this pull request as ready for review June 4, 2024 07:46
@beaufortfrancois
Copy link
Contributor Author

@kainino0x This PR is ready for review now.

assert(typeof GPUValidationError != 'undefined');
assert(typeof GPUOutOfMemoryError != 'undefined');
#endif
if (ev.error instanceof GPUValidationError) type = Validation;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old code, but let's update it:
Use the compile-time constants like {{{ gpu.ErrorType.Validation }}} instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this part.

// WGPUErrorType type, const char* message, void* userdata
var Validation = 0x00000001;
var OutOfMemory = 0x00000002;
var type;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to {{{ gpu.ErrorType.Unknown }}}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -54,7 +54,11 @@ void GetAdapter(void (*callback)(wgpu::Adapter)) {
}

void GetDevice(void (*callback)(wgpu::Device)) {
adapter.RequestDevice(nullptr, [](WGPURequestDeviceStatus status, WGPUDevice cDevice, const char* message, void* userdata) {
wgpu::DeviceDescriptor desc{};
desc.uncapturedErrorCallbackInfo = {nullptr, [](WGPUErrorType type, char const* message, void*) {
Copy link
Collaborator

@kainino0x kainino0x Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally forgot this but this reminded me - the C++ bindings still don't use the correct types (C++ types instead of C types) and we still have a breaking change planned to fix that. Loko is going to do that soon but we don't have it yet.

In the interest of stability of the Emscripten bindings I suppose we should delay this change for now, since it's just going to have to change again?

(As I think I've mentioned we're going to try to push breaking changes to a single big release down the road as much as possible.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait until @lokokung's 🪄 then ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lokokung @kainino0x Out of curiosity, what's the current status?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Emscripten changes, we recently pulled a fork of Emscripten into Dawn and are planning to make all changes there for a while and eventually upstream all the changes once we are closer to a stable header. As to when/where to land this change though, I'm not entirely sure and will let @kainino0x comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add it to upstream emscripten, if we want, as soon as we are pretty sure the API shape for DeviceDescriptor is stable in Dawn (in both C and C++). But I'm not sure it's really worth it to do incrementally now instead of just waiting until we're doing other changes. In particular, adding fields to the descriptor can break dependent code, if they're not zero-initializing the whole struct. That should be relatively rare and they can just add zero-init but it does add some extra friction to do it now instead of later (IMO).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to #21072 (comment), I believe we can close this issue as next time we upstream changes in Emscripten, uncapturedErrorCallbackInfo will be implemented properly according to #21552 (comment)
@kainino0x What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

@kainino0x kainino0x marked this pull request as draft June 7, 2024 22:45
@kainino0x kainino0x closed this Sep 7, 2024
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