-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
base: main
Are you sure you want to change the base?
WebGPU: Add uncapturedErrorCallbackInfo to requestDevice descriptor #22044
Conversation
25fcf04
to
72207ea
Compare
@kainino0x This PR is ready for review now. |
src/library_webgpu.js
Outdated
assert(typeof GPUValidationError != 'undefined'); | ||
assert(typeof GPUOutOfMemoryError != 'undefined'); | ||
#endif | ||
if (ev.error instanceof GPUValidationError) type = Validation; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
src/library_webgpu.js
Outdated
// WGPUErrorType type, const char* message, void* userdata | ||
var Validation = 0x00000001; | ||
var OutOfMemory = 0x00000002; | ||
var type; |
There was a problem hiding this comment.
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 }}}
There was a problem hiding this comment.
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*) { |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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 ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe https://dawn-review.googlesource.com/c/dawn/+/192741 should help
Following up on https://github.com/beaufortfrancois/webgpu-cross-platform-app/pull/7/files#r1602327969, I'm adding
uncapturedErrorCallbackInfo
to requestDevice descriptor.