Commit Graph

8437 Commits

Author SHA1 Message Date
teoxoy
207747cab5 [hlsl-out] add support for restricting indexing to avoid OOB accesses 2024-10-23 16:51:44 +02:00
teoxoy
3199a3a6b0 refactor access_needs_check to take a reference to the expression arena 2024-10-23 16:51:44 +02:00
teoxoy
b32574b368 add OOB indexing test 2024-10-23 16:51:44 +02:00
teoxoy
daaf7da09a print source in log 2024-10-23 16:51:44 +02:00
DevJac
fe8a9b2f95 Adapter docs tell how to create 2024-10-22 19:28:54 -04:00
Erich Gubler
d539466997 feat(wgsl-in): use more general enable-not-set diag. w/ unimpl. hint 2024-10-22 16:31:07 -04:00
Erich Gubler
bf4cd9cd31 feat(wgsl-in): create skeleton for enable directives
Co-Authored-By: FL33TW00D <chris@fleetwood.dev>
2024-10-22 16:31:07 -04:00
Erich Gubler
54861b712c refactor: add Parser::directive_ident_list helper 2024-10-22 16:31:07 -04:00
Erich Gubler
7aa00a07e1 refactor(naga-cli): inline emit_annotated_error 2024-10-22 14:42:27 -04:00
Erich Gubler
28912feb00 fix(naga-cli): reimpl. emit_annotated_error with WithSpan::emit_to_stderr_with_path 2024-10-22 14:42:27 -04:00
Erich Gubler
6f43ee9f17 fix(naga): use Diagnostic from inner in valid. err. presentation
For some reason, the implementation of `Display` for
`ShaderError<WithSpan<ValidationError>>>` is building its own
`Diagnostic` with _only_ the labels populated: no messages or notes.
I don't know why this is, but it seems to have a strict subset of the
information already present in the private implementation of
`WithSpan::diagnostic`.

Fix this by exposing `WithSpan::diagnostic` as `pub(crate)`, and
re-using its output in `impl Display for
ShaderError<WithSpan<ValidationError>>>`.
2024-10-22 14:42:27 -04:00
Erich Gubler
36fab5ce3d fix(msl-out): use namer for <fun>{Input,Output} structs 2024-10-22 10:14:26 -04:00
Erich Gubler
2302b5fac6 test: add regr. cvg. for conflicting idents. in shader I/O and locals 2024-10-22 10:14:26 -04:00
N.E.C.
e711a35998
Add bounds check to Buffer slice method (#6432)
* Add bounds check to Buffer slice method

* avoid unwrap / double option check by using `map_or`

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-10-22 15:33:05 +02:00
dependabot[bot]
4f1a9b53de
build(deps): bump the patch-updates group with 15 updates (#6429)
Bumps the patch-updates group with 15 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.89` | `1.0.90` |
| [flume](https://github.com/zesterer/flume) | `0.11.0` | `0.11.1` |
| [libc](https://github.com/rust-lang/libc) | `0.2.159` | `0.2.161` |
| [profiling](https://github.com/aclysma/profiling) | `1.0.15` | `1.0.16` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.128` | `1.0.132` |
| [wasm-bindgen-futures](https://github.com/rustwasm/wasm-bindgen) | `0.4.43` | `0.4.45` |
| [wasm-bindgen-test](https://github.com/rustwasm/wasm-bindgen) | `0.3.43` | `0.3.45` |
| [syn](https://github.com/dtolnay/syn) | `2.0.79` | `2.0.82` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.30` | `1.1.31` |
| orbclient | `0.3.47` | `0.3.48` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.87` | `1.0.88` |
| [rustversion](https://github.com/dtolnay/rustversion) | `1.0.17` | `1.0.18` |
| [unicode-id-start](https://github.com/Boshen/unicode-id-start) | `1.3.0` | `1.3.1` |
| [uuid](https://github.com/uuid-rs/uuid) | `1.10.0` | `1.11.0` |
| [wasm-bindgen-test-macro](https://github.com/rustwasm/wasm-bindgen) | `0.3.43` | `0.3.45` |


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

Updates `flume` from 0.11.0 to 0.11.1
- [Changelog](https://github.com/zesterer/flume/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zesterer/flume/commits)

Updates `libc` from 0.2.159 to 0.2.161
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.161/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.159...0.2.161)

Updates `profiling` from 1.0.15 to 1.0.16
- [Changelog](https://github.com/aclysma/profiling/blob/master/CHANGELOG.md)
- [Commits](https://github.com/aclysma/profiling/compare/v1.0.15...v1.0.16)

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

Updates `wasm-bindgen-futures` from 0.4.43 to 0.4.45
- [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 `wasm-bindgen-test` from 0.3.43 to 0.3.45
- [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 `syn` from 2.0.79 to 2.0.82
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.79...2.0.82)

Updates `cc` from 1.1.30 to 1.1.31
- [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.30...cc-v1.1.31)

Updates `orbclient` from 0.3.47 to 0.3.48

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

Updates `rustversion` from 1.0.17 to 1.0.18
- [Release notes](https://github.com/dtolnay/rustversion/releases)
- [Commits](https://github.com/dtolnay/rustversion/compare/1.0.17...1.0.18)

Updates `unicode-id-start` from 1.3.0 to 1.3.1
- [Commits](https://github.com/Boshen/unicode-id-start/commits)

Updates `uuid` from 1.10.0 to 1.11.0
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.10.0...1.11.0)

Updates `wasm-bindgen-test-macro` from 0.3.43 to 0.3.45
- [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)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: flume
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: profiling
  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: wasm-bindgen-futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-test
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: syn
  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: orbclient
  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: rustversion
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: unicode-id-start
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: uuid
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: wasm-bindgen-test-macro
  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-21 00:51:09 -04:00
dependabot[bot]
e06f10e0a4
build(deps): bump crate-ci/typos from 1.24.6 to 1.26.0 (#6399)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-10-21 00:23:43 +00:00
Nathan Adams
759c3262ad
Optimise GL fence checking by querying less (#6427) 2024-10-20 20:02:10 -04:00
Erich Gubler
b3f665be7d feat(wgsl-in): create skeleton for parsing directives 2024-10-18 16:08:46 -04:00
Erich Gubler
cb31465811 refactor(wgsl-in): add Lexer::peek_ident_with_span
1. Break out `word_as_ident*` helpers to keep validation of identifiers
   DRY.
2. Add `peek_*` variant of `Lexer::next_ident_with_span`.

This will be consumed immediately in the subsequent commit.
2024-10-18 16:08:46 -04:00
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