Commit Graph
678 Commits
Author SHA1 Message Date
Connor Fitzgerald bfe23d6ce1 glsl: floatBitsToUint spelling 2022-01-24 10:55:19 -05:00
Dzmitry Malyshau 1206b4cf33 msl: add invariance if supported 2022-01-24 10:55:09 -05:00
francesco-cattoglio 86282ddac4 glsl-out: Call proper memory barrier functions (#1680)
* glsl-out: Call proper memory barrier functions

* glsl-out: Change test for control flow

* Removed two unnecessary calls
2022-01-24 10:54:55 -05:00
Dzmitry Malyshau 35905fd69e msl: inject point size if needed 2022-01-20 19:58:29 -05:00
João Capucho 91bd26eb2c glsl-out: Write correct argument name when skipping samplers 2022-01-20 19:58:29 -05:00
João Capucho bd0e600e4b spv-out: use OpFRem instead of OpFMod 2022-01-11 22:52:02 -05:00
Jim Blandy f63f21acc4 [msl-out] Don't give level in texture1d accesses.
Fixes #1642.

Since 1d textures cannot have mipmaps, MSL requires that the `level` argument to
texel accesses and dimension queries be a constexpr 0. For our purposes, just
omit the level argument altogether.
2022-01-11 22:52:02 -05:00
Vinh Truong 5c3bee6959 Fix data packing functions on MSL (#1637)
* Fix data packing functions on MSL

`snorm` and `unorm` got mixed up.

* Fix bits.msl
2022-01-11 22:52:02 -05:00
Dzmitry Malyshau 845354d90b msl: fix packed vec access (#1634) 2021-12-29 10:07:08 -05:00
Dzmitry Malyshau 7fb21f7b99 msl: fix packed float support (#1630) 2021-12-29 10:07:08 -05:00
Dzmitry Malyshau 3340ab06f5 hlsl: support arrays of matrices (#1629) 2021-12-29 10:07:08 -05:00
Igor Shaposhnik b5801114a6 [glsl-out] Add stage postfix to generated global name (#1616) 2021-12-29 10:07:08 -05:00
Jay Oster 789aa16c3b Fixes for fma function (#1580)
* [hlsl-out] Write `mad` intrinsic for `fma` function

- This should be enough because we only support f32 for now.
- Adds a new test for WGSL functions, in the spirit of operators.wgsl.
- Closes #1579

* Add FMA feature to glsl backend

- I think this is right. Just iterate all known expressions in all
  functions and entry points to locate any `fma` function call.
  Should not need to walk the statement DAG.

* Transform GLSL fma function into an airthmetic expression when necessary

* Add tests for GLSL fma function tranformation

* Remove the hazard comment from the webgl test input

* Add helper method for fma function support checks

* Address review comment
2021-12-29 10:07:08 -05:00
Dzmitry Malyshau 8caa2bd87e Gather operations 2021-12-18 11:46:49 -05:00
Dzmitry Malyshau 6df9656e96 spv-out: Force wrapping of push constant structs 2021-12-16 16:21:06 -05:00
Dzmitry Malyshau 7bb886bf36 Enforce casting width better, fix IEqual/INotEqual in spv 2021-12-16 16:14:56 -05:00
João Capucho 4334f0e6a9 Support bitwise And on booleans 2021-12-15 23:53:23 -05:00
João Capucho c64d5eff50 Support bitwise Or on booleans 2021-12-15 23:53:23 -05:00
Dzmitry Malyshau 8ffd6ba929 Remove top_level property of structs 2021-12-15 09:33:33 -05:00
Jim Blandy 3867ef4f6c [msl-out] Correctly construct out-of-bounds values for all types. 2021-12-14 23:00:03 -05:00
Jim Blandy 8a2fbd360d [msl-out] Add log tracing for functions and entry points. 2021-12-14 23:00:03 -05:00
Lain-dono e200e44ede [spv-out] Fixing incorrect pack/unpack (#1587)
* [spv-out] Fixing incorrect pack/unpack

* [spv-out] Fixing incorrect pack/unpack: make tests happy

* [spv-out] Fixing incorrect pack/unpack: remove unexpected newline
2021-12-11 21:29:31 -05:00
Jim Blandy f51f468a47 [msl-out] Implement index bounds check policies for non-texture accesses. 2021-12-06 15:53:41 -05:00
Jim Blandy e8f564dc83 [spv-out] Add comment about AccessIndex on non-pointer values. 2021-12-06 15:53:41 -05:00
Jim Blandy 61e3af2989 [msl-out] Move Statement::Store handling into its own function. 2021-12-06 15:53:41 -05:00
Jim Blandy 17398e761f [msl-out] Move Expression::Load handling into its own function.
No changes in behavior.
2021-12-06 15:53:41 -05:00
Jim Blandy 840bbaffcc [msl-out] Rename put_dynamic_array_length, make it take a global. 2021-12-06 15:53:41 -05:00
Jim Blandy 89cc21ef43 [spv-out] BlockContext::write_expression_pointer doc fix. 2021-12-06 15:53:41 -05:00
Jim Blandy 6912cb3594 [spv-out] Move ExpressionPointer to back::spv::block, remove pub. 2021-12-06 15:53:41 -05:00
Dzmitry Malyshau c69f676609 glsl: reflect textures without samplers 2021-12-04 12:19:36 -05:00
Dzmitry Malyshau f4ba74544a Refactor snapshot test arguments to avoid checking for deserialize feature too often.
We can safely assume that deserialize is enabled for all output tests.
Supporting other modes of operation has low utility.

This change also adds an option to skip the explicit types for WGSL output.
2021-11-26 11:36:46 -05:00
Igor Shaposhnik 7c2fdf94c0 [wgsl-out] Add double underscores as a reserved prefix 2021-11-26 09:36:18 -05:00
Dzmitry Malyshau ddbc1c4b1f WGSL: use underscore prefix like the other backends 2021-11-25 16:23:24 -05:00
Igor Shaposhnik 2107b20561 [wgsl-in] Don't allow keywords to be used as identifiers 2021-11-24 16:34:17 -05:00
Igor Shaposhnik cb6d3fa815 [wgsl] Move backend keyword list into its own module 2021-11-24 16:34:17 -05:00
Igor Shaposhnik ae0c7355ca [wgsl] Remove IsInf and IsNan 2021-11-24 16:05:03 -05:00
Jim Blandy 7fd172515d [spv-out] Don't support arguments pointing to unsized types.
Functions with such arguments could never have been called anyway, and now they
are forbidden in validation.
2021-11-18 17:39:56 -05:00
Layl Bongers 29571cc4cf Add multiview wgsl builtin 2021-11-18 09:57:37 -05:00
Jim Blandy 6a5b33fa24 Move BoundsCheckPolicy/Policies into proc, from back. (#1537) 2021-11-17 19:15:59 -08:00
Jim Blandy 3d6cbcf8a6 Remove IndexableLength::Specializable variant.
Specializable constants are no longer permitted as array lengths, so this case
should not arise in valid code.
2021-11-16 09:12:42 -05:00
Jay Oster 66c3499df8 [spv-out] Fix scalar-times-matrix operations (#1524) 2021-11-14 19:07:38 -05:00
Jonathan Behrens 098e4af52f [spv-out] Fix word order for constants 2021-11-07 14:51:40 +00:00
Dzmitry Malyshau 28c45321e5 hlsl: respect array stride in storage buffers (#1507) 2021-11-03 22:44:46 -04:00
Igor Shaposhnik 9d2b357214 [glsl\wgsl out] Remove unnecessary clones (#1492)
* [glsl-out] Remove unnecessary clones

* [wgsl-out] Remove unnecessary clones
2021-10-28 13:54:32 -04:00
João Capucho 63dbd38edc Make default a switch case (#1477)
* Make default a switch case

Previously the default case of a switch statement was encoded as a block
in the statement but the wgsl spec defines it in such a way that the
default case ordering matters.

* [spv-out] Support for the new switch IR

* [dot-out] Use different labels for default cases
2021-10-26 13:31:54 -04:00
João Capucho c3a0d71f8b [spv-out] Write function arguments names (#1472) 2021-10-23 23:20:12 -04:00
Dzmitry Malyshau c4ab9a3956 hlsl: Fix mat3 stores (#1467) 2021-10-18 01:04:06 -04:00
Jim Blandy 528f52fba0 [msl-out] Put serde(default) on the whole struct, not on each field. (#1463)
This has no effect, but makes the code more legible.
2021-10-16 10:55:31 -04:00
Jim Blandy 62cc5fc646 [msl-out] Delete Writer::runtime_sized_buffers. (#1462)
This is just a table mapping handles to their indices, but we can just fetch the
index directly from the handle. We never iterate over its entries, but even if
we did, we could at least use a HashSet instead of a HashMap.
2021-10-15 00:44:28 -04:00
Dzmitry Malyshau ee450c1ee4 Fix float-bool casts in MSL, SPV, and HLSL backends (#1459) 2021-10-12 11:42:20 -04:00