The backend now works in a similar way to the msl backend
Should require less loops, allocations and backtracking
Overall just better to work with it
Added a build script which reads a file with the glsl keywords and
generates a slice to be used in the Namer
Added a way to build a call graph
1037: Add Ids to PassErrorScope r=kvark a=scoopr
Also makes it pub, and the places it is used.
Tweak some error messages.
Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
1036: Stop using Borrow<RefCount> r=scoopr a=kvark
**Connections**
Follow-up to #931
**Description**
Takes advantage of the new `trait Resource` in the state tracker, reducing the code.
**Testing**
Not tested outside of `cargo test`
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
631: Temporarily use `BackendBit::PRIMARY` in examples r=kvark a=grovesNL
`BackendBit::all()` allows GL/surfman to be used on macOS which appears to prevent rendering with Metal (e.g. hello-triangle displays an empty window).
surfman will be removed in later versions of gfx, which will allow us to switch back to `BackendBit::all()` in the examples.
Co-authored-by: Joshua Groves <josh@joshgroves.com>
`BackendBit::all()` allows GL/surfman to be used on macOS which appears
to prevent rendering with Metal (e.g. hello-triangle displays an empty
window).
surfman will be removed in later versions of gfx, which will allow us
to switch back to `BackendBit::all()` in the examples.
617: Add labels for some error messages r=kvark a=scoopr
This places some pieces on how to transform the ids in the errors to a label, and adds them to the validation 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.
Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
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.
1033: Missing label queries r=kvark a=scoopr
I missed few bits needed for labeling the resources in the errors.
Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
931: Retain labels for resources r=kvark a=scoopr
This is wip, mostly a conversation starter.
I've attempted to have some labels show up in the errors, outside of only creation errors.
Steps to do that include,
1. Retain the label in the underlying struct (here, `Buffer`). It is guarded by `debug_assertions`
2. Add the label option to the error variant, and show it
3. Add label option to the `Element::Error` variant, so that invalid ids retain the label also. Didn't guard it with `debug_assertions` yet, but probably should. `buffer_error` now takes the label option.
4. Added a query for invalid id labels
5. Add `Global::buffer_label` for returning the label from the struct, or the invalid id.
6. Change the error variants to query the `buffer_label` when creating the error
with that (and little bit of fudging to get in to the error state), I can get
```
wgpu error: Validation error
Caused by:
In CommandEncoder::copy_buffer_to_buffer
buffer (0, 1, Metal) (label: Some("Staging buffer")) is invalid
```
instead of
```
wgpu error: Validation error
Caused by:
In CommandEncoder::copy_buffer_to_buffer
buffer (0, 1, Metal) is invalid
```
Some of the hub handling etc. is a bit iffy for me, I really have no idea what I'm doing.
The point would be to massage this to the point that there would be a simple steps to follow on how to decorate all the errors with labels to whatever they refer to.
Other ideas I had, included trying to have `impl Debug for Id<BufferId>` to print out the label (from the struct, wouldn't work for invalid ids), but in that context I don't think I have access to the Global, so I'm not sure how resolve the id to anything useful. I suppose there could a whole separate singleton storage for id to label maps which could be easier to access in any context. Then the errors could just store the Id, and not have a separate label field.
Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
627: Fixed size in "boids" example r=kvark a=infinitesnow
Buffer size is specified in number of items instead of bytes and fails validation against compiled SPIR-V
Co-authored-by: infinitesnow <3xplosive.g@gmail.com>
624: Remove implicit conversion hello-triangle shader.vert r=kvark a=Napokue
Remove implicit conversion to float, and change it to explicit conversion. Reason for this change is to prepare the hello-triangle example for Naga glsl-spirv path.
Co-authored-by: Timo de Kort <dekort.timo@gmail.com>