bors[bot] 9e81e3d6ef [rs] Merge #547
547: Implement on_uncaptured_error  r=kvark,cwfitzgerald a=scoopr

This is very crude at the moment, I'm mostly just checking if the directions is at all viable.

So I set out to implement `on_caught_error`, focusing solely on the direct backend. It just accepts a `Fn(GPUError)` (and I named it GPUError because I didn't yet want to rename the import of `std::error::Error`).

I store the handler in a `ErrorSinkRaw` struct, which is then wrapped in Arc+Mutex, with the idea that other resources can point to the same Arc, so when `Device::on_uncaught_error` is called mid application, all resources will point to the right place. Otherwise I think something like `Buffer::unmap` would have to find the `Device` it was created with, to find the uncaught handler.

Now I store the `ErrorSink` in the `Device` struct, because it is a convenient place to hold it. But I guess it is a bit nonsensical with the web backend, so either it would need to be `cfg(not(wasm32))`, or move the whole thing in the backend side, but in the direct backend, I don't see a convenient place to store the closure. But the unwrapping is done in direct backend, so it can't really be moved up in to wgpu-core either, unless the error handling overall is moved there.

Also related, I'm now passing the `error_sink` argument to the few methods where I implemented the error handling, which I think is a bit ugly, but it works.

Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2020-09-05 16:02:20 +00:00
2020-09-05 16:02:20 +00:00
2020-04-26 18:59:48 -02:30
Description
No description provided
137 MiB
Languages
Rust 79.9%
WGSL 16.2%
HLSL 2%
GLSL 1.7%
JavaScript 0.2%