800: Add the preferred format query r=cwfitzgerald a=kvark
Just getting us synced up to the spec naming and API for the swapchains...
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
802: adds size function for VertexFormat r=kvark a=bootra-dev
Addresses https://github.com/gfx-rs/wgpu/issues/801
This PR adds a simple size function to the VertexFormat enum. It returns a u64 so that it can be conveniently used with the VertexAttributeDescriptor offset.
Co-authored-by: bootra-dev <bootragames@gmail.com>
798: Fixed storage buffer counting towards storage textures for binding validation r=kvark a=Wumpf
See title.
(broke my group layout creation since my compute shaders need quite a few storage buffers _and_ storage textures bound... ;-))
Co-authored-by: Andreas Reich <r_andreas2@web.de>
799: Derive Hash on BindGroupLayoutEntry r=kvark a=kunalmohan
**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_
**Description**
_Describe what problem this is solving, and how it's solved._
Required in Servo.
**Testing**
_Explain how this change is tested._
Not tested.
<!--
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: Kunal Mohan <kunalmohan99@gmail.com>
796: Safe error handling for command API r=kvark a=GabrielMajeri
**Connections**
Part of #638
**Description**
Initially started to remove assertions from the `bundle.rs` file, but ended up implementing safe error handling for the whole `command` module.
**Testing**
Checked with core and player.
Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
795: Move `RenderPass*AttachmentDescriptor` types into core r=kvark a=GabrielMajeri
**Connections**
Follow up to #791.
**Description**
I had the impression that these two types were already shared between `wgpu-core` and `wgpu-rs`, considering they were generic. Further investigation reveals that not to be the case.
This PR moves these types into `wgpu-core`, since they're specific to this crate.
**Testing**
Checked with core, player and `wgpu-rs`.
Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
777: Implement PUSH_CONSTANTS feature r=kvark a=cwfitzgerald
**Connections**
Closes#734. Makes minor progress on #689.
**Description**
This one is a doozy.
Implements Push Constant support in wgpu.
Implementation Notes:
- Push constants are unconditionally cleared on change to a pipeline with a different pipeline layout. This could be elided in a future revision, possibly making push constants slightly faster on non-vulkan platforms.
- This exposes basically a direct port of vulkan push constants to wgpu. There might be design decisions that would want to be changed for an upstream webgpu implementation.
Code Notes:
- The render bundle code needs to be heavily scrutinized because I wasn't able to test it and it requires pipeline invalidation.
- Validation should be correct as I have tested it pretty throughly, but there are a lot of factors involved, so I could have accidentally missed something (or not allowed something I should have).
Other Work:
- `PipelineLayoutDescriptor` was moved into wgt from wgpu-rs with a generic.
**Testing**
I have modified the wgpu-rs example to use push constants for its uniform fallback, which is a perfect use case for push constants. I have not tested compute constants, but I expect no issues with them.
https://github.com/gfx-rs/wgpu-rs/pull/435
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
789: Panic on using a pending buffer r=kvark a=kvark
**Connections**
Validates the use case of https://github.com/gfx-rs/wgpu-rs/issues/436
**Description**
We didn't detect if a buffer had pending *initial* mapping, previously, on submit.
**Testing**
Untested
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
791: Unify `wgpu-core` and `wgpu-rs` types r=kvark a=GabrielMajeri
**Connections**
Closes#689.
**Description**
Moves a lot of types from `wgpu-rs` which were duplicated in `wgpu-core` to `wgpu-types`.
**Testing**
Checked with core, player and `wgpu-rs`.
Corresponding `wgpu-rs` PR: https://github.com/gfx-rs/wgpu-rs/pull/437
Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
790: core: make DeviceType repr(u8) r=kvark a=DavidPeicho
**Connections**
This PR will make gfx-rs/wgpu-native#43 mergeable.
**Description**
`DeviceType` wasn't made to be used in FFI. The enum is now set to `#[repr(u8)]`.
**Testing**
It's not tested 💯
Co-authored-by: David Peicho <david.peicho@gmail.com>
787: Remove non-exhaustive markers r=kvark a=GabrielMajeri
Based on the previous [discussion](https://github.com/gfx-rs/wgpu/pull/774#issuecomment-657171354), this PR removes the `NonExhaustive` structure and any `#[non_exhaustive]` attribute since it's too early to decide how to ensure forward compatibility.
**Testing**
Checked the `core`, `types` and `player` crates.
Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
783: Basic use of Error for bind groups r=kvark a=kvark
**Connections**
Follow up to #776
**Description**
Trying to tidy up a few things and add a public use of `Error` variant
**Testing**
not tested
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
782: Add check while trying to remove uninserted Ids r=kvark a=kunalmohan
**Connections**
_Link to the issues addressed by this PR, or dependent PRs in other repositories_
An attempt to fix#781
regression from #776
**Description**
_Describe what problem this is solving, and how it's solved._
When we used `VecMap`, it simply returned `None` for even out of bounds access to the map (We depended on it returning `None`). After #776 , we get a panic. So adding a simple index check before accessing it fixes this issue.
**Testing**
_Explain how this change is tested._
Tested on wgpu-rs examples with the changes in https://github.com/gfx-rs/wgpu-rs/pull/430. All examples run fine except the `cube` which segfaults.
<!--
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: Kunal Mohan <kunalmohan99@gmail.com>
779: Fix hub insertion r=kvark a=kvark
**Connections**
Fixes#778
Follow-up to #776
**Description**
Problem was `resize_with` takes new length, not a difference.
**Testing**
Untested
Co-authored-by: Dzmitry Malyshau <kvarkus@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>
769: Implement and Validate all WebGPU Limits r=kvark a=cwfitzgerald
**Connections**
None?
**Description**
This adds all the limits that webgpu has currently. It also validates the values.
The main piece of code here is `BindingTypeMaxCountValidator` and `PerStageBindingTypeCounter` which provides the interface for figuring out the maximum per-stage counts in the pipeline. For each `BindGroupLayout` a `BindingTypeMaxCountValidator`is put together during creation using all of the bindings. Then the `BindingTypeMaxCountValidator`s are combined into a single max. This is then validated against the max limits.
Each commit should be independently testable and are grouped by responsibility.
**Testing**
I modified the wgpu-rs example framework to ask for extremely reduced limits and then tested various examples to verify it properly accepted/rejected based on the actual limit.
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>