Commit Graph

2099 Commits

Author SHA1 Message Date
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
89523aec08 Use FastIndexMap for SpecialTypes::predeclared_types. 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
ae0423835d Introduce FastIndexMap type alias, and use it for NamedExpressions. 2023-09-21 21:37:32 -07:00
Jim Blandy
9105036be7 Use FastIndexSet for UniqueArena. 2023-09-21 21:37:32 -07:00
Jim Blandy
b586631efe Small cleanups to backend naming. (#2491)
Document `FunctionType` better.

Use `FunctionCtx` name key methods where appropriate in the WGSL and
HLSL backends.
2023-09-20 19:20:47 +02:00
Jim Blandy
8b267218a4 Implement module compaction.
Add a new Naga feature, `"compact"`, which adds a new function
`naga::compact::compact`, which removes unused expressions, types, and
constants from a `Module`.
2023-09-20 18:46:33 +02:00
Jim Blandy
0b7afb3943 cli: Move file output into its own function. 2023-09-20 18:46:33 +02:00
Jim Blandy
55a2ee445c cli: Gather up SPIR-V output options settings. 2023-09-20 18:46:33 +02:00
Jim Blandy
187aed8e11 cli: Put a full naga::front::spv::Options in Parameters.
This lets us gather up the code that influences SPV input.
2023-09-20 18:46:33 +02:00
Jim Blandy
23860c0e29 cli: Change --generate-debug-symbols from option to switch.
Change `--generate-debug-symbols` from an option that requires a
value, "true" or "false", to a switch, whose mere presence enables the
feature.
2023-09-20 18:46:33 +02:00
Jim Blandy
2a47a15f03 cli: Populate dot backend options in Parameters early.
This is a step towards having the output loop depend only on `params`,
rather than both `params` and `args`.
2023-09-20 18:46:33 +02: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
andriyDev
d8b7573b9e Prevent using multiple push constant variables in one entry point. (#2484) 2023-09-19 12:59:32 +02:00
Jim Blandy
df8107b788 Fix documentation comments for proc::Layouter::update. (#2478) 2023-09-15 16:10:25 +00:00
Bruce Mitchener
266634e822 clippy: Fix unnecessary_mut_passed warning. (#2476)
The `ModuleInfo` was not used mutably.
2023-09-13 16:11:10 +02: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
Bruce Mitchener
d2c29f012e Remove useless calls to into_iter(). (#2474)
The `splice()` call takes `IntoIterator`, so calling `into_iter()` is not needed.
2023-09-13 15:44:50 +02:00
Bruce Mitchener
79c5cb2d04 spv-out: Remove empty else branch. (#2473) 2023-09-13 15:44:02 +02:00
Elie Michel
0ae0446f3a [cli] Add support for .{vert,frag,comp}.glsl files (#2462) 2023-09-13 15:23:58 +02:00
Theo
1281c1156c [spv-out] Always give structs with runtime arrays a Block decoration (#2455) 2023-09-12 19:59:31 +02:00
Jim Blandy
0f36a745cf [wgsl-out] Don't include type parameter in splat expressions. (#2469)
Generate `vec4(1.0)` instead of `vec4<f32>(1.0)`, since WGSL requires
us to infer the type parameter anyway.
2023-09-12 19:34:24 +02:00
Jim Blandy
b17eaf76a3 snapshots::convert_spv: Print input name before processing. (#2467)
When `convert_spv` fails, this makes it easier to tell which file it
was trying to process.
2023-09-11 18:32:56 +02:00
Jim Blandy
cc87b8f9eb Don't warn about unused mut in tests when "validate" feature is off. (#2466) 2023-09-11 11:59:14 +02:00
Fredrik Fornwall
a0eb1f5462 [wgsl-in] Allow sign() to take int argument (#2463) 2023-09-06 09:29:35 -07:00
Fredrik Fornwall
978e6df645 Use || instead of | 2023-09-05 18:05:13 -07: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
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
1192588486 [ci] Specify -HV 2018 to dxc (#2447)
This avoids breaking the build with the latest release of dxc, which
made HLSL the default.
2023-08-29 19:59:50 +02:00
Fredrik Fornwall
6aca2e2b5e Add vim .swp files to gitignore (#2448) 2023-08-19 17:35:22 +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
daxpedda
bd74b11b4c Bump indexmap to v2 (#2426) 2023-08-11 16:28:28 +02:00
daxpedda
24afaa5cfd Properly test -Zminimal-versions (#2429)
* Properly test `-Zminimal-versions`

* Fix minimal version requirement
2023-08-11 15:32:49 +02:00
teoxoy
061d499ddb [spv-out] rename get_image_id to get_handle_id 2023-08-04 10:45:36 -04:00
teoxoy
c3e35df576 [spv-out] decorate the result of the OpLoad with NonUniform (not the access chain) when loading images/samplers (resources in the Handle address space) 2023-08-04 10:45:36 -04:00
teoxoy
e51b4afa1e clarify binding array of handles comment 2023-08-04 10:45:36 -04:00
teoxoy
f92340cd03 validate binding_array variable address space 2023-08-04 10:45:36 -04:00
Jim Blandy
543cae17a3 Bump MSRV to 1.65. 2023-08-02 09:25:31 -07:00