Commit Graph
545 Commits
Author SHA1 Message Date
Connor Fitzgeraldandrudderbucky 411ffa7a5a Make Force Loop Bounding Optional (#6662)
* Make Force Loop Bounding Optional

Co-authored-by: rudderbucky <anandkwork7@gmail.com>

* Deprecate and Rename

---------

Co-authored-by: rudderbucky <anandkwork7@gmail.com>
2024-12-16 04:23:22 -05:00
Erich Gubler 3d3937e720 chore: remove empty and unused naga/src/front/wgsl/diagnostic_filter.rs (#6707)
Should have been removed in #6628. 😅
2024-12-12 14:53:07 +01:00
atlv 28a3e97dde Fix a couple typos (#6713) 2024-12-12 01:05:08 -05:00
Erich Gubler 727992e844 chore: satisfy clippy::unused_qualification (#6712) 2024-12-12 00:47:48 -05:00
Kent Slaney 5bec461fb5 Override-expressions for Fixed Size Arrays (#6654) 2024-12-10 15:43:22 +01:00
Schell Carl Scivally 8b93a71129 chore: [spv-in] atomics snapshot tests (#6692)
* chore: [spv-in] clean up atomic upgrade tests

* add output test files

* update changelog

* remove extraneous snapshot out files
2024-12-09 19:54:02 -08:00
Jamie Nicol 90859b4ea1 [naga wgsl-in] Attempt automatic conversion for arguments to user defined function calls (#6577)
When lowering arguments for a user-defined function call, avoid
concretizing the argument types. Instead make use of the existing
`try_automatic_conversions()` machinery to attempt to convert each
argument to the type expected by the function. This is straightforward
as user-defined functions only have a single overload.

This additionally changes an argument type in the test
parse_pointers() from `ptr<private>` to `ptr<function>`. The former is
invalid code which is indeed caught by the validator, but the test
only asserts that parsing succeeds, not validation. With this patch,
this error is now caught during parsing which caused the test to fail.
2024-12-09 16:36:17 +00:00
Schell Carl ScivallyandJim Blandy 234b6dd613 feature: [spv-front] Support for OpAtomicCompareExchange (#6590)
Add support for parsing and executing OpAtomicCompareExchange in the SPIR-V frontend.
This concludes the work to support atomics in the SPIR-V frontend,
excluding test clean-up.

Fixes #6296.
Fixes #6590.

Connections:

- [naga spv-in] Support for OpAtomicCompareExchange #6296
- [spv-in] Atomics support #4489

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2024-12-09 14:56:51 +00:00
Jim Blandy 6e5d398965 [naga spv-in] More docs for front::spv::Frontend::get_expr_handle. (#6671) 2024-12-09 06:46:22 -08:00
Jim Blandy ba1f042eb6 [naga spv-in] Let BlockContext hold a &mut Module. (#6682)
Refactor `front::spv::BlockContext` so that, rather than holding
various shared and mutable references to various fields of the
`crate::Module` being constructed, it holds just a single `&mut
Module`, and accesses its fields through that.

This should allow the SPIR-V front to use utility functions like
`Module::generate_predeclared_type` as intended.

Fixes #6679.
2024-12-09 06:36:18 -08:00
Kent Slaney b56960b8e8 Add Pipeline Overrides for workgroup_size (#6635) 2024-12-06 11:44:05 +01:00
Connor Fitzgerald c933487697 Improve Snapshot Test Configuration Deserialization (#6661) 2024-12-05 10:32:23 -06:00
Jim Blandy 26124c77ac [naga] Add naga::common::wgsl shared by WGSL front and backends. (#6628)
Create a new module, `naga::common`, to hold code that can be
shared between front and back ends for a given language.

Create a new module, `naga::common::wgsl`, and populate it with some
code that we expect to be useful by both the WGSL front and back ends,
once the back end generates diagnostic filters.

Move some WGSL front end tests into `naga::front::wgsl::tests`.
2024-12-02 15:22:22 -06:00
Jim Blandy 246ed3ee8e [naga wgsl-in] Remove support for -> void return type syntax. (#6633) 2024-12-02 12:58:59 -05:00
Jim Blandy 1ea5498038 [naga] Leave Module as the last thing in naga/src/lib.rs.
Move the definitions of `RayFlag` and `RayQueryIntersection` above the
definition of `Module`, so that `Module` remains the last definition
in `lib.rs`. This is helpful for navigation.

This commit is purely code motion, and makes no changes to
functionality.
2024-11-28 11:48:46 +01:00
Dzmitry Malyshau 314e196c90 Implement candidate intersections 2024-11-27 11:49:32 +01:00
Dzmitry Malyshau cdcba54d06 Declare ray flags in IR, parse all of them in WGSL 2024-11-27 11:49:32 +01:00
Jasper St. Pierre 7fff667c5a [glsl-in] Don't reinterpret function arguments twice in the normal case
We already lowered the function expression if it's a normal in argument; no need to do it again. This eliminates an unused variable and expression. With chained function calls, this could lead to a lot of waste.

There's still an extra unused expression in the case of an out/inout argument; ideally we'd remove these expressions, but it might be tricky.

Fixes #6602
2024-11-26 11:32:15 -08:00
Sludge a9f14c7a90 Allow 64-bit hex literals and const-evaluate unary ops (#6616)
* Allow 64-bit hex literals

* Implement const evaluation for unary 64-bit ops

* Test 64-bit hex literals

* Add changelog entry
2024-11-25 18:54:12 -08:00
Erich Gubler 3016c56db6 chore(naga): suppress irrefutable_let_patterns for EnableExtension matching in Error::as_parse_error (#6607) 2024-11-25 13:52:16 +01:00
atlv 05c9f43fa8 Fix atomic storage global use acces (#6600) 2024-11-25 12:06:12 +01:00
Erich Gubler 96c855b7ed chore: satisfy elided_named_lifetimes lint 2024-11-25 03:36:18 -05:00
Erich Gubler 3032e9a43c chore: satisfy clippy::needless_lifetimes
These new cases only fire with Rust 1.83 or newer, but we can preempt
this case with our current MSRV.
2024-11-25 03:36:18 -05:00
Jamie Nicol 00a6032eb7 [naga spv-out] Handle nested arrays when adding matrix decorations
Previously we only checked whether the outermost array's subtype was a
Matrix when determining whether to add ColMajor and MatrixStride
decorations, meaning arrays of arrays of matrices would not be
decorated.
2024-11-20 06:38:39 -08:00
Jim Blandy 0b82776947 [naga msl-out] Avoid UB by making all loops bounded.
In MSL output, avoid undefined behavior due to unbounded loops by
adding an unpredictable, never-actually-taken `break` to the bottom of
each loop body, rather than adding an unpredictable,
never-actually-taken branch over each loop.

This will probably have more of a performance impact, because it
affects each iteration of the loop, but unlike branching over the
loop, which leaves infinite loops (and thus undefined behavior) in the
output, this actually ensures that no loop presented to Metal is
unbounded, so that there is no undefined behavior present that the
optimizer could use to make unwelcome inferences.

Fixes #6528.
2024-11-18 14:10:50 -08:00
Erich Gubler e59f00399e fix(wgsl-in): include user and unknown rules in diagnostic(…) tracking 2024-11-18 17:10:07 -05:00
Erich Gubler 1fc5e4027a refactor: remove ConflictingDiagnosticRuleError::triggering_rule
Did this to decrease size of `ConflictingDiagnosticRuleError`, which
would have gotten even bigger in a subsequent commit.
2024-11-18 17:10:07 -05:00
Erich Gubler ffc2a1e9a0 diag(wgsl-in): fix plurality agreement for conflicting diagnostic rules 2024-11-18 17:10:07 -05:00
Erich Gubler f6f0e5dbc2 refactor(naga): unimpl. Copy for FilterableTriggeringRule 2024-11-18 17:10:07 -05:00
Jamie Nicol 6f528e2ebc [wgsl-in] Reject invalid texture types for textureSampleBias (#6566)
Non-sampled textures are not allowed, and neither are 1 dimensional
textures.
2024-11-18 17:37:52 +01:00
Jamie Nicol baecb5fbf1 [wgsl-in] Ensure textureSampleLevel's level argument is an integer for depth textures (#6529)
Until now we accepted a float, as is the case for non-depth textures.
This makes us compliant with the spec.

The validator is updated to expect an Sint or Uint when the ImageClass
is ImageClass::Depth. The SPIR-V frontend converts the LOD argument
from float to Sint (assuming that it is representable), likewise The
SPIR-V backend now converts the LOD from either Sint or Uint to
Float. HLSL and MSL backends require no changes as they implicitly do
that conversion. GLSL does not support non-compare LOD samples,
therefore no changes are required.
2024-11-18 12:05:04 +00:00
Jim BlandyandErich Gubler c110bf22d8 docs(diagnostic_filter): add more words to DiagnosticFilterMap
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-11-15 16:11:07 -08:00
Erich Gubler 92ca5a3850 feat(wgsl-in): parse diagnostic attrs. on fns 2024-11-15 07:44:14 -05:00
Erich Gubler ed29b2b758 fix(wgsl-in): yield conflict errors for full diagnostic(…) rule dupes in attr. pos. 2024-11-15 07:44:14 -05:00
David Peicho 3018912897 naga: Add support for GLSL signed/unsigned samplers (#6513) 2024-11-15 11:49:56 +01:00
Erich Gubler d0fd6a231c chore: satisfy unused_qualifications (again) 2024-11-14 07:56:22 -05:00
Erich Gubler 435514176e feat(wgsl-in): add unimpl. diag. for compound stmt. @diagnostic(…)s 2024-11-13 08:59:25 -05:00
Erich GublerandTeodor Tanasoaia c259f3b5a0 feat(wgsl-in): add @diagnostic(…) checks on global decls.
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2024-11-13 08:59:25 -05:00
Erich Gubler 82e7aa3d5b refactor(naga): hoist Attribute's name{,_span} bindings 2024-11-13 08:59:25 -05:00
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