1254: Fix swapchain resize in the player r=kvark a=kvark
**Connections**
Fixes 1253
**Description**
I was fixing this recently, and I'm not sure how it worked, because there is a big inner `loop` that I didn't notice before 😅 .
So now we exit the inner loop upon resize.
**Testing**
Tested on the supplied API trace
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
* wgpu-core: update gfx-hal usage related to sparse resources
* wgpu-core: support naga gfx-13
* Update gfx and naga dependencies to gfx-13 tag
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1251: Don't panic on pipeline creation errors r=kvark a=kvark
**Connections**
Related to Gecko crashes.
**Description**
We shouldn't ever panic in `wgpu`. The panic can only occur if there is internal inconsistency. For any invalid workloads, submitted by the user, we should produce errors instead.
**Testing**
Not tested
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1247: Add license to the memory init tracker r=kvark a=kvark
**Connections**
Gecko's code lints complain...
**Description**
Add a license header like all the other files
**Testing**
should work!
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
1246: Fix link to the "debugging tips" page r=kvark a=maroider
**Description**
The link was broken.
**Testing**
I used the link :P
Co-authored-by: Markus Røyset <maroider@protonmail.com>
1245: Trace pipeline creation before it actually happens r=kvark a=kvark
**Connections**
Fixes#1174
**Description**
We want to add descriptors to the trace before panicking if anything goes wacky.
**Testing**
tested on wgpu-rs examples
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1243: Force-drop the token before calling fire_map_callbacks r=kvark a=kvark
**Connections**
Related to WebGPU update in Gecko
**Description**
Since the token was alive, technically, we saw an assertion firing up about concurrent access to the token root.
**Testing**
Tested in Gecko
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
1240: Fix issue with multiple queued mappings where the last one is not cancelled r=kvark a=Imberflur
**Connections**
Follow up from #1239
**Description**
In #1239 I missed the case where there are multiple rounds of mapping/unmapping with the last map not being cancelled. In practice it doesn't occur very often, but I did encounter it with settings/a scene that created a heavy GPU load.
Sorry for not catching this earlier!
**Testing**
Using `wgpu-rs` capture example, after the first `map_async` I added in an `unmap` followed by another `map_async`.
<!--
Non-trivial functional changes would need to be tested through:
- [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
- [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.
Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See https://github.com/gfx-rs/wgpu/pull/666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->
Co-authored-by: Imbris <imbrisf@gmail.com>
1239: Avoid panic when requesting to unmap a buffer that is pending mapping r=kvark a=Imberflur
**Connections**
Fix for #1238
**Description**
This might not be the cleanest fix but it is quite minimal. I'm not sure what the exact intent is with the organization of things and with the async status enum, would be happy to hear critiques.
**Testing**
Tested against example in #1238
<!--
Non-trivial functional changes would need to be tested through:
- [wgpu-rs](https://github.com/gfx-rs/wgpu-rs) - test the examples.
- [wgpu-native](https://github.com/gfx-rs/wgpu-native/) - check the generated C header for sanity.
Ideally, a PR needs to link to the draft PRs in these projects with relevant modifications.
See https://github.com/gfx-rs/wgpu/pull/666 for an example.
If you can add a unit/integration test here in `wgpu`, that would be best.
-->
Co-authored-by: Imbris <imbrisf@gmail.com>
1237: Move `#[error]` attributes after the corresponding `#[derive]` r=kvark a=Aaron1011
**Connections**
See https://github.com/rust-lang/rust/issues/79202
**Description**
Fixes Nightly future-incompat warnings
**Testing**
There are no behavior changes intended.
Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
* const in ShaderStage that represents vertex and fragment access
We can store `ShaderStage`s as const values or members of const structs in all individual cases, but for example `ShaderStage::VERTEX | ShaderStage::FRAGMENT` cannot be stored in a const. This is not very elegant, but would be convenient.
* Correct VERTEX_FRAGMENT definition
VERTEX_FRAGMENT definition now follows directly from the bit representation of `ShaderStage::VERTEX` and `Shaderstage::FRAGMENT` such that it does not need to be independently maintained.
1231: Added TextureFormatFeatures::filterable which may overwrite TextureSampleType::Float.filterable r=kvark a=Wumpf
**Description**
The expectation is that with `wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES` enabled, any texture format which is sampled as float may be (linearly) filtered if so supported by the adapter, not only those that the webgpu specification denotes as filterable.
This arguably causes a bit of a mess in the way we distinguish `sample_type` and `(guaranteed_)format_features`: The float sample type (via spec) essentially integrates a feature, namely if it is filterable or not. Unlike the actual format _type_ which is just a property of the format, this property may or may not be available depending on the device.
So the type of `sample_type` stays statically defined whereas the Float.filterable property suddenly becomes overwritten by a format_feature which may or may not be present. Couldn't come up with a cleaner solution so far.
**Testing**
Tested in project (blub) depending on R32F filtering - passing now what was previously causing
```
wgpu error: Validation Error
Caused by:
In Device::create_bind_group
note: label = `BindGroup: Narrow Range filter 1`
texture binding 1 expects sample type = Float { filterable: true }, but given a view with format = R32Float
```
(Blub still can't run on latest wgpu because of other reported issues)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
1227: Derive more things for primitive and multisampling states r=kvark a=kvark
**Connections**
Related to https://github.com/gfx-rs/wgpu-rs/issues/769
**Description**
Adding a few derives and fixing a doc comment.
**Testing**
CI gets it
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1226: Update gfx and naga to gfx-12 r=kvark a=kvark
**Connections**
Picks up https://github.com/gfx-rs/gfx/pull/3650Fixes#1225
**Description**
Also fixes our playtests, interestingly. One of the changes here was that now `Analysis` is needed for everything, including the SPV-out backend of Naga. And we can only get it via validating the `naga::Module`.
What we used to was: if validation isn't enabled, we'd carry the module around, and then still try to produce a SPIR-V from it, if there is no original SPIR-V. This precise thing was happening in the tests. However, we had `dummy` backend depending on the `wgpu-core/cross` feature, which means the playtests were actually built and run with spirv-cross enabled!
Another factor here is the introduction of `ShaderModule::flags` instead of a single boolean, which was done in #1093. The problem here was that the playtest RON files weren't updated accordingly, they still had `experimental_translation: true` in them, which got ignored now.
So with this combination of events, the playtests ended up generating SPIR-V from Naga modules, without validation(!), and passing the SPIR-V to gfx-rs and SPIRV-Cross... Which still worked, as we'd expect, but definitely not want here.
So this PR fixes everything. It makes it required to have the validation for a module, and we force-validate if there is no SPV source to fall back on. And it disables "cross" feature implicitly enabled in testing.
**Testing**
Tested on wgpu-rs examples.
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1224: Update the blend API to upstream r=kvark a=kvark
**Connections**
Matches https://github.com/gpuweb/gpuweb/pull/1134
**Description**
Makes blending state ON/OFF explicit.
**Testing**
Simple enough!
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1220: Update naga to gfx-11, make spirv-cross optional r=kvark a=kvark
**Connections**
https://github.com/gfx-rs/gfx/pull/3642https://github.com/gfx-rs/gfx/pull/3641
**Description**
Gets us the latest Naga updates, plus the ability to make spirv-cross optional (on Linux and Windows only for now).
**Testing**
Will be tested on wgpu-rs
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1219: Validate texture bindings r=cwfitzgerald a=kvark
**Connections**
It was mentioned/requested somewhere, but I can't find the place...
**Description**
Fairly straightforward - just check the view properties against the bind group layout.
**Testing**
Tested on wgpu-rs examples
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1210: Reset the bindings on the push constant change r=wumpf a=kvark
**Connections**
Fixes#1207
(unconfirmed!)
**Description**
I was able to replay the trace in #1207 without validation errors, so I looked deeper into what might have gone wrong.
The code isolated in #1194 looks great. However, the calling code's handling of push constants might have changed a bit.
And I see that the trace uses push constants, so here is what happened, I think:
- layout A was set, expecting bind group layouts X and Z
- bind groups X and Y where bound
- layout B was set, expecting bind group layout X and Y. We see that Y group can now be bound, so we do this. The old logic in this case wasn't considering the push constants in any way, it would only consider them if bind group layouts didn't change, erroneously.
- layout B has different push constant ranges...
So it's a one-line fix now, which I'm hoping is correct.
**Testing**
Not tested
@Wumpf would you be able to check this?
Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>