Commit Graph

1262 Commits

Author SHA1 Message Date
Dzmitry Malyshau
644fa684ba Fix quad testcase parameters 2021-08-20 16:56:32 -04:00
sigaloid
9050108a95 Fix some clippy suggestions 2021-08-20 16:42:47 -04:00
João Capucho
8d6647d369 [glsl-in] Add support for radians and degrees builtins 2021-08-20 11:59:16 -04:00
João Capucho
846ea0ec09 [glsl-in] Align child structs 2021-08-20 10:59:28 -04:00
João Capucho
0b0d2ab0f3 [glsl-in] Use power of two alignment for bad type in struct
Fixes #1243
2021-08-19 20:38:10 -04:00
João Capucho
448ea65940 [glsl-in] Add support for more builtins
Fixes #1245
2021-08-19 19:58:51 -04:00
João Capucho
0dd32219c5 [glsl-in] Cast grad sampling on shadow image into zero sampling 2021-08-19 19:24:38 -04:00
João Capucho
a741e4b86d [glsl-in] parse shared qualifier 2021-08-19 19:24:00 -04:00
Jim Blandy
2b08525ed1 [spv-out] Request Sample1D capability when texture_1d is used.
Fixes #1241.
2021-08-19 19:23:10 -04:00
João Capucho
ca405e3acf [glsl-in] Allow dynamic indexing on constant variables
Previously we always set the lhs flag when lowering to generate a
pointer so that dynamic indexing would work, this would produce an error
on constant variables since they can't be in a lhs context.

Now we introduce an enum which distinguishes not only between lhs and
rhs but also in array base, if lowering in a lhs context the base is
also lowered in a lhs context but if lowering in rhs the base is lowered
in a special array base context which bypasses the mutability check.

Fixes #1237
2021-08-19 17:37:05 -04:00
João Capucho
fc47008d0c [glsl-in] Allow expression statements to begin with ++ or --
This would otherwise cause the parser to enter an infinite loop.

