1161: Fix replaying issues with dropped texture views r=urgent a=kvark
**Connections**
Fixes replaying of https://github.com/gfx-rs/wgpu/issues/1158#issuecomment-763272796
**Description**
The main fix is calling `maintain` in the player before getting the new view from the swapchain. That allows the device to properly remove the ID that is just about to be used.
**Testing**
Tested on that API trace.
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1155: fix the size checks in transfer buffer to image commands r=cwfitzgerald a=Vengarioth
**Connections**
_none_
**Description**
It's fixing a trivial bug in which Extend3d was checked against a with of 0 two times, presumably instread checking depth as well.
**Testing**
Ran the tests and ran it with bevy - still worked.
Co-authored-by: Vengarioth | Andreas Fischer <opensource@deviru.de>
1151: Update gfx and naga to gfx-6 tag r=cwfitzgerald a=kvark
**Connections**
Fixes#1149
Regression from https://github.com/gfx-rs/gfx/pull/3573
**Description**
The physical devices held references to `RawInstance` in Vulkan backend, and we weren't cleaning them up.
Note: an alternative fix could be in `gfx-backend-vulkan` - to move the `Entry` into `RawInstance`, thus delaying the shutdown. I didn't go this way because that would be less explicit.
**Testing**
Tested on wgpu-rs examples
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
1128: Add pipeline statistics and timeline queries r=kvark a=cwfitzgerald
**Connections**
Closes#721
**Description**
This adds Pipeline Statistics queries and Timeline queries. Shoutout to @z2oh for doing a good chunk of the work to enable this feature.
Currently blocked on both https://github.com/gfx-rs/gfx/pull/3563 and rollup of gfx-hal mutability changes, but is ready to review.
**Testing**
Tested in various ways on the hello-compute and hello-triangle example, tested validation extensively. Queries will be permanently added to the mipmap example once the wgpu-rs PR is finished.
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
1147: Update render pass and framebuffers logic to the latest gfx-hal r=cwfitzgerald a=kvark
**Connections**
Updates gfx-hal with the latest major changes of https://github.com/gfx-rs/gfx/pull/3571
**Description**
There is no need to track framebuffers at all any more! Since they don't contain images, we can keep them permanently.
There is no need to create and delete framebuffers for the swapchain either. Lots of non-trivial code is gone 🎉
The PR also removes one of the mutexes that the device holds.
**Testing**
Will be tested on wgpu-rs
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1148: Remove comment introduced in #1144 r=cwfitzgerald a=DasEtwas
Tested to be unnecessary by reading
Co-authored-by: dasetwas <dasetwas@dasetwas.dasetwas>
1145: Support trailing render passes after the swapchain rendering r=kvark a=kvark
**Connections**
Discussed on the matrix.
**Description**
Fixes a case where we have any other render pass in a command encoder that draws to the swapchain (after the pass that draws to the swapchain).
**Testing**
Tested on a modified hello-triangle example.
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
1144: Fix and simplify attachment dimension mismatch check r=kvark a=DasEtwas
This also improves error messages with detailed dimension and attachment type name info which developers can hopefully recognize.
**Connections**
None
**Description**
Before this commit, depth/stencil attachments are not considered when evaluating the renderpasses' dimension, which will result in a "NoAttachment" error with a confusing display message.
**Testing**
Tested by running an application making use of color-only and depth/stencil-only attachment renderpasses.
Tested by running boids, hello-triangle and shadow examples.
Co-authored-by: DasEtwas <18222134+DasEtwas@users.noreply.github.com>
1142: Move get_swap_chain_preferred_format from device to adapter and check formats r=kvark a=niklaskorz
**Connections**
https://github.com/gfx-rs/wgpu-rs/issues/123#issuecomment-757831458
**Description**
Not all devices actually support `Bgra8UnormSrgb`. If this is the case, a similar format like `Rgba8UnormSrgb` can be used.
**Testing**
e5ebfa70a4/learn-wgpu/src/lib.rs (L137)
- Output on MacBook Pro 13" Intel 2020 macOS Metal: `Format: Bgra8UnormSrgb`
- Output on OnePlus 7 Pro Android Vulkan: `Format: Rgba8UnormSrgb`
Co-authored-by: Niklas Korz <niklas@niklaskorz.de>
1140: Enable storage read/write format feature r=kvark a=Wumpf
**Connections**
#1112
**Description**
Use `wgt::TextureFormatFeatureFlags::STORAGE_READ_WRITE` in `get_texture_format_features`.
This has been waiting for a gfx update which was enabled by @ElArtista 's workaround in #1136 \o/
Co-authored-by: Andreas Reich <r_andreas2@web.de>
1135: Make all textures support usage COPY_SRC and COPY_DST r=kvark a=fintelia
**Connections**
N/A
**Description**
In WebGPU, all textures should be allowed to have usages COPY_SRC and COPY_DST. However, right now when Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES is enabled any features that the backend says can't be blitted to/from will not gain these capabilities. In particular, compressed textures may not support blitting while still allowing access via copies to/from buffers.
You can also see the defaults used when TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES is not requested:
8c00cbcc8e/wgpu-types/src/lib.rs (L1224-L1342)
**Testing**
I ran a [patched version of the wgpu-rs cube example](https://github.com/fintelia/wgpu-rs/tree/cube-bc4/examples/cube).
Co-authored-by: Jonathan Behrens <fintelia@gmail.com>
1112: Expose adapter specific formats features via Extension, support for storage read+write r=kvark a=Wumpf
**Connections**
Draft until https://github.com/gfx-rs/gfx/pull/3559 landed (then update and comment two lines in)
New & improved replacement for #1109
PR for wgpu-rs to be opened once there's some confidence that this is that it should look like. [Preview](https://github.com/gfx-rs/wgpu-rs/compare/master...Wumpf:texture-format-feature-query?expand=1)
**Description**
Adapter exposes now per texture format specific features. Feature struct defined as allowed usages + flags. Flags describe only storage texture usage so far.
Query not used for validation unless `TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES` feature is enabled on a device. Otherwise uses hardcoded feature set guaranteed by webgpu.
Storage read/write binding can then be used as a consequence (storage atomic has no effect yet).
**Testing**
Manual testing with my fluid sim project through wgpu-rs which covers storage r/w for a few different formats and storage in general for formats that don't support this usage by default at all.
Ran tests and a couple of samples to see if anything broke with the feature disabled.
Co-authored-by: Andreas Reich <r_andreas2@web.de>
1134: Never prefer CPU devices over GPUs r=kvark a=myfreeweb
**Connections**
Rebase of #969 onto master
**Description**
See #969
Co-authored-by: Greg V <greg@unrelenting.technology>
1127: Fix API traced dynamic offsets and markers r=critical a=kvark
**Connections**
This was a regression from #1106, discovered while investigating #1123
**Description**
When running a pass, it was mutably used for "convenience". Once we moved the tracing of that pass from the beginning of the function to the end, the "convenience" eliminated our dynamic offsets and markers.
The solution is to stop mutating the passes inside our big functions.
**Testing**
Re-traced Terra
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
1126: Check swapchain frame to still be in use r=harmless a=kvark
**Connections**
Fixes#1123
**Description**
What happened there is - the same command buffer was used to record work into multiple swapchain frames.
The ID management of those is a bit special, so the error wasn't very descriptive, internal logic caught inconsistency.
Now there is a proper error, and the old error is better.
Note that ideally we'd want "present" to work like "destroy" on textures, but essentially the users would have to fix it anyway. It's not going to make their life easier (in fact - only harder), so we can defer this to a follow-up.
**Testing**
Tested on wgpu-rs examples as well as on Terra.
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
1125: Fix UB in populating dynamic offsets r=kvark a=kvark
**Connections**
Related to the traces in #1123
**Description**
The dynamic offsets arrays appear to be empty in the traces, which makes no sense. We are populating them unconditionally, and I double-checked on the `shadow` example that the traces we record contain the offsets. So my only guess is that the reported traces are taken from a release build, and our code that does `slice::from_raw_parts()` on the offsets is UB because the pointer can be garbage (if length is 0). This is what the PR fixes.
**Testing**
Untested
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
1124: Fix range tracker merging r=kvark a=kvark
**Connections**
Fixes#1123
**Description**
The merge routine was not properly updating the end pointer in some branches.
**Testing**
A unit test is added with the data extracted from the user case.
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
1121: Implement render bundle freeing r=straightforward a=kvark
**Connections**
Fixes#1120
**Description**
Since render bundles were added the relevant bits of logic to free them were just missing.
**Testing**
Untested
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>