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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

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.

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

None yet

2 participants