Commit Graph

447 Commits

Author SHA1 Message Date
Erich Gubler
e6f52bf46d move(naga)!: move WGSL-specific diagnostic_filter stuff to naga::front::wgsl 2024-11-13 08:59:25 -05:00
Erich Gubler
66d2ac6f5d refactor(naga)!: diagnostic_filter: s/{from,to}_ident/{from,to}_wgsl_ident 2024-11-13 08:59:25 -05:00
Erich Gubler
efc15ba03b
chore: revert removal of DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE (#6534) 2024-11-13 07:03:16 -05:00
Erich Gubler
e8a8281203 diag(naga): add type info to InvalidBinaryOperandTypes 2024-11-12 09:20:56 -05:00
Erich Gubler
2a2655def8 refactor(naga): use named fields for ExpressionError::InvalidBinaryOperandTypes 2024-11-12 09:20:56 -05:00
Erich Gubler
ea75a8ced4 feat(wgsl-in): filter unif. analysis errors with derivative_uniformity
- Remove `DISABLE_UNIFORMITY_REQ_FOR_FRAGMENT_STAGE`.
- Add `CHANGELOG` entry.
- Add coverage to `naga`'s `valid::analyzer::uniform_control_flow` test.
2024-11-12 08:49:02 -05:00
Erich Gubler
b81fcb4134 refactor(wgsl-in): track diagnostic directives in func. analysis 2024-11-12 08:49:02 -05:00
Erich Gubler
290ea1553b chore: remove unimpl. diag. filt. err. check 2024-11-12 08:49:02 -05:00
Erich Gubler
7a5d505896 feat(wgsl-in): detect conflicting diag. filters 2024-11-12 08:49:02 -05:00
Erich Gubler
44b8e38fd8 refactor(wgsl-in): specify more closure ret. types in parsing
This resolves ambiguity that will be introduced in the subsequent commit
that adds `impl From<ConflictingDiagnosticRuleError> for naga::Error`.
2024-11-12 08:49:02 -05:00
Erich Gubler
5e68a63151
fix(const_eval): don't panic when a vecN constructor's arg. count is less than N (#6508) 2024-11-12 12:44:02 +00:00
Jamie Nicol
cffc7933fd
[naga] Implement quantizeToF16 (#6519)
Implement WGSL frontend and WGSL, SPIR-V, HLSL, MSL, and GLSL
backends. WGSL and SPIR-V backends natively support the instruction.
MSL and HLSL emulate it by casting to f16 and back to f32. GLSL does
similar but must (mis)use (un)pack2x16 to do so.
2024-11-12 12:05:19 +01:00
Gábor Gyebnár
47d20d913d
Fixes crash when there's a missing texture argument (#6486) 2024-11-07 16:35:36 +01:00
Jasper St. Pierre
9ccea8179d naga: Fix textureNumLevels in the GLSL backend
... and reactivate the GLSL test for it.

Fixes issue #6435.
2024-11-04 08:07:23 -08:00
dependabot[bot]
d039b4d7c3
build(deps): bump the patch-updates group with 10 updates (#6492)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-03 22:38:33 -05:00
Jim Blandy
6b85e65f51 [naga spv-out] Rename write_expression_pointer to write_access_chain.
This function's sole purpose is to generate `OpAccessChain`
instructions, so there's no point in being coy about it.
2024-10-30 21:45:39 -07:00
Erich Gubler
82f9ca6da8 chore(wgsl-in): remove unimplemented directive kinds 2024-10-30 21:40:05 -07:00
Erich Gubler
8c13d8ff56 feat(wgsl-in): parse diagnostic(…) directives (with unimpl. err.) 2024-10-30 15:39:16 -07:00
Erich Gubler
6934f5ae91 test(naga): add missing variants to DirectiveKind::iter 2024-10-30 15:39:16 -07:00
Erich Gubler
08c9d8c397 chore: bump WGPU workspace crates to 23 2024-10-30 07:14:10 -07:00
dependabot[bot]
1616c24561
build(deps): bump the patch-updates group with 24 updates (#6470)
Bumps the patch-updates group with 24 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.90` | `1.0.91` |
| [serde](https://github.com/serde-rs/serde) | `1.0.210` | `1.0.213` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.64` | `1.0.65` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.40.0` | `1.41.0` |
| [syn](https://github.com/dtolnay/syn) | `2.0.82` | `2.0.85` |
| [anstream](https://github.com/rust-cli/anstyle) | `0.6.15` | `0.6.17` |
| [anstyle](https://github.com/rust-cli/anstyle) | `1.0.8` | `1.0.9` |
| [anstyle-parse](https://github.com/rust-cli/anstyle) | `0.2.5` | `0.2.6` |
| [anstyle-query](https://github.com/rust-cli/anstyle) | `1.1.1` | `1.1.2` |
| [anstyle-wincon](https://github.com/rust-cli/anstyle) | `3.0.4` | `3.0.6` |
| [bytes](https://github.com/tokio-rs/bytes) | `1.7.2` | `1.8.0` |
| [colorchoice](https://github.com/rust-cli/anstyle) | `1.0.2` | `1.0.3` |
| [fdeflate](https://github.com/image-rs/fdeflate) | `0.3.5` | `0.3.6` |
| [minicov](https://github.com/Amanieu/minicov) | `0.3.5` | `0.3.6` |
| [pin-project](https://github.com/taiki-e/pin-project) | `1.1.6` | `1.1.7` |
| [pin-project-internal](https://github.com/taiki-e/pin-project) | `1.1.6` | `1.1.7` |
| [pin-project-lite](https://github.com/taiki-e/pin-project-lite) | `0.2.14` | `0.2.15` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.88` | `1.0.89` |
| [regex](https://github.com/rust-lang/regex) | `1.11.0` | `1.11.1` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.37` | `0.38.38` |
| [serde_derive](https://github.com/serde-rs/serde) | `1.0.210` | `1.0.213` |
| [thiserror-impl](https://github.com/dtolnay/thiserror) | `1.0.64` | `1.0.65` |
| [wayland-client](https://github.com/smithay/wayland-rs) | `0.31.6` | `0.31.7` |
| [wayland-cursor](https://github.com/smithay/wayland-rs) | `0.31.6` | `0.31.7` |


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

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

Updates `thiserror` from 1.0.64 to 1.0.65
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.64...1.0.65)

Updates `tokio` from 1.40.0 to 1.41.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.40.0...tokio-1.41.0)

Updates `syn` from 2.0.82 to 2.0.85
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.82...2.0.85)

Updates `anstream` from 0.6.15 to 0.6.17
- [Commits](https://github.com/rust-cli/anstyle/compare/anstream-v0.6.15...anstream-v0.6.17)

Updates `anstyle` from 1.0.8 to 1.0.9
- [Commits](https://github.com/rust-cli/anstyle/compare/v1.0.8...v1.0.9)

Updates `anstyle-parse` from 0.2.5 to 0.2.6
- [Commits](https://github.com/rust-cli/anstyle/compare/anstyle-parse-v0.2.5...anstyle-parse-v0.2.6)

Updates `anstyle-query` from 1.1.1 to 1.1.2
- [Commits](https://github.com/rust-cli/anstyle/compare/anstyle-query-v1.1.1...anstyle-query-v1.1.2)

Updates `anstyle-wincon` from 3.0.4 to 3.0.6
- [Commits](https://github.com/rust-cli/anstyle/compare/anstyle-wincon-v3.0.4...anstyle-wincon-v3.0.6)

Updates `bytes` from 1.7.2 to 1.8.0
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.7.2...v1.8.0)

Updates `colorchoice` from 1.0.2 to 1.0.3
- [Commits](https://github.com/rust-cli/anstyle/compare/colorchoice-v1.0.2...colorchoice-v1.0.3)

Updates `fdeflate` from 0.3.5 to 0.3.6
- [Changelog](https://github.com/image-rs/fdeflate/blob/main/CHANGES.md)
- [Commits](https://github.com/image-rs/fdeflate/compare/v0.3.5...v0.3.6)

Updates `minicov` from 0.3.5 to 0.3.6
- [Changelog](https://github.com/Amanieu/minicov/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/minicov/compare/v0.3.5...v0.3.6)

Updates `pin-project` from 1.1.6 to 1.1.7
- [Release notes](https://github.com/taiki-e/pin-project/releases)
- [Changelog](https://github.com/taiki-e/pin-project/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project/compare/v1.1.6...v1.1.7)

Updates `pin-project-internal` from 1.1.6 to 1.1.7
- [Release notes](https://github.com/taiki-e/pin-project/releases)
- [Changelog](https://github.com/taiki-e/pin-project/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project/compare/v1.1.6...v1.1.7)

Updates `pin-project-lite` from 0.2.14 to 0.2.15
- [Release notes](https://github.com/taiki-e/pin-project-lite/releases)
- [Changelog](https://github.com/taiki-e/pin-project-lite/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project-lite/compare/v0.2.14...v0.2.15)

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

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

Updates `rustix` from 0.38.37 to 0.38.38
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.37...v0.38.38)

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

Updates `thiserror-impl` from 1.0.64 to 1.0.65
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.64...1.0.65)

Updates `wayland-client` from 0.31.6 to 0.31.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-cursor` from 0.31.6 to 0.31.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)

---
updated-dependencies:
- dependency-name: anyhow
  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: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: anstream
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: anstyle
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: anstyle-parse
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: anstyle-query
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: anstyle-wincon
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytes
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: colorchoice
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: fdeflate
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: minicov
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: pin-project
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: pin-project-internal
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: pin-project-lite
  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: regex
  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: thiserror-impl
  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
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-29 08:25:41 +01:00
atlv
64a61ee5c6
refactor texture format to scalar conversion (#6451)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-10-23 20:06:40 +00:00
Erich Gubler
a8c9356023 docs(naga): docs. link for language_extension mod. 2024-10-23 11:20:17 -04:00
Erich Gubler
77a757ba9e diag(naga): add def. article and noun qual. to DirectiveNotYetImplemented 2024-10-23 11:20:17 -04:00
Erich Gubler
fc0a488246 docs(naga): use hyphenated "enable-extension" noun like spec. 2024-10-23 11:20:17 -04:00
Erich Gubler
64884d1eba diag(naga): add def. article to EnableExtensionNotYetImplemented 2024-10-23 11:20:17 -04:00
Erich Gubler
18f33b0474 feat: implement requires directives 2024-10-23 11:01:46 -04:00
Erich Gubler
bdd923d3a7 refactor: narrow {,Unimplemented}DirectiveKind to pub(crate) 2024-10-23 10:59:29 -04:00
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
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
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
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
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
Jasper St. Pierre
1b2ef8612d
naga: Add support for textureQueryLevels to GLSL parser (#6415) 2024-10-18 10:07:58 +02:00
Xiaopeng Li
74ef445bca
ADD metal namespace for uint4 (#6417) 2024-10-17 11:45:29 +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
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
d22aa2eb55 chore: format TOML files with taplo 0.9.3 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