Commit Graph
172 Commits
Author SHA1 Message Date
teoxoy 55c9d69ba0 [naga] fix the way we adjust constant initializers when processing overrides
This fixes 2 issues:
- we used to index `adjusted_global_expressions` with the handle index of the constant instead of its initializer
- we used to adjust the initializer multiple times if the arena contained multiple `Expression::Constant`s pointing to the same constant
2024-04-25 11:04:09 -07:00
vero 18ceb5183c [spv-out] Move request_type_capabilities outside of LocalType lookup 2024-04-25 11:17:23 +02:00
Imbris 82fa580152 [hlsl-out] Fix accesses on zero value expressions (#5587) 2024-04-24 10:40:08 +02:00
teoxoy c2e520c52c [naga] add Expression::Override to needs_pre_emit 2024-04-22 08:38:31 -07:00
teoxoy ca729cc607 Introduce HashableLiteral
The only reason `Literal` had to implement `Eq` and `Hash` was due to the SPV backend having to cache those in a `HashMap`.

The `PartialEq` impl was error prone due to the match not being exhaustive.
2024-04-18 12:26:24 -07:00
Teodor Tanasoaia d08a069573 Fix vectors being unconditionally host shareable (#5556) 2024-04-18 10:02:18 -04:00
vero 4e77762a32 Refactor MSL atomic writing (#5533) 2024-04-18 12:23:45 +02:00
vero 163ffa6d63 Refactor WGSL atomic writing (#5534) 2024-04-18 10:57:35 +02:00
ea77d5674d Subgroup Operations (#5301)
Co-authored-by: Jacob Hughes <j@distanthills.org>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: atlas dostal <rodol@rivalrebels.com>
2024-04-17 15:25:52 -04:00
vero c6efbef8a6 Make scalar_width return size in bytes (#5532) 2024-04-15 20:05:42 +02:00
teoxoy 9df68197a4 [spv-in] add support for specialization constants 2024-04-11 09:46:55 -07:00
wicast 17ef6cac90 fix(spv-out): OpSourceContinued for large source (gfx-rs#5390) 2024-04-08 11:27:18 +02:00
vero 911baf3e8c Add DirectX ShaderModel 6.1-6.7 detection (#5498) 2024-04-06 11:35:59 +02:00
Jim Blandy 2ad95b2774 [naga wgsl-in] Allow override expressions as local var initializers.
Allow `LocalVariable::init` to be an override expression.

Note that this is unrelated to WGSL compliance. The WGSL front end
already accepts any sort of expression as an initializer for
`LocalVariable`s, but initialization by an override expression was
handled in the same way as initialization by a runtime expression, via
an explicit `Store` statement.

This commit merely lets us skip the `Store` when the initializer is an
override expression, producing slightly cleaner output in some cases.
2024-04-05 18:07:41 +02:00
teoxoy 7df0aa6364 move the burden of evaluating override-expressions to users of naga's API 2024-04-05 18:07:41 +02:00
Jim Blandy ba19d8df34 [naga] Adjust RayQuery statements in override processing. 2024-04-05 18:07:41 +02:00
Jim Blandy 906ed128de [naga] Spell out members in adjust_expr. 2024-04-05 18:07:41 +02:00
Jim Blandy 8a2bc07f11 [naga] Handle comparison operands in pipeline constant evaluation.
Properly adjust `AtomicFunction::Exchange::compare` after pipeline
constant evaluation.
2024-04-05 18:07:41 +02:00
Jim Blandy 8107f80b7f [naga] Tweak comments in ConstantEvaluator::try_eval_and_append.
I found I needed a little bit more detail here.
2024-04-05 18:07:41 +02:00
Jim Blandy bb15286df2 [naga] Let filter_emits_with_block operate on a &mut Block.
This removes some clones and collects, simplifies call sites, and
isn't any more complicated to implement.
2024-04-05 18:07:41 +02:00
Jim Blandy aaf3b17623 [naga] Hoist ConstantEvaluator construction in process_function.
There's no need to build a fresh `ConstantEvaluator` for every
expression; just build it once and reuse it.
2024-04-05 18:07:41 +02:00
Jim Blandy f464598646 [naga] Simplify uses of replace in back::pipeline_constants. 2024-04-05 18:07:41 +02:00
Jim Blandy 58d1e1f745 [naga] Doc tweaks for back::pipeline_constants. 2024-04-05 18:07:41 +02:00
teoxoy ca252b9e74 allow private variables to have an override-expression initializer 2024-04-05 18:07:41 +02:00
teoxoy 3abdfde0ba evaluate override-expressions in functions 2024-04-05 18:07:41 +02:00
teoxoy fd5c4db606 refactor try_eval_and_append body 2024-04-05 18:07:41 +02:00
Jim Blandy dd315ee39a [naga] Add some documentation to process_overrides and subroutines. 2024-04-05 18:07:41 +02:00
teoxoy 4ede83929c [valid] make sure overrides are not present after evaluation 2024-04-05 18:07:41 +02:00
teoxoy f1706b994b [valid] error on non fully evaluated const-expressions 2024-04-05 18:07:41 +02:00
teoxoy e9eb703941 rename const_expressions to global_expressions 2024-04-05 18:07:41 +02:00
teoxoy fa5406fbb9 rename ExpressionConstnessTracker to ExpressionKindTracker 2024-04-05 18:07:41 +02:00
teoxoy d6ebd88f42 implement override-expression evaluation for initializers of override declarations 2024-04-05 18:07:41 +02:00
teoxoy ff332afdef [const-eval] fix evaluation of bool constuctors 2024-04-05 18:07:41 +02:00
teoxoy a946a6f0ad [const-eval] refactor logic around try_eval_and_append 2024-04-05 18:07:41 +02:00
teoxoy d7cfe16b79 validate that override ids are unique 2024-04-05 18:07:41 +02:00
teoxoy 2929ec333c [spv/msl/hlsl-out] support pipeline constant value replacements 2024-04-05 18:07:41 +02:00
teoxoy 7ce422c57a remove naga's clone feature 2024-04-05 18:07:41 +02:00
Teodor TanasoaiaandJim Blandy f949ea69c4 [wgsl-in] add support for override declarations (#4793)
Co-authored-by: Jim Blandy <jimb@red-bean.com>
2024-04-05 18:07:41 +02:00
Jim Blandy b3dfc40c9d [naga] Delete Constant::override and Override. 2024-04-05 18:07:41 +02:00
teoxoy 3bda381812 add pipeline constants plumbing 2024-04-05 18:07:41 +02:00
Erich Gubler fb305b85f6 docs: add warning about stack size for WGSL compilation 2024-04-03 15:54:43 -04:00
Erich Gubler b21a3265de fix(wgsl-in)!: limit brace recursion 2024-04-03 15:54:43 -04:00
Erich Gubler d4b673c88a refactor(wgsl-in): remove unnecessary return Ok(()) 2024-04-03 15:54:43 -04:00
Dzmitry Malyshau 3a467ad93d spv-out: Support arrayLength of a dynamically indexed bindings array 2024-04-02 19:22:34 +02:00
Dzmitry Malyshau bfe0b90740 spv-out: implement OpArrayLength on array buffer bindings 2024-04-02 19:22:34 +02:00
Christian Legnitto 1fd47b54ab Expose all items in naga::back.
This helps out-of-tree backends.

Fixes https://github.com/gfx-rs/wgpu/issues/5398.
2024-04-02 17:14:13 +02:00
Vecvec 1ead28701d Fix unused acceleration structures causing invalid SPIR-V (#5463) 2024-04-02 11:06:28 +00:00
Christian Legnitto 0f4839c466 Include the glsl global name in entrypoint arguments. (#5418) 2024-03-28 18:19:51 +01:00
Jim Blandy c613fbbeed [naga] Add some documentation for the uniformity analysis.
This is Naga's classic, over-conservative, non-standard-compliant
uniformity analysis. But it's still good to know what the heck it's
doing.
2024-03-28 17:36:58 +01:00
stefnotch 6a5418b93f Fix 5385 by updating the documentation (#5386)
* Fix 5385 by updating the documentation

* Update changelog
2024-03-13 21:30:50 -04:00