Commit Graph

8913 Commits

Author SHA1 Message Date
Erich Gubler
567fdbc2db chore: satisfy clippy::manual_c_str_literals
This was previously an `allow`-by-default warning in Clippy's `pedantic`
group, but with Rust 1.83 it was promoted to a `warn`-by-default member
of its `complexity` group.

Co-Authored-By: Kevin Reid <kpreid@switchb.org>
2025-02-26 22:58:50 -05:00
Erich Gubler
18951ea3d2 build: update CORE_MSRV 1.76.0 → 1.80.1 2025-02-26 22:58:50 -05:00
Kevin Reid
177205b3be Make lack of spirv-as non-fatal for testing. 2025-02-26 19:19:46 -05:00
Junjun Dong
93f64dc847 perf: wgsl::…::Lowerer::lower: don't clone diagnostic_filters arena (#7176)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-02-25 20:52:03 +00:00
Jamie Nicol
b7d1f4c6cf [naga spv-out] Ensure loops generated by SPIRV backend are bounded (#7080)
If it is undefined behaviour for loops to be infinite, then, when
encountering an infinite loop, downstream compilers are able to make
certain optimizations that may be unsafe. For example, omitting bounds
checks. To prevent this, we must ensure that any loops emitted by our
backends are provably bounded. We already do this for both the MSL and
HLSL backends. This patch makes us do so for SPIRV as well.

The construct used is the same as for HLSL and MSL backends: use a
vec2<u32> to emulate a 64-bit counter, which is incremented every
iteration and breaks after 2^64 iterations.

While the implementation is fairly verbose for the SPIRV backend, the
logic is simple enough. The one point of note is that SPIRV requires
`OpVariable` instructions with a `Function` storage class to be
located at the start of the first block of the function. We therefore
remember the IDs generated for each loop counter variable in a
function whilst generating the function body's code. The instructions
to declare these variables are then emitted in `Function::to_words()`
prior to emitting the function's body.

As this may negatively impact shader performance, this workaround can
be disabled using the same mechanism as for other backends: eg calling
Device::create_shader_module_trusted() and setting the
ShaderRuntimeChecks::force_loop_bounding flag to false.
2025-02-25 15:23:44 +01:00
Jim Blandy
e0f01854a8 [naga wgsl-in] Introduce AbstractRule enum.
Introduce the `AbstractRule` enum to control the behavior of
`Lowerer::type_and_init`. This is slightly clearer than
`allow_abstract: bool`, but more wordy.
2025-02-25 09:25:25 +00:00
Jim Blandy
ab70237126 [naga] Introduce TypeInner::is_abstract utility function.
Define `TypeInner::is_abstract`, and let it take a type arena so that
it can properly handle abstract arrays. Use this in compaction and in
the WGSL front end's conversion code to recognize abstract types.
2025-02-25 09:25:25 +00:00
Jamie Nicol
9f949459f7 [naga wgsl-in] Add additional test cases regarding abstract-typed global consts 2025-02-25 09:25:25 +00:00
Jamie Nicol
dd2d53814d [naga wgsl-in] Do not eagerly concretize global const declarations of abstract types
Instead allow the const to be converted and each time it is const
evaluated as part of another expression. This allows an abstract const
to be used as a different type depending on the context.

A consequence of this is that abstract types may now find their way to
the validation stage, which we don't want. We therefore additionally
now ensure that the compact pass removes global constants of abstract
types. This will have no *functional* effect on shaders generated by
the backends, as the expressions belonging to the abstract consts in
the IR will not actually be used, as any usage in the input shader
will have been const-evaluated away. Certain unused const declarations
will now be removed, however, as can be seen by the effect on the
snapshot outputs.
2025-02-25 09:25:25 +00:00
Jamie Nicol
da90d7aaa6 [naga wgsl-in] Ensure ConstantEvaluator::cast_array() handles Constant expressions
It must call ConstantEvaluator::check_and_get() to possibly retrieve
the constant expression from a separate arena, like is currently done
when evaluating `As` expressions for non-array casts.
2025-02-25 09:25:25 +00:00
Connor Fitzgerald
dc97a61ee7 Configure spv-in settings in toml file (#7215) 2025-02-25 05:23:03 +00:00
Connor Fitzgerald
8fb09a5ad6 Move REPO_MSRV to 1.85 (#7218) 2025-02-24 23:39:34 -05:00
Kent Slaney
6be5558865 [naga] allow trailing commas in template lists (#7142)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-02-25 03:02:55 +00:00
Connor Fitzgerald
2c42a1844f Move wgsl snapshots from tests/naga/in to tests/naga/in/wgsl (#7214) 2025-02-24 21:33:06 -05:00
Wouter de Bruijn
dfb09c260f naga-cli: forward '--keep-coordinate-space' flag to GLSL backend (#7206) 2025-02-24 23:21:48 +00:00
Jim Blandy
7cbad8e380 CONTRIBUTING.md: Fill out section on pull requests. (#6879) 2025-02-24 18:09:04 -05:00
Andreas Reich
f98bd602b9 Update enabled_backend_features to take improved backend feature flags into account (#7195) 2025-02-24 17:51:17 -05:00
Flávio J. Saraiva
a26171b2a0 Fix compilation for targets that don't have AtomicU64. (#7118)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-02-24 22:07:13 +00:00
Connor Fitzgerald
37419a3690 Fix workaround for #7200 (#7216) 2025-02-24 16:37:25 -05:00
Alexandre Mommers
92a1702c3c [naga wgsl-in] Add support for unsigned types when calling textureLoad with the level parameter. (#7058) 2025-02-24 21:13:06 +00:00
Connor Fitzgerald
031ed26ac3 Rename bench's root benchmark to wgpu-benchmark 2025-02-24 11:53:24 -05:00
Connor Fitzgerald
29ce7fff58 Rename player's test test to player-test 2025-02-24 11:53:24 -05:00
Connor Fitzgerald
00a853ce11 Add documentation for our tests 2025-02-24 11:53:24 -05:00
наб
67ed556f32 Fix examples links in README (#7164) 2025-02-24 16:45:43 +00:00
Samson
2f255edc60 [naga] Use const ctx instead of global ctx for type resolution (#6935)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-02-24 16:24:37 +01:00
minus1ms
e95f6d632c binding size fix (#7177) 2025-02-24 15:48:06 +01:00
Kevin Reid
3447b3e7b6 Polish documentation of PresentMode.
* Link to where it is used and how to check support.
* Link from `Auto*` to the variants they refer to.
* Organize mode information into lists.
* Document which value is the default value.
* Various wording changes.

I mostly did not touch the descriptions of the individual modes.
I think that they could use some explanation of jargon (what is a
“presentation engine”, really?) but I am not the person to write that.
2025-02-24 10:15:40 +01:00
dependabot[bot]
853d90e00a chore(deps): bump the patch-updates group with 14 updates (#7209)
Bumps the patch-updates group with 14 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.95` | `1.0.96` |
| [libc](https://github.com/rust-lang/libc) | `0.2.169` | `0.2.170` |
| [log](https://github.com/rust-lang/log) | `0.4.25` | `0.4.26` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.138` | `1.0.139` |
| [serde](https://github.com/serde-rs/serde) | `1.0.217` | `1.0.218` |
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | `1.0.16` | `1.0.17` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.14` | `1.2.15` |
| [clap](https://github.com/clap-rs/clap) | `4.5.29` | `4.5.30` |
| [clap_builder](https://github.com/clap-rs/clap) | `4.5.29` | `4.5.30` |
| [either](https://github.com/rayon-rs/either) | `1.13.0` | `1.14.0` |
| [serde_derive](https://github.com/serde-rs/serde) | `1.0.217` | `1.0.218` |
| [target-triple](https://github.com/dtolnay/target-triple) | `0.1.3` | `0.1.4` |
| [uuid](https://github.com/uuid-rs/uuid) | `1.13.1` | `1.14.0` |
| [winnow](https://github.com/winnow-rs/winnow) | `0.7.2` | `0.7.3` |


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

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

Updates `log` from 0.4.25 to 0.4.26
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.25...0.4.26)

Updates `serde_json` from 1.0.138 to 1.0.139
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.138...v1.0.139)

Updates `serde` from 1.0.217 to 1.0.218
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.217...v1.0.218)

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

Updates `cc` from 1.2.14 to 1.2.15
- [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.2.14...cc-v1.2.15)

Updates `clap` from 4.5.29 to 4.5.30
- [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.29...clap_complete-v4.5.30)

Updates `clap_builder` from 4.5.29 to 4.5.30
- [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.29...v4.5.30)

Updates `either` from 1.13.0 to 1.14.0
- [Commits](https://github.com/rayon-rs/either/compare/1.13.0...1.14.0)

Updates `serde_derive` from 1.0.217 to 1.0.218
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.217...v1.0.218)

Updates `target-triple` from 0.1.3 to 0.1.4
- [Release notes](https://github.com/dtolnay/target-triple/releases)
- [Commits](https://github.com/dtolnay/target-triple/compare/0.1.3...0.1.4)

Updates `uuid` from 1.13.1 to 1.14.0
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/1.13.1...v1.14.0)

Updates `winnow` from 0.7.2 to 0.7.3
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.7.2...v0.7.3)

---
updated-dependencies:
- dependency-name: anyhow
  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: log
  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: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: unicode-ident
  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: either
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: serde_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: target-triple
  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: winnow
  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>
2025-02-23 22:06:20 -05:00
dependabot[bot]
450b926094 chore(deps): bump JamesIves/github-pages-deploy-action (#7208)
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.7.2 to 4.7.3.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.7.2...v4.7.3)

---
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>
2025-02-23 22:04:45 -05:00
dependabot[bot]
f90376b0f4 chore(deps): bump crate-ci/typos from 1.29.7 to 1.29.9 (#7207)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.29.7 to 1.29.9.
- [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.29.7...v1.29.9)

---
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>
2025-02-23 22:04:24 -05:00
Connor Fitzgerald
8a4e50f1a0 Rename tests/validation_tests to tests/validation-tests 2025-02-23 14:06:34 -05:00
Connor Fitzgerald
31eb329748 Make tests/compile_tests into tests/compile-tests 2025-02-23 14:06:34 -05:00
Connor Fitzgerald
c4114e7347 Rename tests/tests to tests/gpu-tests 2025-02-23 14:06:34 -05:00
Connor Fitzgerald
d7b22dcb70 Workaround #7200 (#7201) 2025-02-23 12:58:06 -05:00
Connor Fitzgerald
ab0e4b1b6f Refactor Validation Tests a Bit (#7199) 2025-02-23 12:57:19 -05:00
sagudev
705e3d60e7 [core] validate equal sample_count in copy_texture_to_texture
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-02-23 15:05:55 +01:00
Connor Fitzgerald
111425b789 Refactor Documentation into a docs folder (#7202) 2025-02-23 09:43:17 +01:00
Connor Fitzgerald
ae5dc0e7cb Target Specific Compilation (#7076) 2025-02-22 12:38:58 +01:00
Connor Fitzgerald
f781a6b6ca Fix Obscured Warning (#7193) 2025-02-21 22:47:06 -05:00
Connor Fitzgerald
77763b15b3 Remove getrandom from examples (#7194) 2025-02-21 22:46:18 -05:00
Connor Fitzgerald
a8af685fd5 Convert Snapshot Configuration to TOML (#7160)
* Prepare for Toml

* Convert Configurations Entirely To TOML
2025-02-21 19:55:01 -05:00
Connor Fitzgerald
473dd2fdd9 Refactor Snapshots to Be Fully Configuration Based (#7153)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-02-21 18:22:54 -05:00
Erich Gubler
d5241dd675 refactor(ci): regulate titles in CI step names (#7172) 2025-02-21 19:39:48 +00:00
Connor Fitzgerald
4d24df2b3b Fix enumeration of wgpu example shaders in example_wgsl test (#7191)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-02-21 19:31:30 +00:00
Erich Gubler
143ad278f2 typo: s/viritualization/virtualization (#7192) 2025-02-21 17:06:42 +00:00
Connor Fitzgerald
f44ecda16b Fix Execution of Benchmarks (#7190) 2025-02-21 11:43:50 -05:00
Connor Fitzgerald
1ec34839ee Improve Validation Errors with Naga Validator (#7185) 2025-02-21 10:57:59 -05:00
Kevin Reid
12ec5fd16f wgpu: Make macros usable from no_std and use strictly $crate paths. 2025-02-21 08:47:16 +01:00
Kevin Reid
b3b54b6941 wgpu: Adjust imports to allow no_std.
Remaining uses of `std`:
* `trace_path` / `trace_dir`
* `std::error::Error` (waiting for Rust 1.81)
* `std::ffi::c_void`
* Various uses in `util`
2025-02-21 08:47:16 +01:00
Kevin Reid
7bcbfe0712 wgpu-core: Adjust imports to allow no_std.
Dependencies on `std` that still exist:
* Locks
* `std::error::Error` (waiting for Rust 1.81)
* `std::os::raw::c_char` for FFI
* `thread_local` and `Backtrace` in `snatch`
2025-02-21 08:47:16 +01:00