This adds transforms for the ids in the errors to a label,
and adds them to the validation error message.
This changes the formatting of the validation error to happen when
constructing the error, rather than in the unhandled error handler.
It also requires some code for all the error variants for extracting the ids.
613: Add more context to errors originating in Passes and Encoders r=kvark a=Kimundi
**Description**
This adds some top-level error context information to indicate wether an error originated in a `{Render,Compute}Pass` or `{Command,RenderBundle}Encoder` to make error messages more clear.
Combined with https://github.com/gfx-rs/wgpu/pull/1018, errors in passes will look like this:
```
wgpu error: Validation error
Caused by:
In a RenderPass
In a draw command
index 3600 extends beyond limit 38
```
Co-authored-by: Marvin Löbel <loebel.marvin@gmail.com>
574: Implement AsRef for BufferView r=kvark a=de-vri-es
This PR implements `AsRef` and `AsMut` in addition to `Deref` and `DerefMut` for `BufferView` and `BufferViewMut`.
This allows the buffer views to be used directly by generic code that wants an `AsRef<[u8]>`.
It's also subjectively a small win when you want to pass the views to non-generic code. I find `buffer.as_ref()` clearer than `&*buffer`. That also goes for `buffer.deref()`, but `Deref` is not in the prelude.
Co-authored-by: Maarten de Vries <maarten@de-vri.es>
565: Add context to errors r=kvark a=scoopr
ContextError is just a simple wrapper that contains a string and the original error, and it is used to decorate the error to give it more context.
Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
562: More errorsinkifying r=kvark a=scoopr
Continuing on with errorsinkifying more places, these wrap Buffer, Texture and CommandEncoder with a struct that includes the `error_sink`, and uses it for the error handling.
I think most of the apis are errorsinkified with this. The remaining ones may need some more thinking.
Queue would be wrapped mostly for the submit, the write_ stuff could in theory piggyback on the texture/buffer error-sink.
Others like swapchain, some mapping stuff, etc. needs some discussion or other implementation work.
Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>