Commit Graph
1057 Commits
Author SHA1 Message Date
Inner Daemons fdd903e6e4 Add supported caps info to naga backends (#9068)
* Initial commit

* 3/5 done I think

* Updated naga bin to use new caps

* Made clippy shut up

* Tried to fix dota2 validation error

* HLSL list made, also formatted Cargo.toml

* Made stuff work with snapshots

* Added changelog and GLSL list

* Updated message
2026-02-23 06:44:20 -07:00
Erich Gubler 7705c84485 fix(d12): fix startup crash for shader models 6.8, 6.9 (#9083) 2026-02-21 04:37:22 +00:00
Vecvec 0bae2959fe Use all ray tracing pipeline builtins (#8998) 2026-02-19 01:56:00 -05:00
Andy LeisersonandJim Blandy c4365b9818 fix(naga): Improve validation of non-constructible types (#8873)
* fix(naga): Improve validation of non-constructible types

Fixes #4720
Fixes the test cases in #7393, but not the issue itself

* Zero-constructing texture_2d is no longer caught by front end.

* Define `TypeInner::is_constructible`; use it in `front::wgsl`.

Add a new method `TypeInner::is_constructible`, that determines
whether WGSL considers a type [constructible]. Use this to generate
errors in the WGSL front end. Assert in validation that it matches the
judgment of `Validator::validate_type`.

[constructible]: https://gpuweb.github.io/gpuweb/wgsl/#constructible-types

---------

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2026-02-18 11:08:53 -08:00
Inner Daemons c0fbf119a7 Forbid unsafe code in naga (#9074) 2026-02-18 08:07:24 -07:00
Vecvec 157cf36844 [wgsl-out] Ray tracing pipelines (#8970)
* wgsl-out rt pipelines

* Format.

* Enable the ray tracing pipeline extension.

* Add more checks for ray tracing pipelines.

* Changelog.

* Remove ir target.
2026-02-15 15:42:08 -05:00
Inner Daemons 6bca1014b2 Various SPIR-V fixes for mesh shaders (#8756)
* Initial commit adding miscellaneous changes from msl-write and hlsl-write

* Same as previous commit

* Fixed divergence issue

* Removed some unnecessary barriers

* Zero init workgroup memory

* Added limits validation

* Added changelog

* Handled overflow, removed todo

* Lets see if this fixes llvmpipe

* Also this commit fixes llvmpipe maybe

* Unfortunate but not too unexpected at this point

* Updated feature to say to use ShaderRuntimeChecks::unchecked()

* Updated snapshots and took some changes from the hlsl writer

* Snapshots

* 2 quick tweaks

* Updated framework with suggestions by Connor in #8752

* Moved the task runtime limits into naga::back

* Fixed soem stuff

* Fixed checks: >= into >

* Cant believe I forgot this

* Removed code using u64 to check stuff

* Removed thing with limiting it to 2<<21

* Some more work

* Fixed compiles

* Added new field to spv options

* Updated some stuff to pass around the task runtime limits in more ways

* New PR started

* Did another quick fix

* Another quick fix

* Added changelog entry

* Added some explanation docs

* Fixed a warning

* Fixed shader

* Fixed some things & added docs

* Reverted dxc thing

* Fixed thing

* Refactored to TaskDispatchLimits

* Fixed compile error
2026-02-12 14:47:42 -05:00
Inner Daemons 7609ed99e5 Add draw_id builtin (#8883) 2026-02-11 20:47:29 +00:00
Inner Daemons 702c4ef4da [wgsl] gate primitive_index built-in behind its extension & [glsl-out] require extensions for gl_PrimitiveID if needed (#8879) 2026-02-10 12:40:41 +01:00
Connor Fitzgerald 04746e747e Implement 3 part MSRV policy (#8999) 2026-02-08 17:04:36 -05:00
Andy Leiserson 6e16e04a44 fix(naga): Detect overflowing const shift amounts at compile time 2026-02-03 12:59:48 +01:00
Andy Leiserson afbb31eb1a fix(naga): Disallow const shifts of scalar by vector or vice-versa 2026-02-03 12:59:48 +01:00
Andy Leiserson dbab82fe42 chore(naga): Downgrade some log messages to debug 2026-02-03 12:59:48 +01:00
Andy Leiserson 28bc72f5bc fix(naga): Validate swizzles in lowering (#8949) 2026-02-03 01:38:28 +00:00
Teodor Tanasoaia a54dec07eb [wgsl-in] Avoid looking up newly introduced parameter names while parsing function parameters and its return type. (#8980) 2026-02-02 06:15:05 -07:00
Mads Marquart b9c09622ce fix(naga): Fix macOS 10.12 nested initializers
The Metal 2.0 compiler (shipped with macOS 10.13 and Xcode 9.0) has
allowed flattening aggregate initializers, but when running on macOS
10.12, we still use the old compiler, so to support that, we need to use
nested initializer lists.
2026-02-01 22:37:52 -08:00
Andy Leiserson 2c9e77a19d clippy: Adjust large-error-threshold and remove waivers (#8974) 2026-01-30 22:37:24 -05:00
Andy Leiserson 6b108091cc test(naga): Change test span generator to a struct (#8968) 2026-01-30 10:11:07 -05:00
Andy Leiserson c6bf076d78 fix(naga): Reject unsupported enable extensions (#8913)
Previously we required that the enable extension be declared and that
the capability be present if the functionality was used, but allowed the
extension to be declared if the functionality was not used.
2026-01-30 10:08:04 -05:00
Andy Leiserson a24965f8b7 fix(naga): Coerce matrix initializers to concrete floats (#8817) 2026-01-29 18:00:26 -08:00
Andy LeisersonandJim Blandy 70a7f83ea8 naga: Enforce @must_use for built-in functions (#8713)
---------

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2026-01-29 15:03:29 -08:00
Vecvec 8a37e0f56a [wgsl in and IR] naga ray tracing pipelines (#8570) 2026-01-29 14:18:56 -05:00
Andy Leiserson b512f7e36f test(naga): Tests for mesh shader extension validation (#8871) 2026-01-28 16:36:30 -05:00
Erich Gubler 59c351be6a refactor: satisfy clippy::unnecessary_unwrap
New in Rust 1.93! Reference:
[`clippy::unnecessary_unwrap`](https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_unwrap)
2026-01-28 15:42:38 -05:00
Erich Gubler 33a91d4ada refactor(spv-out): subvert-replace "recycle" in trait Recyclable to "reclaim"
This avoids `rustc` errors new to Rust 1.93. These errors are because
`Recyclable::recycle` triggers the `unstable_name_collisions` lint on
use, detecting a collision with the unstable `vec_recycle` Nightly
feature.
2026-01-28 15:42:38 -05:00
Jim Blandy 1add139b75 [naga wgsl-in] Consolidate bitcast and coopLoad handling.
In `naga::front::wgsl::lower::Lowerer::call_builtin`, consolidate the
cases for `bitcast`, `coopLoad`, and `coopLoadT` with the other
miscellaneous builtin functions.
2026-01-28 12:36:21 -08:00
Jim Blandy 7b473a7aba [naga wgsl-in] Move builtin function calls into their own fn.
Move the code for handling calls to WGSL builtin functions out of
`Lowerer::call` and into its own new function,
`Lowerer::call_builtin`, for clarity. Do template parameter list
finalization in the caller.
2026-01-28 12:36:21 -08:00
Jim Blandy 6abcc54ee1 [naga wgsl-in] In Lowerer::call, handle constructors first.
Rearrange `naga::front::wgsl::lower::Lowerer::call` to check
for construction expressions for predeclared types before checking for
any builtin function names, including those that take template
parameter lists like `bitcast` and `coopLoad`.
2026-01-28 12:36:21 -08:00
Erich Gubler b285d3f9bb Restrict several internal Naga APIs to pub(crate) (#8956) 2026-01-28 17:45:53 +01:00
Jim Blandy 66f95269b5 [naga wgsl-in]: Rename error variant field for clarity.
Rename `naga::front::wgsl::error::Error::MissingTemplateArg::arg` to
`description`, to make it a little more specific.
2026-01-28 12:00:35 +01:00
Jim Blandy 63d6c34859 [naga wgsl-in] Flatten control flow for clarity.
Adjust some methods of `TemplateListIter` to ensure that the typical
complete control flow through the function follows the outermost
nesting level.
2026-01-28 12:00:35 +01:00
Jim Blandy 81a1e8d3cf [naga wgsl-in] Don't permit template parameters after enumerants. 2026-01-28 12:00:35 +01:00
Jim Blandy 7b3c7f7da7 [naga] Simplify proc::Namer's handling of struct member names.
Rather than passing `call_impl` an `ignore_builtin_identifiers` flag
and plumbing that through from its points of use, extend
`Namer::namespace` to suspend the `builtin_identifiers` table, as it
does for `unique` already. The resulting behavior is the same.
2026-01-28 12:00:35 +01:00
Jim Blandy 85bd8b45bd [naga wgsl-in] Doc fixes. 2026-01-28 12:00:35 +01:00
Jim Blandy 71f186a032 [naga wgsl-in] Minor rearrangement to flatten control flow.
Use `if let`, `let else`, and `Option` methods to reduce nesting and
clarify success paths.
2026-01-28 12:00:35 +01:00
Jim Blandy 555bc09017 [naga wgsl-in] Use typical abbreviations in map_predeclared_type. 2026-01-28 12:00:35 +01:00
teoxoy 307f1fb697 [wgsl-in] move enumerant & var_address_space functions on ExpressionContext 2026-01-28 12:00:35 +01:00
Jim Blandy 2737e9e0ca [naga wgsl-in] Doc fixes.
- Clarify that various `foo_statement` functions on `Parser` do not
  consume the statement's final `;`.

- Various other doc fixes throughout.
2026-01-28 12:00:35 +01:00
Jim Blandy 5217dbdfa3 [naga wgsl-in] Rename TemplateListIter::scalar to scalar_ty.
The name `scalar` suggests that it returns a scalar value, and
`scalar_ty` is analogous to `ty`.
2026-01-28 12:00:35 +01:00
Jim Blandy 0c77a1f6ca [naga wgsl-in] Remove unnecessary dependencies.
Avoid adding entries to `ExpressionContext::unresolved` for
identifiers that `ExpressionContext::ident_expr` has already
processed.

At the moment, there is no way these could cause a bug: they only
occur after we've recognized a call/construction expression, and those
can never refer to function-local definitions, so the string in
question is certain to have already been added to `unresolved` by
`ExpressionContext::ident_expr`. But they're redundant, and if Naga
ever supported nested functions or local type aliases, these could end
up adding extraneous dependencies.
2026-01-28 12:00:35 +01:00
Jim Blandy ada7681067 [naga wgsl-in] Rename consume_tokens to discover_template_lists. 2026-01-28 12:00:35 +01:00
Jim Blandy 1ef660f133 [naga wgsl-in] Use Option::is_some_and where appropriate. 2026-01-28 12:00:35 +01:00
Jim Blandy c7a43a2e9f [naga wgsl-in] Rename component_or_swizzle_specifier arg.
In `naga::front::wgsl::parse::Parser::component_or_swizzle_specifier`,
since `span_start` sounds like the start of a span, rename that
argument to `expr_start`, since it is the span of the start of the
expression that ends with the component or swizzle specifier.
2026-01-28 12:00:35 +01:00
teoxoy 94cc5187dd [wgsl] pass expected token to functions that might not match any tokens
This improves errors making them more general where appropriate.
2026-01-28 12:00:35 +01:00
teoxoy ac18c06ba6 [wgsl-out] avoid shadowing built-ins 2026-01-28 12:00:35 +01:00
teoxoy 34ab7363ef adjust GLSL snapshots 2026-01-28 12:00:35 +01:00
teoxoy 563309c299 document consume_tokens 2026-01-28 12:00:35 +01:00
teoxoy 8ad20b247b add test_template_list test 2026-01-28 12:00:35 +01:00
teoxoy 2dffab15bf add shadowing_predeclared_types test 2026-01-28 12:00:35 +01:00
teoxoy 1ef831ad2c handle all type resolution in the lowerer 2026-01-28 12:00:35 +01:00