teoxoy
55dd0e1fbc
[wgsl-in] don't treat let declarations as const declarations
2023-10-12 13:13:26 +02:00
teoxoy
3d346977e5
avoid having constants pointing to other constants
2023-10-12 13:13:26 +02:00
teoxoy
648540999e
[wgsl-in] use ast spans for errors since they are more accurate
2023-10-12 13:13:26 +02:00
teoxoy
c33d7ee40d
add an expression constness tracker
2023-10-12 13:13:26 +02:00
Jim Blandy
aa041aafbd
Replace ConstantEvaluator's closure with optional emitter data.
...
Instead of letting the user supply an arbitrary closure for appending
expressions, instead give `ConstantEvaluator` an `Option` that holds
an `Emitter` to interrupt, and a `block` to add any new `Emit`
statements to.
2023-10-12 13:13:26 +02:00
Jim Blandy
77851ebfb6
Move front::Emitter to proc.
...
With the addition of the constant evaluator to the `proc` module, it
is now concerned with constructing expressions. Any code that
constructs expressions will generally also need to deal with `Emit`
statements, which are handled by the `Emitter` type. However,
`Emitter` is private to the `front` module. This patch moves it to
`proc` and makes it accessible to both the constant evaluator and the
front ends.
2023-10-12 13:13:26 +02:00
teoxoy
0e4ac2a98c
[glsl-in] set initializer of local variables
2023-10-12 13:13:26 +02:00
teoxoy
fe7bc01d27
[glsl-in] const eval as soon as possible
2023-10-12 13:13:26 +02:00
teoxoy
3fb4c333a7
use LocalVariable init
2023-10-12 13:13:26 +02:00
teoxoy
a730236b68
[wgsl-in] eagerly evaluate const-expressions
...
[wgsl-in] support const-expressions in attributes
allow `Splat` as an evaluated const-expression type
2023-10-12 13:13:26 +02:00
Nicolas Silva
33b75a27d9
[wgsl-in] Parse the bgra8unorm storage format ( #2550 )
2023-10-10 09:13:19 -07:00
Nicolas Silva
3c7dbc4016
Add StorageFormat::Bgra8Unorm
2023-10-09 17:04:03 +02:00
Teodor Tanasoaia
f37db5affc
[wgsl] remove outerProduct ( #2535 )
2023-10-05 19:14:52 +02:00
Teodor Tanasoaia
6668d0694c
Add Rgb10a2Uint format ( #2525 )
2023-10-03 13:36:14 +02:00
Jim Blandy
57bebbcd20
[wgsl-in] Use deterministic ordering for dependency ordering.
...
Use `FastIndexSet`, rather than `FastHashSet`, for tracking global
declarations' dependencies, so that the order in which functions are
inserted into the `Module` is not dependent on the hash function.
2023-09-21 23:18:18 -07:00
Jim Blandy
1b1ea37f15
[spv-out] Use FastIndexMap for Frontend::switch_cases.
2023-09-21 21:37:32 -07:00
Jim Blandy
6a254d904d
[wgsl-in] Use FastIndexMap for temporary named expressions table.
2023-09-21 21:37:32 -07:00
Jim Blandy
54df410b94
[wgsl-in] make RuntimeExpressionContext::local_table a shared ref. ( #2481 )
...
The `front::wgsl::lowerer::RuntimeExpressionContext::local_table`
field does not need to be a mutable reference, as expressions never
introduce new local bindings.
2023-09-20 05:12:48 +00:00
Bruce Mitchener
ae9c1f7847
clippy: Remove extra Iterator bounds. ( #2475 )
...
`Iterator` is a supertrait of `ExactSizeIterator`, so specifying `ExactSizeIterator` is enough.
2023-09-13 15:45:50 +02:00
Jim Blandy
3bd3c6ffb2
[glsl-in] Move arg_type_walker method from Frontend to Context.
2023-09-05 14:00:17 -07:00
Jim Blandy
9bcb5691a5
[glsl-in] Doc fix.
2023-09-05 14:00:17 -07:00
Jim Blandy
4daed67075
[glsl-in] Document Frontend::add_entry_point.
2023-09-05 14:00:17 -07:00
teoxoy
7c3c6a9d47
[glsl-in] move module and active body to Context
2023-09-05 14:00:17 -07:00
teoxoy
843557a48b
[glsl-in] refactor: use Context::add_expression in all places
2023-09-05 14:00:17 -07:00
Fredrik Fornwall
5329aa2bd5
[wgsl-in] Handle modf and frexp ( #2454 )
2023-09-02 08:55:35 +02:00
Fredrik Fornwall
f49314dbbd
Fix validation and glsl parsing of ldexp ( #2449 )
...
Fixes #1908 .
2023-09-01 18:44:48 +02:00
Frederik Magnus Johansen Vestre and teoxoy
0491d39232
Support dual source blending ( #2427 )
...
Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com >
2023-08-30 21:00:35 +02:00
Fredrik Fornwall
3bd2834b4f
[wgsl-in] Handle all(bool) and any(bool) ( #2445 )
...
Fixes #1911 .
2023-08-29 21:34:55 +02:00
Fredrik Fornwall
b001313947
[wgsl-in] Only splat 'scalar op vec', not '_ op vec' ( #2444 )
...
Change binary_op_splat() from splatting:
vec op scalar
_ op vec
to only splat:
vec op scalar
scalar op vec
2023-08-18 15:16:44 +02:00
Fredrik Fornwall
3da9355125
[wgsl-in] Avoid splatting all binary operator expressions ( #2440 )
...
* [wgsl-in] Avoid splatting all binary operator expressions
Fixes #2439 .
* [wgsl-in] Expand binary_op_splat function comment
2023-08-18 13:07:24 +02:00
Fredrik Fornwall
f6e99a4603
[wgsl-in] Handle repeated or missing @workgroup_size ( #2435 )
2023-08-17 13:20:10 +02:00
Fredrik Fornwall
7a19f3af90
[wgsl-in] Fail on repeated attributes ( #2428 )
...
* [wgsl-in] Fail on repeated attributes
Fixes #2425 .
* [wgsl-in] Use ParsedAttribute to keep track of parsed attributes
2023-08-13 17:52:10 +02:00
Fredrik Fornwall
30afa5bd1f
[wgsl-in] Fix error message for invalid texture{Load,Store}() on 2d_array ( #2432 )
...
Fixes https://github.com/gfx-rs/naga/issues/2431
2023-08-11 16:35:41 +02:00
Evan Mark Hopkins
5f8e4f6dea
[spv] Fix OpImageQueries to allow Uints ( #2404 )
2023-07-24 21:25:45 +02:00
Jim Blandy
e7cd4ffbaa
[wgsl-in] Document ExpressionContextType, ExpressionContext.
2023-07-17 16:26:08 -07:00
Jim Blandy
a3dff6b840
Document front::wgsl::lower::ExpressionContextType and friends.
2023-07-17 16:26:08 -07:00
teoxoy
d348d843e1
implement const-expressions (phase 1)
2023-07-17 16:26:08 -07:00
Fredrik Fornwall
dfd88ee485
[glsl-in] Support commas in structure definitions ( #2400 )
2023-07-17 16:22:25 +01:00
daxpedda
b7f4006e46
Bump bitflags to v2 ( #2358 )
2023-06-01 15:40:47 +02:00
Daniel McNab
907b7c7cda
Workgroup uniform load ( #2201 )
...
Implement the WGSL `workgroupUniformLoad` function.
2023-05-26 13:32:22 -07:00
Shaye Garg
1c17fa82d4
[wgsl-in] Error on param redefinition ( #2342 )
...
* error on param redefinition
* also fix #2312
2023-05-25 13:13:27 +02:00
Jim Blandy
201c0e2999
[spv-in] Improve documentation for SPIR-V control flow parsing. ( #2324 )
2023-05-25 13:06:21 +02:00
Ashley
ce48588d74
[front/spir-v] Obey the is_depth field of OpTypeImage ( #2341 )
...
* [front/spir-v] Obey the is_depth field of OpTypeImage
* Add changed tests
2023-05-22 09:35:58 -07:00
Eduard-Mihai Burtescu
423a069dcd
[spv-in] Convert conditional backedges to break if.
2023-05-12 13:59:08 -07:00
Teodor Tanasoaia
62b287e761
Change type of constant sized arrays to NonZeroU32 ( #2337 )
2023-05-12 14:38:50 +02:00
teoxoy
405413452d
Correct type of index and flush the emitter
2023-05-11 12:57:28 -07:00
teoxoy
d842d6688d
Introduce GlobalCtx
2023-05-11 09:52:40 -07:00
Jim Blandy
d763fb31e2
[spv-in] Generate Expression::Literal in some limited cases.
2023-05-11 07:09:53 -07:00
Jim Blandy
959c84f039
[glsl-in] Generate Expression::Literal.
2023-05-11 07:09:53 -07:00
Jim Blandy
412d5aa62e
[wgsl-in] Generate Expression::Literal.
2023-05-11 07:09:53 -07:00