1115: Request buffer FAST_DEVICE_ACCESS only with some non MAP or COPY usage r=kvark a=fintelia
**Connections**
Fixes#1113
**Description**
On Linux AMD (and likely elsewhere) buffers with FAST_DEVICE_ACCESS are very slow to access when mapped. This makes sure that upload/download buffers don't request it unless those buffers are leveraging MAPPABLE_PRIMARY_BUFFERS for some non-map/copy usage.
**Testing**
I reran the failing reproduction case in the linked issue.
Co-authored-by: Jonathan Behrens <fintelia@gmail.com>
1103: Fix Assorted Low-Hanging Validation and Error Message Issues r=kvark a=cwfitzgerald
**Connections**
Closes#1085Closes#393Closes#1053
**Description**
These commits are independent and should be reviewed individually. Combined into a single PR to reduce noise.
Overview of what was done:
- Add validation for empty texture and buffer usage flags. (#393)
- Add allowed texture usage flags to `format.describe()` (#1085)
Validate new textures follow the allowed usage flags.
- Properly validates vertex and buffers are bound. (#1053)
Improves error messages when no vertex buffer is bound. (Before it said the limit was 0, now it says something is unbound)
- Improve the vertex buffer overrun messages by keeping track of which slot has the smallest index.
**Testing**
Tested on examples by artificially creating the situation I am trying to validate, as well as running clean examples to make sure they pass validation.
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
1096: Fix build for wasm32 target r=kvark a=VincentFTS
**Connections**
#115
**Description**
Fix Wgpu build for Wasm target
**Testing**
It’s just a first step toward wasm support in Wgpu-rs, a PR in Wgpu-rs will come later.
Co-authored-by: Vincent Jousse <contact@ftsoftware.fr>
1093: Update naga and gfx, move the shader validation into a shader descriptor bit r=cwfitzgerald a=kvark
**Connections**
Includes https://github.com/gfx-rs/gfx/pull/3533 and a bunch of Naga things.
**Description**
Updates Naga with the new WGSL syntax, lots of fixes.
Large update of the GL backend.
**Testing**
Tested on some wgpu-rs examples.
Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
1077: Remove extern "C" from set_index_buffer r=kvark a=DevOrc
**Connections**
Fixes an issue that is blocking gfx-rs/wgpu-native#61
**Description**
Moves the ffi definition of wgpu_render_bundle_set_index_buffer / wgpu_render_pass_set_index_buffer to wgpu-native. This is needed because wgpu-native has its own version of IndexFormat that is different than the wgpu_types version.
**Testing**
My projects with wgpu-native work
Co-authored-by: Noah Charlton <ncharlton002@gmail.com>
1080: Fix the validation of vertex buffer sizes r=kvark a=JCapucho
**Connections**
None that i know of
**Description**
~~The vertex buffer size (in vertices) was being divided by stride causing the limit to be lower than it was supposed to be.~~
This bug wasn't triggered earlier because if the stride was 0 it wouldn't perform any calculation and the stride was only set when a set pipeline command was received and the `VertexState` `inputs` were already created so the following commands would work:
```
SetPipeline with 1 vertex buffer
SetVertexBuffer with only 4 vertices
Draw 6 vertices
```
This would have passed validation while this wouldn't
```
SetPipeline with 1 vertex buffer of stride 8
SetVertexBuffer with 4 vertices
SetPipeline with 1 vertex buffer of stride 8
SetVertexBuffer with 4 vertices
Draw 3 vertices
```
Now all draw calls have proper vertex validation and not only after the `inputs` are populated
**Testing**
This change was tested after debugging an issue with the draw calls failing in a specific order in [veloren](https://gitlab.com/veloren/veloren/-/tree/imbris/wgpu-master-rebased)
Co-authored-by: Capucho <jcapucho7@gmail.com>
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.
1047: Update bind group layout API to match upstream r=cwfitzgerald a=kvark
**Connections**
Follows https://github.com/gpuweb/gpuweb/pull/1076, https://github.com/gpuweb/gpuweb/pull/1223 (https://github.com/gpuweb/gpuweb/issues/1164), https://github.com/gpuweb/gpuweb/pull/1255, and https://github.com/gpuweb/gpuweb/pull/1256
**Description**
Aligns our API closer to the latest changes in WebGPU upstream. We technically don't have to do this, but I believe in the end it would be best if our API gets close to upstream.
Note: this is a sensitive change for the users, everybody will get their code broken. So please take a look at the API and see if something is missing or needs improvement, so that we don't have to go through the changes again afterwards.
**Testing**
Doesn't really need testing. Partially covered by the existing playtest.
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1051: Register init-destination buffer in the pending writes r=kvark a=kvark
**Connections**
Fixes#1049
**Description**
At some recent point we introduced the map of destination buffers for copies, and I missed the case where buffers are mapped at creation.
**Testing**
Tested on the test-case in #1049
Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
1023: Drop surfaces and adapters r=cwfitzgerald a=kvark
**Connections**
Not very connected
**Description**
Refactors our destruction paths a bit
**Testing**
tested on wgpu-rs
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1008: Add helpers to convert passes to serialized forms r=grovesNL a=kvark
**Connections**
Stuff I needed to fix in the upcoming Gecko WebGPU update.
**Description**
It allows us to use the tracing `Command` more aggressively.
**Testing**
Tested in Gecko, doesn't need testing in wgpu
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
1000: Elide redundant set_pipeline calls. r=kvark a=Kimundi
**Description**
This adds an check in each `set_pipeline()` call for wether the same pipeline id has already been set previously. This should cause free performance wins for suboptimal usage of the wgpu API, while having neglible overhead otherwise.
An example scenario for where this would be useful is a game that just blindly sets all render state for each object, but has few actually different objects:
```rust
for game_obj in game_objs {
rpass.set_pipeline(...);
rpass.set_bind_group(...);
rpass.set_vertex_buffer(...);
rpass.draw(...);
}
```
**Testing**
Ideally we would have tests that check that pipeline changes have been ellided, but I'm not sure how to write them in the current codebase.
**Future work**
- We could extend this kind of redundant state change detection to most `.set_*` methods on `RenderPass`es.
- If we want to guarantee this behavior in the API, we should also document it.
Co-authored-by: Marvin Löbel <loebel.marvin@gmail.com>
982: Fix debug markers in render passes (#981) r=kvark a=kazimuth
Hey, that was easy. Didn't change anything in the debug groups markers / command pass markers, since afaict they work correctly.
I didn't add a test here because I'm not sure how to use the `player` testing apparatus, but I figure since I'm just adding a line of code that's already there for compute passes ([here](https://github.com/gfx-rs/wgpu/blob/master/wgpu-core/src/command/compute.rs#L452)) it should be alright. Let me know if there's anything else I should add.
Co-authored-by: James Gilles <jameshgilles@gmail.com>