The purpose of the PR is to support Naga modules everywhere.
As a requirement, it updates the gfx-rs version used.
Most of the logic is dedicated towards building a shader interface,
where previously we just used naga's IR. Now we have our own mini-IR.
966: Immediate resource destruction and freeing r=cwfitzgerald a=kvark
**Connections**
Fixes#964
**Description**
We are making it so a buffer or a texture can have their native resources freed while they are still referenced, so without waiting for GC.
In addition, the PR adds a few missing cases where error IDs should have been handled, like at render pass encoding.
**Testing**
Tested on wgpu-rs examples, see https://github.com/gfx-rs/wgpu-rs/pull/591
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
838: wait for buffer to be done in the player r=cwfitzgerald a=kvark
**Connections**
Fixes our code enough to replay #834 without issues. Doesn't help to solve the original problem though.
**Description**
There are two things in here:
1. don't deduplicate the BGLs if we are not generating new IDs at this layer. This helps Servo/Gecko/player. cc @kunalmohan
2. have an option in `buffer_destroy` to *actually* kill it, at the cost of blocking on GPU sometimes. This is required for the player, since the very next command may try to reuse the ID.
**Testing**
Tested on the trace in #834
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
* Replace &[T] in descriptor structs with Cow<[T]>
* Changed label fields to use Cow<'a, str>
* Deduplicate types across the tracing API
Introduce the ToStatic trait
* Deduplicate trace::RenderBundleDescriptor
* Remove ugly ToOwned bounds
* Simplifiy Action variants
* Make Clone bounds on type defs less verbose
* Fix a error in play.rs
* Remove ToStatic, and Make Action<'a> borrow descriptors instead
813: Add buffer creation error type r=kvark a=GabrielMajeri
**Connections**
Part of #638
**Description**
Adds an error type for the buffer creation functions.
**Testing**
Checked with core and ran test on player.
Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
812: Error type for `WaitIdle` r=kvark a=GabrielMajeri
**Connections**
Part of #638
**Description**
Adds an error type for the `wait_idle` function.
**Testing**
Checked with core.
Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
773: Error handling for data transfer API r=kvark a=GabrielMajeri
**Connections**
Work on the error model described in #376
**Description**
Removes assertions from the transfer functions, instead returning a custom error type.
**Testing**
Checked with `player` and `wgpu-rs`: https://github.com/gfx-rs/wgpu-rs/pull/430
Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
763: Remove raw pointers from the render pipelines API r=kvark a=GabrielMajeri
**Connections**
Rust-ification of API, as part of #689
**Description**
The objective is to get rid of raw pointers in the render pipeline descriptor and associated structures.
**Testing**
Checked with `player` and the `trace` feature, and with `wgpu-rs` with the changes in https://github.com/gfx-rs/wgpu-rs/pull/425
Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
739: Remove Peek-Poke r=cwfitzgerald a=kvark
**Connections**
Related to https://github.com/gfx-rs/wgpu/issues/738
Related to https://github.com/djg/peek-poke/issues/10
**Description**
As of #726 , the buffers have a minimum binding size that has to include the shader struct size. It, therefore, can't be zero.
We can remove the hacks we had previously and switch fully to the idiomatic `Option<NonZeroU64>`.
Peek-poke doesn't `NonZeroU64` and friends, so this made me reconsider the user of it entirely. Today, render bundles as well as the Player already represent command streams using a much rustier method. I tried to move everything to this method now, and I think this is going to work much better, and safer.
**Testing**
wgpu-rs works - https://github.com/gfx-rs/wgpu-rs/pull/396
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
There was a lot of highly unsafe use of serialization based on peek-poke that we
weren't entirely happy with. It's replaced by just serializing the passes now.
Also, switch BufferSize to Option<NonZero>.
This is a major change in how the bundles are implemented. Instead of
transparently injecting them into the pass command stream, we are now
treating bundles as first-class API objects and API tracing them
accordingly. The bundle contains a normalized command stream that is
very easy to inject into a native command buffer multiple times.
704: Pipeline layout validation r=cwfitzgerald a=kvark
**Connections**
Implements a solid part of #269
Starts converting the function to return results, related to #638
cc @GabrielMajeri
**Description**
This change matches shader bindings against the pipeline layout. It's *mostly* complete, minus some bugs and not handling the `storage_texture_format` properly.
The risk here is that Naga reflection may have bugs, or our validation may have bugs, and we don't want to break the user content while this is in flux. So the PR introduces an internal `WGPU_SHADER_VALIDATION` environment variable. Switching it to "0" skips Naga shader parsing completely and allows the users to unsafely use the API.
Another aspect of the PR is that some of the functions now return `Result`. The way I see us proceeding is that any errors that we don't expect users to handle should result in panics when `wgpu` is used natively (i.e. not from a browser). These panics would happen in the "direct" backend of wgpu-rs (as well as in wgpu-native), but the `Result` would not be exposed to wgpu-rs, so that it matches the Web behavior.
At the same time, browser implementations (Gecko and Servo) will check the result on their GPU process and implement the WebGPU error model accordingly. This means `wgpu-core` can be super Rusty and safe.
**Testing**
Running on wgpu-rs examples. Most of them fail to get parsed by Naga, but `boids` succeeds and passes validation 🎉
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
668: Return failures to the user in swap_chain_get_next_texture, rather than transparently reconfiguring. r=kvark a=AlphaModder
TODO:
- [x] Change `Global::swap_chain_get_next_texture` in `wgpu-core`.
- [x] Update `wgpu_swap_chain_get_next_texture` in `wgpu-native`. (https://github.com/gfx-rs/wgpu-native/pull/32)
- [x] Wrap `SwapChainOutput`/`SwapChainStatus` in a nice enum in `wgpu-rs`. (https://github.com/gfx-rs/wgpu-rs/pull/323)
- [ ] Update `wgpu_bindings` (?)
Co-authored-by: AlphaModder <quasiflux@gmail.com>
- Clean up after the pending writes on destroy.
- Fix temporary buffer creation.
- Fix internal thread initialization by the command allocator.
- Clean up player event_loop usage.