Commit Graph
573 Commits
Author SHA1 Message Date
João Capucho f6e35f5b66 [glsl-in] Improved preprocessor and error handling 2021-08-09 10:51:15 -04:00
João Capucho a8a316da15 [glsl-in] API revamp
The new api allows for reuse while keeping some allocations and to
please the borrow checker in future work, it also splits the parser into
logical modules to make it easier to work on.
2021-08-09 10:51:15 -04:00
Dzmitry Malyshau 7c3cc904a0 [spv-in] fix storage buffer access decorations 2021-08-05 12:59:19 -04:00
Zicklag 300039e247 Fix Invalid Type Attribute Error Message
The message previously made reference to the now-removed `access`
attribute.
2021-08-05 10:12:23 -04:00
João Capucho 2ff7dcb417 [glsl-in] Fix mix ordering for boolean selector
The mix builtin is defined with the inverse order for it's arguments
compared to the IR when the selector is a boolean vector.
2021-08-04 12:39:36 -04:00
João Capucho a1395ddb99 [glsl-in] Fix matrix constructor with a scalar
Glsl defines that if a matrix constructor is called with only a scalar
it's result will be the matrix where the scalar is used if the row and
column are equal and everywhere else a zero
2021-08-04 12:39:36 -04:00
João Capucho 151a36352e [glsl-in] Be more conservative with vector resizes 2021-08-04 12:39:36 -04:00
João Capucho de6399a9c7 [glsl-in] Follow spec when choosing default layout 2021-08-04 12:39:36 -04:00
João Capucho 5ec129bbf0 [glsl-in] Lower the for loop init expression 2021-08-04 12:39:36 -04:00
João Capucho ec0d97d961 [glsl-in] Respect user defined interpolation 2021-08-04 12:39:36 -04:00
João Capucho a90aa9817b [glsl-in] Add support for non constant global init
Glsl allows things such as

```glsl
layout (location = 0) in vec4 a;
vec4 b = a;
```

