545: Remove bake.frag from shadow example r=kvark a=yutannihilation
Now that `fragment_stage` is a `Option`, I guess this is the case when we don't need fragment shader.
Co-authored-by: Hiroaki Yutani <yutani.ini@gmail.com>
910: Replace backends! Macro with CFG Aliases r=kvark a=zicklag
**Connections**
Needs to be merged before: https://github.com/gfx-rs/wgpu/pull/907
**Description**
This change makes it easier to conditionally compile code based on graphics backends by adding `#[cfg]` aliases for the backends such as `vulkan`, `metal`, etc. This makes the code easier to read and maintain.
**Testing**
Tested the WGPU-rs cube and boids examples and they work as normal on a Linux machine with Vulkan.
Co-authored-by: Zicklag <zicklag@katharostech.com>
912: Fix write-only stencil state descriptors from not working - fixes#911 r=kvark a=Dinnerbone
**Connections**
This fixes [#911 - Stencil testing broken between v0.5 and v0.6](https://github.com/gfx-rs/wgpu/issues/911).
**Description**
Write-only stencil states (read 0, write >0) are being treated as if they are disabled, which causes pipelines to act as though they don't have any stencil state set at all. This worked prior to commit 2473c25971 (introduced in PR #873). As far as I can tell, this works fine in Vulkan, Metal, DX12 and DX11 as we've been using this approach over at Ruffle for a while now.
**Testing**
You can view the reproduction case in #911 for manual testing. I have confirmed that this fix makes that case work as expected.
I couldn't find any automated tests for wgpu-types to copy and add for this case. If that's wanted then please let me know what the best approach is.
Co-authored-by: Nathan Adams <dinnerbone@dinnerbone.com>
903: fix for mixed STORAGE_STORE and STORAGE_LOAD r=kvark a=kocsis1david
**Connections**
None
**Description**
A buffer that contains dynamic data is used for both uniforms and storage read. This was a problem for wgpu and it gave a `PendingTransition` error.
**Testing**
It's a trivial fix, but I don't know if there's an example for it in wgpu-rs that can be used for testing.
It seems that the PR "Sync changes from mozilla-central" is already solving the same issue.
Co-authored-by: Dávid Kocsis <kocsis1david@windowslive.com>
* Allow copying from depth textures
* Rename TextureFormat::is_depth_format to just is_depth
* Only allow Depth32Float format for copying, and only as source
897: Improve diagnostics of incompatible attachments r=kvark a=scoopr
**Description**
Attempt to improve the diagnostics of incompatible attachments
Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
* The conditional at the start of resize() already tests for and exits on the zero width and height condition.
The conditional removed here was then getting run on every other call to resize(), which doesn't seem logical, doesn't correspond to the comment, and seemed to be causing at least one issue with rendered viewport going black during resize.
Fixes#532
(probably) Fixes#519
* Defensive coding to prevent various issues when window size goes to zero, e.g. NaN being passed in cgmath::perspective() aspect ratio parameter.
Fixes#531
895: Improve validation in B2B copies and RenderCommands 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._
Validation for the following have been added-
- Validate all parameters in B2B copy even if `copy_size == 0`.
- Check for copy operations issued within same buffer.
- `RenderPass.setViewport()`
- `RenderPass.setScissorRect()`
**Testing**
_Explain how this change is tested._
Tested with CTS in Servo. More tests pass now. Will test on wgpu-rs now.
<!--
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>
893: Improve texture creation validation r=cwfitzgerald a=kvark
**Connections**
Fixes https://github.com/gfx-rs/wgpu-rs/issues/528#issuecomment-678853886
**Description**
Improves the mipmap levels check.
Note that it also removes the `TooManyLayers` error, and instead produces max `u16` value. This is to be followed up with a check for *real* limits, which has to happen regardless, and trying to catch it on the number conversion step seems wasteful.
**Testing**
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
891: Add AddressMode::ClampToBorder behind a feature r=kvark a=jshrake
**Connections**
Closes#890
Linked to https://github.com/gfx-rs/wgpu-rs/pull/526
**Description**
- Adds support for border sampler addressing behind a new feature Features::ADDRESS_MODE_CLAMP_TO_BORDER.
- Adds a new enum SamplerBorderColor so that users can optionally specify a supported border color on the SamplerDescriptor.
**Testing**
Tested against the Metal (MacOS 10.15) and Vulkan (Ubuntu 18.04) backends.
Ran the wgpu-rs/cube example and switched the address modes to AddressMode::ClampToBorder, without enabling the feature, and confirmed I received an error message. Ran the same example with the new feature specified in the optional_features return and confirmed that the example ran and looks reasonable.
Co-authored-by: Justin Shrake <justinshrake@gmail.com>
523: Change buffer binding to not take a slice r=cwfitzgerald,grovesNL a=kvark
This has been a constant source of confusion w.r.t dynamic offsets.
What it looks like it's doing: user provides a slice of buffer visible to the shader. Just like they provide slices to vertex and index buffer bindings.
What it's actually doing: it takes the offset and size separately, modifying the offset later on based on the dynamic offset.
We don't need this confusion. Semantics is different from `BufferSlice` and so we should have a different API here.
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
889: Fix swapchain preferred format r=kvark a=kvark
**Connections**
**Description**
The old API was wrong because the idea is to query the format *before* creating a swapchain, not after it:)
**Testing**
nah, should just work
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
517: Added some explanatory comments to hello-compute example r=kvark a=JonathanWoollett-Light
Simply added some more comments explaing the basic compute example.
Also moved the lines:
```rust
let slice_size = numbers.len() * std::mem::size_of::<u32>();
let size = slice_size as wgpu::BufferAddress;
```
To be just before where they are used.
Co-authored-by: Jonathan Woollett-Light <jonathanwoollettlight@gmai.com>
885: Improve buffer and texture overrun error messages r=kvark a=cwfitzgerald
**Connections**
Closes#884.
**Description**
The previous errors about buffer and texture overruns didn't tell the user any information about which buffer, how long wgpu thought the copy was, or how long it thought the buffer was. This makes the error message much better.
Unfortunately a braking change, so can't backport :(
**Testing**
Tested on #884's issue.
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>