Commit Graph

1984 Commits

Author SHA1 Message Date
Erich Gubler
1421a5e1ab
refactor(valid)!: remove TypeError::UnresolvedBase (#2308)
Resolves #2303.
2023-04-20 19:39:38 +02:00
Connor Fitzgerald
b99d58ea43 Update to version 0.12 2023-04-19 17:04:49 -04:00
teoxoy
b9c5cb5a78 validate vertex stage returns the position built-in 2023-04-12 10:48:18 -07:00
daxpedda
f59668ccfa
Allow array_index to be unsigned (#2298) 2023-04-07 16:01:55 +02:00
Erich Gubler
99a7773e65
fix(hlsl-out): use Interlocked<op> intrinsic for atomic integers (#2294)
We currently assume that we are using raw `RWByteAddressBuffer` methods for all atomic operations (`<pointer>.Interlocked<op>(<raw_byte_offset>, …)`), which is only true when we use `var<storage, read_write>` globals. For `var<workgroup>` globals, we need `Interlocked<op>(<pointer>, …)`, using the original expression as the first argument.

Fix this by branching on the `pointer`'s address space in `Atomic` statements, and implementing the workgroup address space case with intrinsics.

Remove atomic ops from `access`, add new `atomicOps` test.

Fixes #2284
2023-04-05 19:37:22 -07:00
Teodor Tanasoaia
1158709747
stop code coverage comments (#2283) 2023-04-05 17:54:07 +02:00
Christopher Fleetwood
7c00548075
[wgsl] Use alias instead of type for type aliases (#2299) 2023-04-04 12:35:32 +02:00
Jim Blandy
da8e911d9d
[hlsl-out]: Document storage access generation. (#2295) 2023-03-31 17:30:43 -07:00
PyryM
52043be004
[spv-out] Fix invalid spirv being generated from integer dot products (#2291)
* Fix invalid spirv generation in int dotprod

constants cannot be declared inside of a function block, so instead use `write_constant_null` to produce a correctly-declared constant 0.

* autogenerated test snapshots
2023-03-30 16:02:54 +02:00
Jim Blandy
53d62b9ede Clean up handling of RayDesc builtin type, somewhat. 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
c34eed5e47 Address Jim's review notes, use typegen module for atomic struct 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
024c197cc8 ray query: validation, better test 2023-03-22 17:23:07 -07:00
Jim Blandy
18710fee1e Expand on the documentation for ray-tracing features. 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
532d1ad510 msl: ray query support 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
22e341b039 wgsl: handle RayDesc/RayIntersection at the type decl level instead of an AST constructor 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
ab9c36441f fill up the ray query intersection struct 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
13ee4369cc clippy fixes 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
67d31b8e8c spv-out: basic ray query support 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
b856625821 Ray query expressions and special types 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
e46c53d212 Add ray query statements to the IR 2023-03-22 17:23:07 -07:00
Dzmitry Malyshau
432b4990a7 Add ray query types to the IR 2023-03-22 17:23:07 -07:00
Erich Gubler
0b87d1918a
fix(hlsl): emit constructor functions for arrays (#2281)
* test(hlsl-out): add failing case for array as ctor arg

See issue #2184.

* fix(hlsl): emit constructor functions for arrays
2023-03-20 17:21:52 +01:00
Andreas Reich
67c081bebe
[spirv-out] Fix adding illegal decorators on fragment outputs. (#2286)
* [spirv-out] Fix adding illegal decorators on fragment outputs.

Furthermore, fix allowing to add `Centroid` and `Sample` decorator to vertex inputs.
Fixes #2270

* Add test for fragment outputs

* Fix fragment-output.wgsl test using more than 8 outputs in a single shader
Breaks HLSL & MSL validation

* formatting
2023-03-20 13:43:13 +01:00
Evan Mark Hopkins
6db8da72ca
Add partial derivative builtins (#2277)
* Add partial derivative builtins

* [dot] emit derivative control

* Fix fmt

---------

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-03-17 00:15:44 +01:00
teoxoy
6fcd04ec06 run clippy on MSRV
+ tweak to get CI to run again
2023-03-16 15:51:59 +01:00
teoxoy
6b0c2a532a enable clippy::match_wildcard_for_single_variants lint 2023-03-16 15:51:59 +01:00
teoxoy
3450e795bc enable clippy::rest_pat_in_fully_bound_structs lint 2023-03-16 15:51:59 +01:00
teoxoy
bdc25dd689 fix rust 1.68 lints 2023-03-16 15:51:59 +01:00
teoxoy
4a03280e6c remove old clippy::if_same_then_else lint 2023-03-16 15:51:59 +01:00
Teodor Tanasoaia
63e91faecb
Skip gl_PerVertex unused builtins in the SPIR-V frontend (#2272)
Co-authored-by: Jim Blandy <jimb@red-bean.com>
2023-03-15 18:46:25 +01:00
Evan Mark Hopkins
7f829c6ac6
[glsl-in] Switch implicit type conversion (#2273) 2023-03-14 10:11:03 +01:00
Evan Mark Hopkins
8a72b7a8ad
Differentiate between i32 and u32 in switch (#2269)
* Differentiate between i32 and u32 in switch

* Use similar wording to other error messages

* Remove duplicate enum
2023-03-10 17:53:11 +01:00
Pâris DOUADY
a7b52b8663
enforce discard only in fragment (#2262) 2023-02-27 10:47:10 +01:00
Arman Uguray
00be08e9f8
[msl-out] Replace per_stage_map with per_entry_point_map (#2237)
The existing `per_stage_map` field of MSL backend options specifies
resource binding maps that apply to all entry points of each stage type.
It is useful to have the ability to provide a separate binding index map
for each entry point, especially when the same shader module defines
multiple entry points of the same stage kind.

This patch replaces `per_stage_map` with a new `per_entry_point_map`
option where resources are keyed by the entry-point function name.
2023-02-22 18:15:39 +01:00
Teodor Tanasoaia
9742f1616c
fix zero initialization of workgroup memory (#2259)
Use the local (not global) invocation id to decide which invocation should do the initialization, so that every workgroup gets initialized, not just the first.
2023-02-20 19:56:24 -08:00
Teodor Tanasoaia
cde457cedd
[spv-out] fix countLeadingZeros impl (#2258) 2023-02-20 20:40:26 +00:00
Mauro Gentile
810e9d26fc
Add countTrailingZeros (#2243)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-02-20 20:40:59 +01:00
Evan Mark Hopkins
60c0fc0284
[spv-out] Cache constant composites (#2257) 2023-02-20 15:24:20 +01:00
Leah
58105a06e2
[glsl/hlsl-out] Write sizes of arrays behind pointers in function arguments (#2250)
arrays can be put behind pointers in inout and out parameters in GLSL and HLSL,
whose dimensions must be specified to let array access
compile. so, we specify their dimensions.

fixes #2248
2023-02-17 00:40:21 +00:00
Evan Mark Hopkins
7422ace934
[wgsl-in] Add predeclared vector and matrix type aliases (#2251) 2023-02-16 15:49:54 -08:00
Josh Groves
f48b6bf2a7
Skip invariant for gl_FragCoord on WebGL2 (#2254) 2023-02-16 15:33:24 -08:00
Jim Blandy
dce689cf58
[glsl-in]: Document some fields of naga::front::glsl::context::Context. (#2244) 2023-02-16 23:18:13 +00:00
teoxoy
cc3a8ac737 add Capabilities::MULTISAMPLED_SHADING 2023-02-16 18:16:49 -05:00
teoxoy
964d9204bc add Capabilities::EARLY_DEPTH_TEST 2023-02-16 18:16:49 -05:00
teoxoy
df567a94eb add Capabilities::MULTIVIEW 2023-02-16 18:16:49 -05:00
Josh Groves
568d7c4c13
Require LF for snapshots (#2253) 2023-02-16 01:54:49 +01:00
Evan Mark Hopkins
1ad47f732d
Fix texture built-ins where u32 was expected (#2245)
- The Typifier was updated to expect `uint`
- Both `glsl` and `spv` frontends where updated to cast the result to `sint`.
- Both `glsl` and `spv` backends where updated to cast the result to `uint`.
- Remove cast in `msl` backend.
2023-02-13 14:13:58 +01:00
Teodor Tanasoaia
40b8f66146
Fix setup-dxc not found and make sure workflows run if their file was changed (#2247)
* fix setup-dxc not found

* run validation-windows if its workflow file was changed

* run validation-macos if its workflow file was changed

* run validation-linux if its workflow file was changed

* run lazy if its workflow file was changed
2023-02-10 13:44:57 +01:00
João Capucho
f038537e61 glsl-in: Add tests for output parameters casts 2023-02-08 11:39:09 +00:00
João Capucho
0a2e93c098 glsl-in: Perform output parameters implicit casts
Glsl defines under `Function Definitions` (Paragraph 6.1 in glsl 4.60),
the following:

> When function calls are resolved, an exact type match for all
> the arguments is sought.
> (...)
> If no exact match is found, then the implicit conversions in
> section “Implicit Conversions” will be applied to find a match.
> (...)
> Mismatched types on output parameters (out or inout) must have a
> conversion from the formal parameter type to the calling argument type.

The glsl frontend wasn't performing this implicit cast for output parameters.

This commit fixes that by using a proxy write, this
creates a spill variable with the correct type and in the call
prologue a conversion is made back to the original type and the
value is stored in the original variable.
2023-02-08 11:39:09 +00:00