Fixes #1232
2021-08-19 16:51:10 -04:00
João Capucho
f14817e8a0 [wgsl-in] Store expression position in context 2021-08-19 13:13:13 -04:00
João Capucho
02142d0980 [wgsl-in] Add support for the dereference operator 2021-08-19 13:13:13 -04:00
Connor Fitzgerald
dfcb79880f [hlsl-out] Fix pointer-to-array arguments (#1240) 2021-08-19 16:55:29 +00:00
Dzmitry Malyshau
dad4b1bb10 [hlsl-out] fix array arguments in functions 2021-08-19 10:05:57 -04:00
Jim Blandy
6ab6d6fc46 ImageLoad doc fix: Depth images can be multisampled, now. 2021-08-18 15:15:10 -04:00
Jim Blandy
cefaa396d4 [spv-out] Generating constants is not, in fact, fallible. 2021-08-18 14:40:00 -04:00
Hans Christian Schmitz
01250b85fe Fix WGSL vector splat constructor's type handling
Previously the constructor just used the type of the scalar argument
regardless of whether or not it actually matched the vector splat
constructors target type. This resulted in e.g. `vec2<f32>(0)`
erroneously getting the type of a bi-vector of Sints with width 4.

Now the splat constructor checks that the kind and width of the scalar
argument is the same as that of the target specified in the
constructor's type parameter.
2021-08-18 10:41:00 -04:00
Dzmitry Malyshau
7a45d73465 Release v0.6 version, changelog, and spirv update naga-v0.6.0 2021-08-18 00:39:25 -04:00
João Capucho
4e181d6af4 [glsl-in] Only add builtins with double arguments if needed 2021-08-17 22:22:30 -04:00
João Capucho
b05ca6e403 [glsl-in] Builtin redefinition and calls fixes 2021-08-17 22:22:30 -04:00
Dzmitry Malyshau
79d899fe4c Support num_workgroups builtin 2021-08-17 22:22:22 -04:00
Connor Fitzgerald
73be8c7454 [hlsl-out] Implicitly transpose all matrices 2021-08-17 14:05:27 -04:00
Connor Fitzgerald
91ea6e3d83 [hlsl-out] Fix reading from mat3 2021-08-17 14:05:27 -04:00
João Capucho
ba92640482 [wgsl-in] Parse function storage class 2021-08-17 13:39:31 -04:00
João Capucho
b11f094287 [wgsl-out] Write pointers types and loads 2021-08-17 13:39:31 -04:00
Dzmitry Malyshau
939e8f0a7b [msl-out] insert padding struct initialization 2021-08-17 00:23:07 -04:00
Dzmitry Malyshau
ab1e932e16 [glsl-out] use common bake prefix 2021-08-17 00:22:51 -04:00
Dzmitry Malyshau
c398102332 [msl-out]: avoid inner structure for run-time array sizes 2021-08-16 13:10:56 -04:00
Dzmitry Malyshau
ec64eaae6b [spv-in] work around storage image access 2021-08-16 12:20:40 -04:00
Dzmitry Malyshau
220081c4b2 [msl-out] pass-through workgroup storage 2021-08-16 12:20:07 -04:00
Dzmitry Malyshau
8e0295178c [spv-in] allow float16 and float64 2021-08-16 12:14:10 -04:00
Jim Blandy
4b1363e122 [spv-out] Creating SPIR-V types is not, in fact, fallible.
There's no need for functions that construct SPIR-V types to be fallible, or for
their callers to check for errors.

As a consequence of this change, there may be other functions that no longer
need to be fallible, but Rust doesn't warn and Clippy doesn't lint, so we'll
have to address them as they come up.
2021-08-16 12:02:15 -04:00
João Capucho
c6a6afdf37 [spv-in] Parse OpNoLine 2021-08-16 10:26:21 -04:00
Dzmitry Malyshau
7613798aed [wgsl-in] parse identifiers before builtin function calls 2021-08-15 23:20:04 -04:00
Kneelawk
d7af2a84b7 Move case-closing-brace writer inside cases loop 2021-08-15 22:39:23 -04:00
Dzmitry Malyshau
2dfcb7fcf0 [spv-in] treat Grad on depth textures as level 0 2021-08-15 22:25:20 -04:00
Dzmitry Malyshau
0d829d6bb0 hlsl-out: relational expressions 2021-08-15 22:22:22 -04:00
Dzmitry Malyshau
5415d8c7c4 Fix atomics in workgroup storage 2021-08-13 23:01:25 -04:00
Dzmitry Malyshau
69b70f8cc3 [hlsl-out] reorder fields when composing structs 2021-08-13 01:45:43 -04:00
Dzmitry Malyshau
27e4ba59e4 Validate that SampleLevel::Exact isn't used for comparisons 2021-08-13 01:45:43 -04:00
Dzmitry Malyshau
e59582469c [hlsl-out] basic support for pointer arguments 2021-08-13 01:45:43 -04:00
Dzmitry Malyshau
1907a92928 Fix deserialization of arenas 2021-08-12 22:51:29 -04:00
Dzmitry Malyshau
0feea58a34 [hlsl-out] re-order interface struct fields (#1189) 2021-08-12 13:08:29 -04:00
Dzmitry Malyshau
d55645ac1e Fix bitflags at 1.2 (#1190) 2021-08-12 00:57:13 -04:00
Jim Blandy
47b9f4a2e5 [spv-out] Writer::write_texture_coordinates: Fix result type. (#1188)
Some SPIR-V texture access instructions take coordinates as integers, others as
floats. The types of coordinates in Naga expressions generally match those in
SPIR-V, but Naga indices for arrayed textures are always integers, whereas
SPIR-V combines coordinates and array indices into a single vector, so indices
need to be cast to match the coordinate component type.

This commit makes `write_texture_coordinates` properly cast array indices to
match the coordinates' component type before combining them all into a single
result vector.

Fixes #1186.
2021-08-11 14:55:54 -07:00
Alex Es
fd70116668 Proof of concept for "span" feature, with WGSL & GLSL parsing augmented. (#1092)
* Proof of concept for "span" feature, with WGSL parsing augmented.

* Review:

1) add_span was actually a bad idea, make it set_span and add
set_span_if_unknown too.
2) panics on getting/setting span for invalid handles.
3) only set span for constants with a name
4) don't overwrite spans for types.

* Added spans to blocks & more expressions getting spans in frontends.

Definitely the shotgunny type of commit, but what can you do. The design
I went with made spans mandatory to specify, so I had to go and wire
them through wherever I could.

* Moved Block to a separate module, +clippy

* More spans for types in GLSL.

* Remove pointless body method.

* Make Arena interface require spans.

Another shotgun commit, oh boy...

* Fix tests.

My loathsome habit to "quickly fix things along the way" made a lot of
extra work for me here, having to fix my "fixes" for WGSL parser.

* Rustfmt + clippy.

* Fix compile-errors with span feature enabled.

* Nuked set_span* from orbit. Deleting code feels great!

* Code review - move feature flags inside functions.

* Fix build with "deserialize" feature enabled.
2021-08-11 16:04:32 -04:00
Jim Blandy
e2fc7ffd03 [spv-out]: Use OpCompositeConstruct's schmear behavior.
In `back::spv::Writer::write_texture_coordinates`, OpCompositeConstruct can
concatenate scalars and vectors, so when combining coordinates with an array
index, there is no need to extract the coordinate vector's components
individually: once the index has been converted to the appropriate component
type, it can be combined with the coordinates in a single instruction.
2021-08-11 11:22:43 -04:00
Jim Blandy
172f6bf62f [spv-out]: De-indent write_texture_coordinates with an early return.
No intended change in behavior.
2021-08-11 11:22:43 -04:00
Dzmitry Malyshau
67dd604b0c [wgsl-out] atomic load/stores, [glsl-out] revert the prefix 2021-08-10 21:48:02 -04:00