Commit Graph

8318 Commits

Author SHA1 Message Date
teoxoy
f669024eeb [WeakVec] scan all weak references only before a reallocation would happen 2024-10-18 17:24:52 +02:00
teoxoy
8ba5c82831 minimize moves by introducing WeakVec 2024-10-18 17:24:52 +02:00
Jasper St. Pierre
1b2ef8612d
naga: Add support for textureQueryLevels to GLSL parser (#6415) 2024-10-18 10:07:58 +02:00
cybersoulK
a8214b67f6
Fix missing binding in wgpu-core/src/instance.rs when profiling has a backend enabled (#6422) 2024-10-18 00:15:25 +00:00
teoxoy
94e040bc8a avoid creating the bind group for indirect validation if buffer size is 0 2024-10-17 18:41:24 +02:00
Xiaopeng Li
74ef445bca
ADD metal namespace for uint4 (#6417) 2024-10-17 11:45:29 +02:00
Andreas Reich
59f56e0263
Add utils for WebGPU support detection & Instance creation (#6371)
* Utils for WebGPU support detection & Instance creation
Clarifies the docs on `wgpu::Instance` accordingly
* changelog entry
* fix adapter check

---------

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2024-10-15 13:15:37 +02:00
Erich Gubler
fe7fbd4a4a refactor(dx12): merge PipelineLayoutShared::special_constants_{root_index,cmd_signatures} into new struct 2024-10-14 15:22:18 +02:00
teoxoy
bbee35b145 [d3d12] get num_workgroups builtin working for indirect dispatches 2024-10-14 15:22:18 +02:00
Teodor Tanasoaia
7f708edd1f
Ensure safety of indirect dispatch (#5714)
by injecting a compute shader that validates the content of the indirect buffer
2024-10-14 15:02:01 +02:00
teoxoy
c0e39721a2 remove Hub.clear() 2024-10-14 13:24:44 +02:00
teoxoy
3eb9c781cf impl Drop for Surface 2024-10-14 13:24:44 +02:00
teoxoy
b7d465a2b4 move surface methods on the Surface 2024-10-14 13:24:44 +02:00
teoxoy
26624c04e0 add SurfaceError::TextureDestroyed 2024-10-14 13:24:44 +02:00
teoxoy
39629d0de0 Improve the ownership story of textures returned by get_current_texture
`present` and `discard` will no longer automatically remove the texture from the registry.
2024-10-14 13:24:44 +02:00
teoxoy
e86330977b remove parent_id field of TextureInner::Surface
The `parent_id` will always match `surface_id` because we got the texture from the `acquired_texture` field.
2024-10-14 13:24:44 +02:00
teoxoy
c38ed8d9fa move surface creation methods on the Instance 2024-10-14 13:24:44 +02:00
teoxoy
de97e5449c move enumerate_adapters on the Instance 2024-10-14 13:24:44 +02:00
teoxoy
952ba3e12c move queue methods on the Queue type 2024-10-14 13:24:44 +02:00
teoxoy
c65c4626f1 make Fallible<T> public 2024-10-14 13:24:44 +02:00
teoxoy
4d55c6917e make remaining Adapter methods public 2024-10-14 13:24:44 +02:00
teoxoy
d1c95d2bfd add adapter getters 2024-10-14 13:24:44 +02:00
teoxoy
321bd64ba2 add Adapter::backend() 2024-10-14 13:24:44 +02:00
teoxoy
5627a0b6d9 move request_adapter on the Instance 2024-10-14 13:24:44 +02:00
teoxoy
40206ce4d7 add new Instance::as_hal fn 2024-10-14 13:24:44 +02:00
Erich Gubler
f2faf609af
refactor(glsl-out): hoist new if let TypeInner::Struct out of varying_required_features (#6230) 2024-10-14 12:45:32 +02:00
FL33TW00D
f842d80f52 chore: note: round_ties_even is on stable, but not MSRV yet
Co-Authored-By: Erich Gubler <erichdongubler@gmail.com>
2024-10-14 06:43:53 -04:00
dependabot[bot]
5032291573
build(deps): bump the patch-updates group with 12 updates (#6408)
Bumps the patch-updates group with 12 updates:

| Package | From | To |
| --- | --- | --- |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.18.0` | `1.19.0` |
| [glow](https://github.com/grovesNL/glow) | `0.14.1` | `0.14.2` |
| [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) | `0.2.93` | `0.2.95` |
| [web-sys](https://github.com/rustwasm/wasm-bindgen) | `0.3.70` | `0.3.72` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.28` | `1.1.30` |
| [clap](https://github.com/clap-rs/clap) | `4.5.19` | `4.5.20` |
| [clap_builder](https://github.com/clap-rs/clap) | `4.5.19` | `4.5.20` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.86` | `1.0.87` |
| [wasm-bindgen-backend](https://github.com/rustwasm/wasm-bindgen) | `0.2.93` | `0.2.95` |
| [wasm-bindgen-macro](https://github.com/rustwasm/wasm-bindgen) | `0.2.93` | `0.2.95` |
| [wasm-bindgen-macro-support](https://github.com/rustwasm/wasm-bindgen) | `0.2.93` | `0.2.95` |
| [wasm-bindgen-shared](https://github.com/rustwasm/wasm-bindgen) | `0.2.93` | `0.2.95` |


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

Updates `glow` from 0.14.1 to 0.14.2
- [Commits](https://github.com/grovesNL/glow/commits)

Updates `wasm-bindgen` from 0.2.93 to 0.2.95
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.95)

Updates `web-sys` from 0.3.70 to 0.3.72
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `cc` from 1.1.28 to 1.1.30
- [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.28...cc-v1.1.30)

Updates `clap` from 4.5.19 to 4.5.20
- [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.19...clap_complete-v4.5.20)

Updates `clap_builder` from 4.5.19 to 4.5.20
- [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.19...v4.5.20)

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

Updates `wasm-bindgen-backend` from 0.2.93 to 0.2.95
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.95)

Updates `wasm-bindgen-macro` from 0.2.93 to 0.2.95
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.95)

Updates `wasm-bindgen-macro-support` from 0.2.93 to 0.2.95
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.95)

Updates `wasm-bindgen-shared` from 0.2.93 to 0.2.95
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.93...0.2.95)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: glow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: web-sys
  dependency-type: direct:production
  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: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-backend
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-macro
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-macro-support
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-shared
  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-10-14 02:46:00 -04:00
Erich Gubler
2b15a2b24b
refactor: fully qual. size_of usage (#6401) 2024-10-12 00:48:57 +00:00
Erich Gubler
91447aefc9 refactor: s/once_cell::sync::OnceCell/std::sync::OnceLock
Weaken our dependence on the `once_cell` crate by using functionality
from `std` instead that was upstreamed from `once_cell`.

It's not yet possible to eliminate this dependency entirely, but do what
we can for now.
2024-10-11 15:52:21 -07:00
Erich Gubler
a13e710956 chore: satisfy unused_qualifications (again)
Regressed by
[#6354](https://github.com/gfx-rs/wgpu/pull/6354/files#diff-1dd0973ceb242a02442d33e422f9dff40e007b505d0ee726613e1763e61e768dR2809)
(CC @jimb). Hopefully will get plugged by
[#6105](https://github.com/gfx-rs/wgpu/pull/6105/).
2024-10-11 12:27:34 -07:00
Erich Gubler
6bd2e0b9cb test(ci): enforce TOML formatting with taplo 0.9.3 2024-10-11 14:40:01 -04:00
Erich Gubler
d22aa2eb55 chore: format TOML files with taplo 0.9.3 2024-10-11 14:40:01 -04:00
Erich Gubler
bc5b24520a style: remove trailing whitespace in PR template 2024-10-11 14:40:01 -04:00
Schell Carl Scivally
76b1605090
[spv-in] sampling from depth textures returns a scalar and is splatted (#6384) 2024-10-11 20:24:16 +02:00
Jim Blandy
1047fa57f0 [naga] Move array-by-value snapshot tests to index-by-value.wgsl. 2024-10-11 08:27:15 -07:00
Jim Blandy
ed3006ccc6 [naga spv-out] Spill arrays and matrices for runtime indexing.
Improve handling of `Access` expressions whose base is an array or
matrix (not a pointer to such), and whose index is not known at
compile time. SPIR-V does not have instructions that can do this
directly, so spill such values to temporary variables, and perform the
accesses using `OpAccessChain` instructions applied to the
temporaries.

When performing chains of accesses like `a[i].x[j]`, do not reify
intermediate values; generate a single `OpAccessChain` for the entire
thing.

Remove special cases for arrays; the same code now handles arrays and
matrices.

Update validation to permit dynamic indexing of matrices.

For details, see the comments on the new tracking structures in
`naga:🔙:spv::Function`.

Add snapshot test `index-by-value.wgsl`.

Fixes #6358.
Fixes #4337.
Alternative to #6362.
2024-10-11 08:27:15 -07:00
Jim Blandy
475a716822 [naga spv-out] Let write_checked_load take AccessTypeAdjustment.
Let `BlockContext::write_checked_load` take an `AccessTypeAdjustment`
argument, so that the caller can choose what adjustment to apply to
`pointer`.
2024-10-11 08:27:15 -07:00
Jim Blandy
26a95fd270 [naga spv-out] Add some tracing output to Writer::write_function. 2024-10-11 08:27:15 -07:00
Jim Blandy
436ffba77a [naga spv-out] Introduce Writer::get_resolution_pointer_id.
Introduce a new helper function,
`naga:🔙:spv::Writer::get_resolution_pointer_id`. Use it in
`BlockContext::write_expression_pointer`.
2024-10-11 08:27:15 -07:00
Jim Blandy
0f17ad6455 [naga] Add new function, GuardedIndex::from_expression.
Pull out the code to build a `naga::proc::index::GuardedIndex` from a
`Handle<Expression>` into its own function,
`GuardedIndex::from_expression`. Use that function in
`GuardedIndex::try_resolve_to_constant`.
2024-10-11 08:27:15 -07:00
Jim Blandy
0392613b5a [naga spv-out] Abstract out NumericType::from_inner.
Pull out the code for building a `naga:🔙:spv::NumericType` from a
`TypeInner` into its own function, `NumericType::from_inner`. Use that
in `LocalType::from_inner`.
2024-10-11 08:27:15 -07:00
Jim Blandy
4427ff9622 [naga spv-out] Use crate::proc::index::GuardedIndex.
Replace qualified paths with a `use` directive.
2024-10-11 08:27:15 -07:00
Jim Blandy
57b8858f96 [naga spv-out] Gather array, matrix, and vector cases.
This commit is just code motion.
2024-10-11 08:27:15 -07:00
Jim Blandy
f9075fc4b8 [naga] Test access to a member/element through a pointer. 2024-10-11 08:27:15 -07:00
Jim Blandy
b9f1e4a266 [naga spv-out] Clean up write_expression_pointer type adjustment.
Replace the `return_type_override` argument of
`BlockContext::write_expression_pointer` with an enum that says how to
derive the return type from `expr_handle`'s type.

Introduce a new type, `AccessTypeAdjustment`, that covers possible
derivation rules.

This simplifies callers and the callee, in part by making the possible
alternatives less general, and by giving them explicit names (the
variants of the `AccessTypeAdjustment` enum).
2024-10-11 08:27:15 -07:00
Jim Blandy
d034c4b428 [naga spv-out] Move code to load a pointer into its own function.
Introduce a new function,
`naga:🔙:spv::BlockContext::write_checked_load`, that does the
work of `Expression::Load`.

This change is just code motion, and should have no effect on
behavior. The new function will be used in later commits.
2024-10-11 08:27:15 -07:00
Ronny Chan
73764fdc6a
[naga/wgsl-out]: polyfill inverse function (#6385) 2024-10-11 15:56:12 +02:00
Jim Blandy
d70ef62e9e
[wgpu] Revert changes to vendored copy of web-sys from #6377. (#6380)
Revert the changes to the vendored copy of web-sys's WebGPU bindings
made in #6377. The only purpose of vendoring is to pin down our WebGPU
JS bindings, not to allow local changes. And as it turns out, removing
the `max_inter_stage_shader_components` accessor isn't necessary in
order to fix #6290.
2024-10-10 11:24:49 -04:00
Jim Blandy
ae52e5dc96 [naga spv-out] Delete BlockContext::is_intermediate; use types.
Delete the function `BlockContext::is_intermediate`. Instead, have
`Access` and `AccessIndex` instructions decide whether to defer code
generation based on the type of the base expression: indexing
operations on pointers are deferred; anything else is not.
2024-10-10 07:42:02 -07:00