Commit Graph

8399 Commits

Author SHA1 Message Date
Schell Carl Scivally
fc85e4f970
spv-in parse more atomic ops (#5824)
* add parsing for spirv::Op::AtomicLoad and spirv::Op::AtomicStore

* spv-in parse AtomicExchange and AtomicCompareExchange

* add atomic i decrement

* bookend atomic store statement with emmitter.finish/emitter.start to suppress a double load expression

bookend atomic result expressions with emitter.finish/start to prevent double defs

* add atomic iadd, isub, smin, umin, smax, umax, and, or, xor

* parse atomic flag test and set, parse atomic flag clear

* remove atomic compare exchange work

* changelog

* moved spirv tests into front/spv/mod.rs

* feature gate atomic spv tests because they require wgsl-[in,out]

* BlockContext::get_contained_global_variable returns Result

* Generate spans covering the entire instruction.

Granted, there is pre-existing code in the SPIR-V front end that gets
this wrong, but:

It doesn't make sense to read `self.data_offset`, and then immediately
pass that to `self.span_from_with_op`. The point of that function is
to make the span cover the entire instruction, operands included.

* Move `From` implementation into spv front end

* doc comments, minor cleanups

* remove parsing of OpAtomicFlagClear and OpAtomicFlagTestAndSet

* sync atomic spvasm files

---------

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2024-09-18 05:39:36 +00:00
Ben Reeves
434f197410
Document default pipeline layout behavior. (#6275)
* Document default pipeline layout behavior.

Fixes #6254.

* Fix typo

* Apply suggestions from code review

Co-authored-by: Andreas Reich <r_andreas2@web.de>

* Remove text about panics in get_bind_group_layout.

We shouldn't advertise the behavior until it is consistent between
webgpu and wgpu-core.

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-09-15 23:08:13 +02:00
Ben Reeves
2fac5e983e
Properly handle the case where Navigator.gpu is undefined and WebGPU is the only compiled backend (#6197)
* Properly handle the case where `Navigator.gpu` is undefined and WebGPU is the only compiled backend.

Previously, `Instance::request_adapter` would invoke a wasm binding with an undefined arg0,
thus crashing the program. Now it will cleanly return `None` instead.

Fixes #6196.

* Fix typo in `Instance::new` doc comment.
* Add note to CHANGELOG.md
* Introduce `DefinedNonNullJsValue` type.
* Assert definedness of self.gpu in surface_get_capabilities.
* Use DefinedNonNullJsValue in signature of get_browser_gpu_property().
* Clarify meaning of gpu field with a comment.
2024-09-15 08:07:40 +00:00
Johann Muszynski
d79ebc4db3
Update some docs containing OpenGL or GLSL references (#6271) 2024-09-15 07:07:39 +00:00
Ben Reeves
a21c0e2696
Clarify cfg(send_sync) gating in this backend/webgpu comment. (#6274)
Addresses the confusion in #6267.
2024-09-15 04:44:17 +00:00
Dzmitry Malyshau
eb18854b46 spv-out: configure source language in debug info 2024-09-13 11:37:23 -07:00
Teodor Tanasoaia
c8beade187
remove backend from ID (#6263) 2024-09-13 17:30:38 +02:00
Teodor Tanasoaia
ff52b86331
[d3d12] handle absence of Windows SDK (#6262) 2024-09-13 15:56:26 +02:00
Daniel McNab
c2e0ad293f
Vulkan: Avoid undefined behaviour with adversarial debug label (#6257) 2024-09-12 15:03:04 +02:00
Adam Winiarczuk
f3cbd6ce54
fix: Set mip_level_count in TextureInitTracker for externally created textures (#6249)
Co-authored-by: Adam Winiarczuk <tsu@liv.tv>
2024-09-10 22:28:36 +00:00
teoxoy
c4110afc7f [wgpu-core] inline Storage.insert_impl() 2024-09-10 11:58:54 +02:00
teoxoy
2addb267fc [wgpu-core] remove FutureId.into_id() 2024-09-10 11:58:54 +02:00
teoxoy
c182d3f24f [wgpu-core] rename .strict_unregister() & .strict_remove() to .remove() 2024-09-10 11:58:54 +02:00
teoxoy
ac74f36590 [wgpu-core] rename .strict_get() to .get() 2024-09-10 11:58:54 +02:00
teoxoy
31edbfd0dc [wgpu-core] use .strict_get() & .strict_unregister() for command buffers
We now only rely on the presence of the inner `CommandBufferMutable` to determine if command buffers are invalid.
2024-09-10 11:58:54 +02:00
teoxoy
c0c594eff2 [wgpu-core] use Fallible for RenderBundle 2024-09-10 11:58:54 +02:00
teoxoy
ee3b63a9af [wgpu-core] use Fallible for PipelineCache 2024-09-10 11:58:54 +02:00
teoxoy
5bcdd4266e [wgpu-core] use Fallible for ShaderModule 2024-09-10 11:58:54 +02:00
teoxoy
1c5793afb3 [wgpu-core] use Fallible for PipelineLayout 2024-09-10 11:58:54 +02:00
teoxoy
e444e78d94 [wgpu-core] use Fallible for BindGroupLayout 2024-09-10 11:58:54 +02:00
teoxoy
45206e553d [wgpu-core] use Fallible for RenderPipeline 2024-09-10 11:58:54 +02:00
teoxoy
82ce2ea747 [wgpu-core] use Fallible for ComputePipeline 2024-09-10 11:58:54 +02:00
teoxoy
b42500ee40 [wgpu-core] use Fallible for BindGroup 2024-09-10 11:58:54 +02:00
teoxoy
2ea314e978 [wgpu-core] remove Arc around StagingBuffer 2024-09-10 11:58:54 +02:00
teoxoy
b14fe14e88 [wgpu-core] use Fallible for QuerySet 2024-09-10 11:58:54 +02:00
teoxoy
3ed1abc492 [wgpu-core] use Fallible for Sampler 2024-09-10 11:58:54 +02:00
teoxoy
04f17d4197 [wgpu-core] use Fallible for TextureView 2024-09-10 11:58:54 +02:00
teoxoy
c630821f1d [wgpu-core] use Fallible for Texture 2024-09-10 11:58:54 +02:00
teoxoy
68e8b7d4a8 [wgpu-core] introduce Fallible and use it for Buffer (first step of invalidity internalization) 2024-09-10 11:58:54 +02:00
teoxoy
3437589107 [wgpu-core] use .strict_get() & .strict_unregister() for devices
This works because we never assign errors to devices (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy
07c397a1e5 [wgpu-core] use .strict_get() & .strict_unregister() for queues
This works because we never assign errors to queues (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy
aa280ecd44 [wgpu-core] change return type of device creation methods to be more rusty
This is fine from the WebGPU spec's perspective as device creation returns a promise that can reject.
2024-09-10 11:58:54 +02:00
teoxoy
da9afea271 [wgpu-core] use .strict_get() & .strict_unregister() for surfaces
This works because we never assign errors to surfaces (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy
98426329a4 [wgpu-core] introduce Registry .strict_get() & .strict_unregister() and use them for adapters
This works because we never assign errors to adapters (they are never invalid).
2024-09-10 11:58:54 +02:00
teoxoy
70a9c01b48 [wgpu-core] make the Registry generic over T: Clone 2024-09-10 11:58:54 +02:00
teoxoy
d550342f47 [wgpu-core] use device.instance_flags when possible 2024-09-10 11:58:54 +02:00
dependabot[bot]
5c7389a068
build(deps): bump the patch-updates group with 21 updates (#6239)
Bumps the patch-updates group with 21 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.86` | `1.0.87` |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.17.1` | `1.18.0` |
| [serde](https://github.com/serde-rs/serde) | `1.0.209` | `1.0.210` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.127` | `1.0.128` |
| [backtrace](https://github.com/rust-lang/backtrace-rs) | `0.3.73` | `0.3.74` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.15` | `1.1.18` |
| [clap](https://github.com/clap-rs/clap) | `4.5.16` | `4.5.17` |
| [clap_builder](https://github.com/clap-rs/clap) | `4.5.15` | `4.5.17` |
| [gimli](https://github.com/gimli-rs/gimli) | `0.29.0` | `0.31.0` |
| [parking](https://github.com/smol-rs/parking) | `2.2.0` | `2.2.1` |
| [plotters](https://github.com/plotters-rs/plotters) | `0.3.6` | `0.3.7` |
| [plotters-backend](https://github.com/plotters-rs/plotters) | `0.3.6` | `0.3.7` |
| [plotters-svg](https://github.com/plotters-rs/plotters) | `0.3.6` | `0.3.7` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.35` | `0.38.36` |
| [serde_derive](https://github.com/serde-rs/serde) | `1.0.209` | `1.0.210` |
| [wayland-backend](https://github.com/smithay/wayland-rs) | `0.3.6` | `0.3.7` |
| [wayland-client](https://github.com/smithay/wayland-rs) | `0.31.5` | `0.31.6` |
| [wayland-cursor](https://github.com/smithay/wayland-rs) | `0.31.5` | `0.31.6` |
| [wayland-scanner](https://github.com/smithay/wayland-rs) | `0.31.4` | `0.31.5` |
| [wayland-sys](https://github.com/smithay/wayland-rs) | `0.31.4` | `0.31.5` |
| [xml-rs](https://github.com/kornelski/xml-rs) | `0.8.21` | `0.8.22` |


Updates `anyhow` from 1.0.86 to 1.0.87
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.86...1.0.87)

Updates `bytemuck` from 1.17.1 to 1.18.0
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.17.1...v1.18.0)

Updates `serde` from 1.0.209 to 1.0.210
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.209...v1.0.210)

Updates `serde_json` from 1.0.127 to 1.0.128
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/1.0.127...1.0.128)

Updates `backtrace` from 0.3.73 to 0.3.74
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.73...0.3.74)

Updates `cc` from 1.1.15 to 1.1.18
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.1.15...cc-v1.1.18)

Updates `clap` from 4.5.16 to 4.5.17
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.16...clap_complete-v4.5.17)

Updates `clap_builder` from 4.5.15 to 4.5.17
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.15...v4.5.17)

Updates `gimli` from 0.29.0 to 0.31.0
- [Changelog](https://github.com/gimli-rs/gimli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/gimli/compare/0.29.0...0.31.0)

Updates `parking` from 2.2.0 to 2.2.1
- [Release notes](https://github.com/smol-rs/parking/releases)
- [Changelog](https://github.com/smol-rs/parking/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/parking/compare/v2.2.0...v2.2.1)

Updates `plotters` from 0.3.6 to 0.3.7
- [Changelog](https://github.com/plotters-rs/plotters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotters-rs/plotters/compare/v0.3.6...v0.3.7)

Updates `plotters-backend` from 0.3.6 to 0.3.7
- [Changelog](https://github.com/plotters-rs/plotters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotters-rs/plotters/compare/v0.3.6...v0.3.7)

Updates `plotters-svg` from 0.3.6 to 0.3.7
- [Changelog](https://github.com/plotters-rs/plotters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotters-rs/plotters/compare/v0.3.6...v0.3.7)

Updates `rustix` from 0.38.35 to 0.38.36
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.35...v0.38.36)

Updates `serde_derive` from 1.0.209 to 1.0.210
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.209...v1.0.210)

Updates `wayland-backend` from 0.3.6 to 0.3.7
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Updates `wayland-client` from 0.31.5 to 0.31.6
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Updates `wayland-cursor` from 0.31.5 to 0.31.6
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Updates `wayland-scanner` from 0.31.4 to 0.31.5
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Updates `wayland-sys` from 0.31.4 to 0.31.5
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/historical_changelog.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Updates `xml-rs` from 0.8.21 to 0.8.22
- [Changelog](https://github.com/kornelski/xml-rs/blob/main/Changelog.md)
- [Commits](https://github.com/kornelski/xml-rs/compare/0.8.21...0.8.22)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: backtrace
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: clap
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: clap_builder
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: gimli
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: parking
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: plotters
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: plotters-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: plotters-svg
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wayland-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wayland-client
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wayland-cursor
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wayland-scanner
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wayland-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: xml-rs
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 15:04:28 +02:00
teoxoy
480abae331 fix ordering of device.valid.store in device_destroy 2024-09-09 15:03:19 +02:00
teoxoy
eb47449eb9 invalidate the device when we encounter driver-induced device loss or on unexpected errors 2024-09-09 15:03:19 +02:00
dependabot[bot]
ce6a46ee0c
build(deps): bump JamesIves/github-pages-deploy-action from 4.6.3 to 4.6.4 (#6237)
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.3 to 4.6.4.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.6.3...v4.6.4)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 15:02:35 +02:00
dependabot[bot]
5889eff44d
build(deps): bump crate-ci/typos from 1.24.1 to 1.24.5 (#6238)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.24.1 to 1.24.5.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.24.1...v1.24.5)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09 15:02:05 +02:00
Teodor Tanasoaia
055372902d
[d3d12] handle known error variants returned by D3D12CreateDevice (#6241) 2024-09-09 09:01:24 -04:00
Mads Marquart
fb0cb1eb11
[metal] Improve layer initialization and resizing (#6107)
* [metal]: Create a new layer instead of overwriting the existing one

Overriding the `layer` on `NSView` makes the view "layer-hosting", see
[wantsLayer], which disables drawing functionality on the view like
`drawRect:`/`updateLayer`.

This prevents crates like Winit from providing a robust rendering
callback that integrates well with the rest of the system.

Instead, if the layer is not CAMetalLayer, we create a new sublayer, and
render to that instead.

[wantsLayer]: https://developer.apple.com/documentation/appkit/nsview/1483695-wantslayer?language=objc

* [metal]: Fix double-free when re-using layer

* doc: Document the behavior when mis-configuring width/height of Surface

* [metal]: Use kCAGravityResize for smoother resizing

* [metal] Do not keep the view around that the surface was created from

We do not need to use it, and the layer itself is already retained, so
it won't be de-allocated from under our feet.

* Always set delegate on layers created by Wgpu

* More docs on contentsGravity
2024-09-08 16:28:14 +02:00
Brad Werth
9b36a3e129
Make bind group an Option for set_bind_group calls. (#6216)
This is just an API change for all the "set_bind_group" calls. Calls
that pass a Some() argument should have unchanged behavior. The None
cases are left as TODOs.
2024-09-06 14:29:09 -07:00
Jim Blandy
c87717b814
[naga] Document snapshots::Targets::IR and ANALYSIS. (#6231) 2024-09-06 16:59:20 -04:00
Deep Vora
50b71287ce
fix: 5890 set upper bound for vertical jump (#6034) 2024-09-06 16:00:42 +00:00
Erich Gubler
0e352f5b34
Resolve lints for Rust 1.78-1.81 that can be preempted before upgrade (#6225)
* chore: remove `Context` methods detected as dead code

This is detected by `rustc` as of Rust 1.79.0.

* refactor: satisfy `clippy::manual_inspect`

Detected as of Rust 1.81.0.

* refactor: satisfy `clippy::needless_borrows_for_generic_args`

Detected as of Rust 1.81.0.

* refactor: suppress false-positive `dead_code` lint for `SubmissionIndex`

* chore: eliminate `dead_code` when `target_os = "emscripten"`
2024-09-06 11:55:22 +02:00
Valaphee The Meerkat
07684d3623
Rename Rg11b10UFloat to Rg11b10Ufloat (#6226) 2024-09-06 11:46:49 +02:00
Nicolas Silva
e6a2a86f2c
Fix a regression from #6223 (#6227)
buffer and texture got swapped in one of theses few places where the type system couldn't catch my mistake.
2024-09-06 09:39:09 +00:00
Jim Blandy
0b93030582
[ci] Re-enable cargo doc --document-private-items in CI (#6224)
[ci] Re-enable `cargo doc --document-private-items` in CI

Re-enable CI checks that naga, wgpu-core, and wgpu-hal documentation
builds without warnings, even with `--document-private-items`. This
was previously disabled due to #4905, which causes long build times,
but with the de-generification of `wgpu_core`, that's no longer a
problem: a build of all three crates' docs now takes only 7s.

---------

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-09-05 19:28:47 +00:00