In this case `b` depends on `a` which can't be known at compile time,
so it's necessary to add a small prologue to the entry point to
initialize it.
2021-08-04 12:07:17 -04:00
João Capucho 057dc3100d [glsl-in] Remove support for multiple entry points 2021-08-04 11:06:57 -04:00
João Capucho 6f476eeafe [glsl-in] Fix span of gvec3 in layouter 2021-08-03 13:58:25 -04:00
João Capucho c084e2cfa8 [glsl-in] Handle Pow in constant evaluation 2021-08-03 13:58:25 -04:00
João Capucho da77e1f847 [glsl-in] Accept precision in local variable 2021-08-03 13:58:25 -04:00
João Capucho bcfe1f6f28 [glsl-in] Parse some more memory qualifiers 2021-08-03 13:58:25 -04:00
João Capucho 08302b5078 [glsl-in] Fix missing implicit conversion in mix 2021-08-03 13:58:25 -04:00
João Capucho fde91c1d94 [glsl-in] Implicit splat min builtin 2021-08-03 13:58:25 -04:00
João Capucho 9742f6820a [glsl-in] Invalidate the expression in sampled_to_depth 2021-08-03 13:11:31 -04:00
João Capucho bd16bf90d0 [glsl-in] Unify depth_set and qualifiers 2021-08-03 13:11:31 -04:00
João Capucho 244d58e8ff [glsl-in] Add support for depth_ref 2021-08-03 13:11:31 -04:00
João Capucho 717063eb21 [glsl-in] Convert Sampled image to depth image 2021-08-03 13:11:31 -04:00
João Capucho 223016a418 [glsl-in] Implement textureGrad 2021-07-31 23:28:13 -04:00
João Capucho 65e915f998 [glsl-in] Implicit convert texture functions 2021-07-31 23:28:13 -04:00
João Capucho 56ce439ff5 [glsl-in] Implement layouting for composite types 2021-07-31 23:25:22 -04:00
João Capucho e0e840b22c [glsl-in] Implement std140 and std430 layouts
Structs are not yet implemented
2021-07-31 23:25:22 -04:00
Arnaud Golfouse e0efe34402 Fix typo in error message (#1150) 2021-07-29 22:57:27 -04:00
pyrotechnickandDzmitry Malyshau 2f516c0932 [wgsl] Storage buffer/texture access (#1142)
* Resurrect texture_storage_* tests
* Test parsing of `var<storage,write>`
* Default storage textures to READ
* Restore default features
* Fix glsl/hlsl/msl/spv front and back ends
* Add missing test outputs
* All-around fixes for the storage access

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-07-28 01:47:18 -04:00
João Capucho 6303af225f [glsl-in] Add implicit conversion for initializer 2021-07-27 20:16:05 -04:00
João Capucho 677e040462 [glsl-in] Long form matrix support 2021-07-27 11:35:47 -04:00
Dzmitry Malyshau 4b6846d5da hlsl: storage reads support, array length 2021-07-26 01:29:42 -04:00
Dzmitry Malyshau 20c4d2c3d1 Add MSAA depth texture type 2021-07-22 10:39:24 -04:00
initial-algebra 602368d9f0 Support builtin(primitive_index) (#1097)
* Hack in support for PrimitiveID on Vulkan

* Rename to PrimitiveIndex and add preliminary support for GLSL, HLSL and MSL

* Implement as an extra WGSL built-in

* Update extra.wgsl outputs

* Run rustfmt; fix WGSL writer

* Add rustfmt changes I forgot

* Update extra.wgsl test output for WGSL fix

* Bump macOS version to 10.15 in validate-msl to support primitive_index
2021-07-16 22:18:20 -04:00
Dzmitry Malyshau 8eef784416 WGSL: Flip true/false arguments of select() 2021-07-16 11:42:12 -04:00
Jasper St. Pierre 0995c7161e [glsl-in] Keep around extra linkage variables
WGSL will require this. Note that this still might
cause some issues with multi-entry-point GLSL
that I didn't know how to handle. That is, we will
handle unused builtin inputs but not unused
builtin outputs correctly right now. This is an existing
issue though, not a regression.

This is also provided as an option, but I feel like
the more correct approach is to never strip linkage
variables. We'll see though.
2021-07-14 17:48:54 -04:00
pyrotechnick 1d1aea243f Improve WGSL interpolation attributes (#1083)
* [wgsl-in] Map interpolate(..., center) to Sampling::Center

* [wgsl-out] Improve interpolation attributes

* [wgsl] Fix tests/in/interpolate.wgsl typo/format

* [wgsl] Snapshot WGSL artefacts

* [wgsl-out] Stack-only writing of interpolation
2021-07-13 21:57:52 -04:00
João Capucho 7532c2abaa [glsl-in] Remove wrong texture types
Glsl doesn't have depth textures what it has is combined image/samplerShadow
2021-07-07 12:59:20 -04:00
João Capucho bd339e5f60 [glsl-in] Add textureProj 2021-07-07 12:59:20 -04:00
João Capucho 3f2b754c42 [glsl-in] Fix proxy write type mismatch 2021-07-07 12:59:20 -04:00
João Capucho ba75ca6efe [glsl-in] Don't implicitly cast shifts 2021-07-07 12:59:20 -04:00
João Capucho 105a2ae5e1 [glsl-in] Check type dimensions in function calls 2021-07-07 12:59:20 -04:00
João Capucho e8bb7f2503 [glsl-in] Parse array initializers 2021-07-06 11:24:05 -04:00
João Capucho ee1004d443 [glsl-in] Use cast for implicit conversion
Previously this was a bitcast
2021-07-06 11:24:05 -04:00
João Capucho ee343b3017 [glsl-in] Implicit splat max builtin 2021-07-06 11:24:05 -04:00
João Capucho 7bced3f4e8 [glsl-in] Add support for all texture types 2021-07-06 11:24:05 -04:00
Dzmitry Malyshau 9473340c16 wgsl-in: fix auto array stride 2021-07-06 02:20:26 -04:00
Dzmitry Malyshau beabd62d96 wgsl: type inference for local variables 2021-07-06 01:26:03 -04:00
Joshua Groves 9192f7b882 wgsl-in: add more error tests 2021-07-05 02:24:18 -04:00
Joshua Groves c5805a9e10 wgsl-in: add more error tests 2021-07-04 01:00:21 -04:00
Jasper St. Pierre 7a9fb864ad [glsl-in] Add support for gl_FragCoord / gl_FragDepth
And remove the ability to read gl_Position in fragment.
2021-07-03 00:29:44 +01:00