Commit Graph
545 Commits
Author SHA1 Message Date
Jamie Nicol b245b358f5 [naga] Don't treat Emit statements as return statements during ensure_block_returns() (#7013) 2025-01-28 10:48:40 -05:00
Jamie Nicol 34cfee6ebc [naga wgsl-in] Return error if wgsl parser recurses too deeply.
It's currently trivial to write a shader that causes the wgsl parser
to recurse too deeply and overflow the stack. This patch makes the
parser return an error when recursing too deeply, before the stack
overflows.

It makes use of a new function Parser::track_recursion(). This
increments a counter returning an error if the value is too high,
before calling the user-provided function and returning its return
value after decrementing the counter again.

Any recursively-called functions can simply be modified to call
track_recursion(), providing their previous contents in a closure as
the argument. All instances of recursion during parsing call through
either Parser::statement(), Parser::unary_expression(), or
Parser::type_decl(), so only these functions have been updated as
described in order to keep the patch as unobtrusive as possible.

A value of 256 has been chosen as the recursion limit, but can be
later tweaked if required. This avoids the stack overflow in the
testcase attached to issue #5757.
2025-01-28 15:00:26 +00:00
@brody4hire - C. Jonathan BrodyandConnor Fitzgerald df54acc05d use hashbrown in more crates (etc.) (#6938)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-27 11:50:33 -05:00
Reina_Sakiria 5386d38113 [naga spv-in] OpImageWrite allows input other than Vector4. (#6630)
* fix(naga-spv-in): Image write value type is invalid.

* fix(naga-spv-in): input vector 4 may case error

* fix(naga-spv-in): Incorrect swizzle pattern for vector size 3.
2025-01-24 16:59:58 +01:00
SamsonandErich Gubler 04aff59a14 [naga] implement pointer_composite_access WGSL language extension (#6913)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-01-23 13:29:17 -05:00
Teodor Tanasoaia a8bd1fe1ac [d3d12] bound check dynamic buffers (#6931)
To achieve this for dynamic storage buffers we changed the way we bind them. They now go in root tables and we pass the offset via a root constant.
2025-01-23 17:18:36 +00:00
Kent Slaney 3cd2e7caf0 [naga] Remove unused types and global expressions in a single pass.
In compaction, correctly identify unused types and global expressions,
rather than treating all global expressions referred to by
`PendingArraySize::Expression` array lengths as used even if the array
type itself is not.

This is tested by checking that going from expression to type and
back, along with the opposite, is correctly marked as used. It also
checks that adding an unused type using an expression gets compacted
out.

See the comments on `ModuleTracer::type_expression_tandem` for
details.

Fixes #6788.
2025-01-23 08:11:18 -08:00
Jamie Nicol 0282d61f91 [naga hlsl-out] Handle array types for function return values and calls (#6971) 2025-01-23 16:56:18 +01:00
Jim Blandy e86ed8b6c8 [naga] Document arena ordering requirements. 2025-01-22 19:33:05 -08:00
Connor Fitzgerald 436f716715 Unconditionally Generate Bindless Samplers in DX12 (#6766) 2025-01-21 14:24:03 -05:00
b626020769 [naga] parse and validate @must_use attribute (#6801)
* feat: parse and enforce `@must_use` attribute

* feat: refuse `@must_use` of void function

* generated naga/tests/out/ir

* revert extraneous changes

* fix clippy

* update repeated attribute error to trunk format

* struct members can't have `@must_use`

* review fixes

* Remove must_use from FunctionResult and revert the related changes

---------

Co-authored-by: turbocrime <turbocrime@users.noreply.github.com>
Co-authored-by: Jamie Nicol <jnicol@mozilla.com>
2025-01-20 18:09:36 +00:00
Samson 6e7d3c4b3e [naga] Explicitly use global const ctx in offset (#6945)
* Fix as_const on expr ctx

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* fixup

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-01-20 18:59:11 +01:00
Jamie Nicol 1f939e1c44 [naga msl-out] Avoid undefined behaviour due to signed integer overflow (#6959)
Signed integer overflow is undefined behaviour in MSL. However, signed
integers are defined to be two's complement. This allows us to cast
signed values to their corresponding unsigned type, perform the
arithmetic on these unsigned values (which has defined overflow
behaviour) then cast the result back to signed.

Care must be taken when emitting the isign polyfill, which uses
metal::select(). We must ensure the -1, 0, and 1 literals used as
inputs to select() have the correct width, else bitcasting the output
of select() will fail due to mismatched widths.
2025-01-20 18:11:27 +01:00
the letter Landturbocrime 0b0cb8fec9 remove unused CallError::ResultValue (#6944)
Co-authored-by: turbocrime <turbocrime@users.noreply.github.com>
2025-01-20 16:29:12 +01:00
VecvecandConnor Fitzgerald bdef8c0407 [spirv] Stop naga causing undefined behavior in rayQueryGet*Intersection (#6752)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-17 00:04:33 +00:00
Kent SlaneyandConnor Fitzgerald a32467041d fix >= in template list matching for a<b>=c (#6898)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-15 17:25:04 +00:00
atlv be95178709 64 bit image atomics (#5537) 2025-01-15 08:05:13 -05:00
sagudev a65216cabe [naga] wgsl automatic conversion for override initializers
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-01-15 11:14:17 +01:00
sagudev 4576e4d0d2 Refactor init and type handling into separate function from var
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-01-15 11:14:17 +01:00
VecvecandConnor Fitzgerald 21de7f7773 Support DXR in wgpu-hal & naga. (#6777)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-14 21:28:37 -05:00
Jim Blandy bd3e7b676e [naga] Consolidate entry point tracing code. (#6917) 2025-01-14 21:12:52 +00:00
Jim Blandy aa7bec65b9 [naga] Remove vestigial false. (#6909) 2025-01-13 23:02:47 +00:00
Erich Gubler 1963eb7c3f diag(wgsl-in): use backticks for code-like text in WGSL FE errors (#6908) 2025-01-13 22:13:40 +00:00
Erich Gubler cc741735df fix(wgsl-in): print debug repr. of unexpected tokens (#6907) 2025-01-13 16:43:41 -05:00
Teodor Tanasoaia 214396a807 [spv] output the right capability for subgroupBroadcast (#6904) 2025-01-13 14:29:04 -05:00
18471d8e78 Image atomics support (#6706)
* Image atomics support

* Address feedback

* fix merge

* Fixes

* Add a couple tests

* Update wgpu-types/src/lib.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* feedback

* feedback

* glsl

* glsl fix

* fix glsl

* fix fix

* fix fix fic

* fix?

* fix

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2025-01-13 15:37:12 +00:00
SamsonandErich Gubler dc9b2eb718 Add Instance::wgsl_language_features (#6814)
* docs(naga): clarify desc. for `LanguageExtension`

* feat(naga): expose `{,Implemented,Unimplemented}LanguageExtension`

* feat(naga): expose `ImplementedLanguageExtension` as `WgslLanguageExtension`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-Authored-By: Erich Gubler <erichdongubler@gmail.com>

* feat: add `Instance::wgsl_language_features`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-Authored-By: Erich Gubler <erichdongubler@gmail.com>

* refactor: reimpl. `ImplementedLanguageExtension::all` w/ `strum::VariantArray`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-01-10 04:02:39 +00:00
Asher Jingkong ChenandTeodor Tanasoaia 198762e5cc feat: Add 32-bit floating-point atomics (SHADER_FLOAT32_ATOMIC) (#6234)
* feat: Add 32-bit floating-point atomics

* Current supported platforms: Metal
* Platforms to support in the future: Vulkan

Related issues or PRs:

* gfx-rs/wgpu#1020

* Add changelog

* Edit changelog

* feat: Add 32-bit float atomics support for Vulkan (SPIR-V shaders)

* atomicSub for f32 in the previous commits is removed.

* Update test

* chore: doc type link

* refactor: Revise float atomics on msl and spv

* Make branches tidy
* Also revise old codes
* Ensure the implementations are supported by Metal and Vulkan backends

* refactor: Renaming flt32 atomics to float32 atomics

* chore: Add link to Vulkan feature

* fix: cargo fmt

* chore: hack comment

* Revert changelog

* Fix: Cargo advisory

* Update wgpu-hal/src/metal/adapter.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* Update naga/src/lib.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* Adjust feature flag position

---------

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2025-01-09 16:03:47 +00:00
Jim Blandy 6e2394b95e [naga] Validate override array sizes. (#6882)
When an array type `A`'s size is `PendingArraySize::Override(h)`,
verify that:

- `h` is a valid override handle,

- the override's type precedes `A` in the type arena, and

- the override's expression does not participate in a type/global
  expression cycle.

Fixes #6880.
2025-01-09 12:13:45 +00:00
Jim Blandy 6351c2da96 [naga] Forbid cycles between global expressions and types. (#6800)
* [naga] Move type handle validation into its own function.

* [naga] Forbid cycles between global expressions and types.

Update `valid::handles` to traverse `Module::types` and
`Module::global_expressions` in tandem, to ensure that the types and
expressions are acyclic.

Fixes #6793.
2025-01-08 14:24:57 -05:00
Eddie HatfieldandErich Gubler 1f67474140 Add directive keywords to error message for parsing global item (#6723)
Notify the user that they can also use `diagnostic`, `enable`, or
`requires` in this context.

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-01-08 16:24:03 +00:00
Jim Blandy eeb79f3b04 [naga wgsl-in] Document front::wgsl::parse::lexer::Lexer. (#6805) 2025-01-08 11:13:06 -05:00
Connor Fitzgerald a8a91737b2 Switch Binding Arrays on Metal to Argument Buffers (#6751) 2025-01-07 16:00:56 -05:00
Jamie Nicol 78e35c4a7e [naga wgsl-in] Disallow named component expression for matrix types
The WGSL spec only allows named component expressions when the base
type is a vector or a structure, so this patch removes support for it
for matrices. Additionally tests which used this for matrices have
been updated to use indexing expressions instead, and a test has been
added to ensure a named component expression on a matrix results in an
error.
2025-01-07 13:46:41 +01:00
Jim Blandy f6f9233295 [naga] Allow abstract scalars in modf and frexp results.
Allow `PredeclaredType::ModfResult` and `PredeclaredType::FrexpResult`
to hold any sort of scalar, not just a floating-point scalar.

This prepares Naga for implementing the `AbstractFloat` overloads for
the `modf` and `frexp` builtin functions.
2025-01-07 12:26:40 +01:00
Jamie Nicol 15095122a2 [naga] Handle bitshifts for abstract lhs operands during const evaluation (#6865) 2025-01-06 17:33:25 -05:00
Jim Blandy 4f22f8d7b6 [naga wgsl-in] Apply automatic conversions to values being assigned.
Apply automatic conversions to the right-hand sides of assignment and
compound assignment statements.

Fix `try_automatic_conversion_for_leaf_scalar` to handle arrays,
not just scalars, vectors, and matrices. Previously this was only used
for converting the right-hand sides of bit shift operators to `u32`,
and bit shift operators don't support arrays. But now we're using
`try_automatic_conversion_for_leaf_scalar` for ordinary assignments,
and you can assign arrays.

Update a test of propagating source code spans through compaction.
This test needs validation to report an error, but this commit's fix
causes the error in the test to be detected in the front end, which is
too early to exercise compaction. Use a new error that the front end
still won't notice.
2025-01-06 17:29:58 -05:00
Matthew Wong 826db5e6b6 [naga] change i32 arithmetic operations to use wrapping_ instead of checked_ (#6835) 2025-01-06 14:08:56 +01:00
dependabot[bot]andConnor Fitzgerald 7c75ac7aa2 chore(deps): bump the patch-updates group with 19 updates (#6810)
* chore(deps): bump the patch-updates group with 19 updates

Bumps the patch-updates group with 19 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.94` | `1.0.95` |
| [argh](https://github.com/google/argh) | `0.1.12` | `0.1.13` |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.20.0` | `1.21.0` |
| [env_logger](https://github.com/rust-cli/env_logger) | `0.11.5` | `0.11.6` |
| [itertools](https://github.com/rust-itertools/itertools) | `0.10.5` | `0.13.0` |
| [libc](https://github.com/rust-lang/libc) | `0.2.168` | `0.2.169` |
| [png](https://github.com/image-rs/image-png) | `0.17.15` | `0.17.16` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.133` | `1.0.134` |
| [gpu-descriptor](https://github.com/zakarumych/gpu-descriptor) | `0.3.0` | `0.3.1` |
| [syn](https://github.com/dtolnay/syn) | `2.0.90` | `2.0.91` |
| [argh_derive](https://github.com/google/argh) | `0.1.12` | `0.1.13` |
| [argh_shared](https://github.com/google/argh) | `0.1.12` | `0.1.13` |
| [bytemuck_derive](https://github.com/Lokathor/bytemuck) | `1.8.0` | `1.8.1` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.4` | `1.2.5` |
| [const_panic](https://github.com/rodrimati1992/const_panic) | `0.2.10` | `0.2.11` |
| [env_filter](https://github.com/rust-cli/env_logger) | `0.1.2` | `0.1.3` |
| [hashbrown](https://github.com/rust-lang/hashbrown) | `0.14.5` | `0.15.2` |
| [home](https://github.com/rust-lang/cargo) | `0.5.9` | `0.5.11` |
| [object](https://github.com/gimli-rs/object) | `0.36.5` | `0.36.7` |


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

Updates `argh` from 0.1.12 to 0.1.13
- [Release notes](https://github.com/google/argh/releases)
- [Commits](https://github.com/google/argh/compare/0.1.12...0.1.13)

Updates `bytemuck` from 1.20.0 to 1.21.0
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.20.0...v1.21.0)

Updates `env_logger` from 0.11.5 to 0.11.6
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.11.5...v0.11.6)

Updates `itertools` from 0.10.5 to 0.13.0
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.10.5...v0.13.0)

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

Updates `png` from 0.17.15 to 0.17.16
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image-png/compare/v0.17.15...v0.17.16)

Updates `serde_json` from 1.0.133 to 1.0.134
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.133...v1.0.134)

Updates `gpu-descriptor` from 0.3.0 to 0.3.1
- [Changelog](https://github.com/zakarumych/gpu-descriptor/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zakarumych/gpu-descriptor/commits)

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

Updates `argh_derive` from 0.1.12 to 0.1.13
- [Release notes](https://github.com/google/argh/releases)
- [Commits](https://github.com/google/argh/compare/0.1.12...0.1.13)

Updates `argh_shared` from 0.1.12 to 0.1.13
- [Release notes](https://github.com/google/argh/releases)
- [Commits](https://github.com/google/argh/compare/0.1.12...0.1.13)

Updates `bytemuck_derive` from 1.8.0 to 1.8.1
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/bytemuck_derive-v1.8.0...bytemuck_derive-v1.8.1)

Updates `cc` from 1.2.4 to 1.2.5
- [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.4...cc-v1.2.5)

Updates `const_panic` from 0.2.10 to 0.2.11
- [Release notes](https://github.com/rodrimati1992/const_panic/releases)
- [Changelog](https://github.com/rodrimati1992/const_panic/blob/main/Changelog.md)
- [Commits](https://github.com/rodrimati1992/const_panic/commits)

Updates `env_filter` from 0.1.2 to 0.1.3
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/env_filter-v0.1.2...env_filter-v0.1.3)

Updates `hashbrown` from 0.14.5 to 0.15.2
- [Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/hashbrown/commits)

Updates `home` from 0.5.9 to 0.5.11
- [Changelog](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cargo/compare/home-0.5.9...home-0.5.11)

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

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: argh
  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: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: png
  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: gpu-descriptor
  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: argh_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: argh_shared
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytemuck_derive
  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: const_panic
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: env_filter
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: hashbrown
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: home
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: object
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix Errors

* Get Fuzzed

* Unbreak

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-12-23 19:34:20 -05:00
Erich Gubler 9d9b99adb6 fix: make unpack4x{I,U}8 output exprs. composable in {hlsl,msl}-out (#6773) 2024-12-23 09:10:18 -08:00
Erich Gubler 6c9f93b7de diag(naga): clarify select built-in type mismatch messages 2024-12-20 10:34:20 -05:00
Jim Blandy 2587db1c9b [naga] In compaction, fix array lengths as part of type adjustment. (#6790)
Adjust the `Handle<Expression>` values that appear in
`TypeInner::Array` via `PendingArraySize::Expression` as part of the
normal type adjustment process in `ModuleMap::adjust_type`, rather
than cloning the type arena so we can iterate over it and call
`UniqueArena::replace`.

Fixes #6789.
2024-12-20 10:33:29 -05:00
Eddie HatfieldandErich Gubler 79280bc3d4 Detect a common syntax error case for diagnostic_directive (#6718)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-12-18 11:21:45 -05:00
Jim Blandy a0344cc932 [naga valid]: Clean up validation of Statement::ImageStore.
Ensure that the type we obtain for the `image` operand is correct:
"see through" a binding array to its element type only when `image` is
actually an `Access` or `AccessIndex` expression. (This changes the
set of programs the validator will pass, but it turns out not to
affect the set of WGSL programs that Naga will accept, since the WGSL
front end is already checking the types of the `texture` arguments to
`textureStore` function calls, in order to decide which overload
applies.)

Rename the variables to better reflect their values.
2024-12-18 08:10:50 -08:00
Jim Blandy 87d9ffed56 [naga valid]: Clean up validation of Statement::ImageStore.
Move image class validation to a more natural spot.
2024-12-18 08:10:50 -08:00
Jim Blandy 1a06279ca9 [naga valid]: Clean up validation of Statement::ImageStore.
Use `let-else` statements to keep the main flow of control at the
left. Briefly describe the conditions we're testing.
2024-12-18 08:10:50 -08:00
Schell Carl ScivallyandJim Blandy ea7556853d [naga spv-in] Support atomics in fields of global structs
Handle SPIR-V input that performs atomic operations on structs that
have more than one field. Track which fields of which struct types are
used by atomic operations on which global variables, and then give
those global variables new types in which exactly those fields have
had their `Scalar` leaf types changed to `Atomic`.

Add snapshot tests.

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2024-12-17 07:45:41 -08:00
Erich Gubler 3160f81289 fix(types): use correct cfgs for serde(rename…)d VertexFormat variants (#6765) 2024-12-16 17:37:45 -05:00
Erich Gubler 964a8d99d2 chore: satisfy clippy::unnecessary_map_or (#6710)
Started firing in Rust 1.84.
2024-12-16 17:26:12 -05:00
Christofer Nolander 21ff9686a7 Add 1-component ({s,u}{int,norm}{8,16}, float16) and unorm8x4-bgra vertex formats (#6632)
* feat: add missing 8/16-bit vertex formats (and 8-bit bgra) #6614

* add tests for 1-component vertex formats (and bgra)

* metal: unpacking function for 1-component vertex formats

* test: use proper alignment for float16 vertex format

* changelog: new vertex formats
2024-12-16 10:18:50 -05:00