Commit Graph
322 Commits
Author SHA1 Message Date
Dzmitry Malyshau d3b39d9e58 Splat expression in the IR 2021-04-14 19:26:20 -04:00
Jim Blandy 6701e2bf96 Avoid non-exhaustive matches on Expression.
Non-exhaustive matches on `Expression` make it harder to review changes that add
new enum variants, because the compiler can't tell you that you've missed a
case.

Although I believe Clippy is able to do so, I don't think we should make a
blanket rule of forbidding wildcard match arms against `Expression`. There are a
few matches that are only concerned with a handful of variants, or a single
variant. For example, variant, naga::front::spv::Parser::next_block is only
concerned with whether an expression is a constant or not. In principle, these
sites should also be checked when adding a new variant, but it seems too
burdensome to require them to list all the `Expression` variants they don't care
about. The principle should be applied only to matches that are already handling
most variants.

At the moment, there is only one such match on `Expression` in the code base,
and it's only missing a few variants, so this is quick to fix.
2021-04-14 16:11:37 -04:00
Dzmitry Malyshau 270feb3c0f [msl] map push constants to buffers 2021-04-13 01:31:57 -04:00
Dzmitry Malyshau 9cd2b04c04 [spv-out] put matrix decorations on arrays of matrices (#712) 2021-04-12 12:12:19 -04:00
Ashley 202d3a6912 Add metal constants to keywords (#709) 2021-04-11 14:36:29 -04:00
Ashley 640bfb1f26 [Metal] Make constant composites non-constexpr (#707)
* Make constant composites non-constexpr

* Update shadow test
2021-04-11 14:21:47 -04:00
Ashley 98db1dedcd Add a note about references and pointers to Expression::Load (#708)
* Add a note about references and pointers to Expression::Load

* Formatting

* Remove comma

* Clearer English
2021-04-11 14:21:02 -04:00
Ashley 3b4acc5300 [Metal] Handle length(float) and distance(float, float) (#706)
* Handle length(float x)

* Handle length(float) and distance(float, float)

* Apply suggestions

* Apply suggestions

* Move stack size range up by 1000
2021-04-11 13:01:31 -04:00
Ashley 30180c008b [Metal] Change the function argument pointer type to use & instead of * (#693)
* Take references in function calls if thats what the funciton wants

* Use references instead of pointers the function argument list
2021-04-11 12:48:22 -04:00
Ashley 9549b26a90 Add the reserved types in metal_types to metal keywords (#705) 2021-04-11 12:32:01 -04:00
Timo de Kort 5d487941b2 Start hlsl-out (#408)
* Add hlsl-out feature

* Integrate hlsl-out with snapshots

* Add snapshot
2021-04-11 11:36:26 -04:00
Ashley a8f1022b12 [Metal] Handle NaN and inf correctly in constants (#704)
* Handle NaN and inf

* Handle negative infinity
2021-04-11 11:06:23 -04:00
Ashley Ruglys 1fc88319e8 Serialize mtl EntryPointError 2021-04-09 19:57:12 -04:00
Dzmitry Malyshau 425c75eb3f [msl-out] emit packed vectors if necessary 2021-04-09 00:48:18 -04:00
Dzmitry Malyshau f3ba6e91c2 [msl-out] shorten the expression name 2021-04-09 00:48:18 -04:00
Dzmitry Malyshau 4ff5fa4568 [msl-out] add support for matrix value types 2021-04-09 00:48:18 -04:00
Dzmitry Malyshau 604e10e19b Rewrite IR to have member offsets, full structure span and alignment 2021-04-08 23:15:03 -04:00
Dzmitry Malyshau 7326ba6ddb New struct layout IR 2021-04-08 23:15:03 -04:00
Jim Blandy 5a0e3ad5ff [spv-out]: Add some local use declarations to the SPIR-V writer.
This adds `use` declarations for `spirv::Decoration` and `spirv::BuiltIn` local
to functions where those are used repeatedly.
2021-04-08 20:27:48 -04:00
Dzmitry Malyshau 6166b95b6a [msl] inline some of the constants 2021-04-08 12:36:43 -04:00
Dzmitry Malyshau 2774dcb403 [msl] inline some of the types 2021-04-08 11:10:52 -04:00
Dzmitry Malyshau f1c5e04b89 [msl] fix select() arguments 2021-04-08 11:10:52 -04:00
Dzmitry Malyshau e06451777e [msl] address review comments, rename SubOptions to PipelineOptions, add more inlined states 2021-04-07 22:49:13 -04:00
Dzmitry Malyshau 499f2e3cbe [msl] add a snapshot test for inline sampler 2021-04-07 22:49:13 -04:00
Dzmitry Malyshau 7c11759041 Re-use the MSL types in snapshot code 2021-04-07 22:49:13 -04:00
Dzmitry Malyshau 9e09c792dc [msl] write down inline samplers 2021-04-07 22:49:13 -04:00
Dzmitry Malyshau dcbedd17d0 [msl] basic infrastructure for inline samplers
Also move out "allow_point_size" into SubOptions to allow
main Options to not be cloned.
2021-04-07 22:49:13 -04:00
adamnemecek 0058ce5a7d fixed bug where metal backend would make all switch cases fallthrough 2021-04-04 18:30:04 -04:00
Dzmitry Malyshau 0369ee181e [spv-out] fix sampling from depth textures 2021-04-04 10:25:46 -04:00
Dzmitry Malyshau a9bde26785 [spv-out] fix incorrect dummy result 2021-04-04 10:25:46 -04:00
Dzmitry Malyshau 410c242daf [spv-out] add a flag to adjust the coordinate space 2021-04-03 11:27:21 -04:00
Dzmitry Malyshau 100c2f42ed [spv-out] cache access index constants 2021-04-03 11:27:21 -04:00
Dzmitry Malyshau 5673603bab [spv-out] flip position Y 2021-04-03 11:27:21 -04:00
Dzmitry Malyshau d4d9d7814f [msl-out] option to omit point size output 2021-04-02 00:19:52 -04:00
Dzmitry Malyshau cbdfbed32e [msl-out] move return value statement into a function 2021-04-01 15:45:08 -04:00
Dzmitry Malyshau 13c9356873 [msl-out] track put_block stack sizes 2021-04-01 15:45:08 -04:00
Dzmitry Malyshau f8b3c597ff [msl-out] move image size query into a separate method 2021-04-01 15:45:08 -04:00
Dzmitry Malyshau 6a5c7f10ad [msl-out] cast image load/store coordinates to unsigned 2021-04-01 10:47:28 -04:00
Dzmitry Malyshau af4d989f55 [msl-out] copy array elements one by one 2021-04-01 10:26:59 -04:00
Dzmitry Malyshau cf3a6da3ce [msl] clean up emitted expressions at the end of a block 2021-04-01 10:26:59 -04:00
Dzmitry Malyshau 7a17da195c [msl] use uint behind metal namespace only 2021-03-31 23:01:19 -04:00
Gordon-F 80a8243953 Fix Uint/Sint type conversion 2021-03-30 18:13:57 -04:00
Dzmitry Malyshau 7be524592a [msl] fix mutability of function parameters 2021-03-30 15:43:53 -04:00
Dzmitry Malyshau fc7b79ddff [msl-out] make EntryPointError cloneable 2021-03-30 10:08:36 -04:00
Dzmitry Malyshau baccfc68f5 [msl] fix constant array initialization 2021-03-30 00:38:00 -04:00
Dzmitry Malyshau 50059740f7 [msl] prefix lod options with metal namespace 2021-03-27 10:58:01 -04:00
Dzmitry Malyshau f2155d49d1 [msl] fix initialization of arrayed members, enable METAL snapshot of quad-vert 2021-03-27 10:58:01 -04:00
Dzmitry Malyshau 00f4c07609 [msl] fix Select on vectors 2021-03-26 09:56:29 -04:00
Dzmitry Malyshau a090afa3f5 [msl] write scalar constants before the types 2021-03-26 09:56:29 -04:00
Dzmitry Malyshau bf193bb535 [msl] don't put expressions in double scopes 2021-03-26 09:56:29 -04:00