Commit Graph

1675 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
2edee351f0 Run format_all.sh. 2019-01-30 13:42:50 +01:00
Hans-Kristian Arntzen
4e7777c443 Update to latest glslang/SPIRV-Tools.
Fix various bugs along the way.
2019-01-30 13:41:57 +01:00
Hans-Kristian Arntzen
8804152253
Merge pull request #843 from KhronosGroup/fix-826
Support initializers on StorageClassOutput.
2019-01-30 12:35:50 +01:00
Hans-Kristian Arntzen
3e09879131 Support initializers on StorageClassOutput. 2019-01-30 10:29:08 +01:00
Hans-Kristian Arntzen
a029d3faa1
Merge pull request #842 from KhronosGroup/fix-838
MSL: Use correct alignment for structs which are members of other structs.
2019-01-28 16:40:01 +01:00
Hans-Kristian Arntzen
5ff12d780b Run format_all.sh. 2019-01-28 15:20:30 +01:00
Hans-Kristian Arntzen
912fde95f1 MSL: Use correct size for structs.
Need to align the size of structs to the natural alignment.
2019-01-28 15:20:30 +01:00
Hans-Kristian Arntzen
217eb5b5f9 MSL: Add a preliminary check for bad arrays of structs.
ArrayStride can be larger than the declared struct size.
We have no obvious solution for now, but warn about it in the MSL output
for the time being.
2019-01-28 15:20:30 +01:00
Hans-Kristian Arntzen
8c632da461 MSL: Use correct alignment rule for whole structs.
Structs are aligned as you would expect in MSL (maximum member
alignment), and it is not minimum 16 bytes like in std140.

Also rename the dummy "pad" members to a reserved naming scheme.
2019-01-28 15:20:30 +01:00
Hans-Kristian Arntzen
1f124d0a81
Merge pull request #841 from KhronosGroup/fix-840
HLSL/MSL: Fix texture projection with Dref.
2019-01-28 11:37:36 +01:00
Hans-Kristian Arntzen
18a4accd2f HLSL/MSL: Fix texture projection with Dref.
We need to divide the Dref by q.
2019-01-28 10:25:13 +01:00
Hans-Kristian Arntzen
7430e78a8c
Merge pull request #836 from KhronosGroup/fix-834
MSL: Deal with resource name aliasing.
2019-01-18 17:18:59 +01:00
Hans-Kristian Arntzen
437fc87a89 MSL: Deal with resource name aliasing.
Apparently we didn't use those yet. MSL seems to be able to alias struct
types and variable types to a degree, so that's why it has escaped
testing until now.
2019-01-18 16:27:57 +01:00
Hans-Kristian Arntzen
1040cf6cc1
Merge pull request #831 from cdavis5e/force-recompile-hooks
MSL: Hoist fixup hooks in entry_point_args() out of the compile loop.
2019-01-17 19:42:05 +01:00
Chip Davis
f500d2f70c MSL: Hoist fixup hooks in entry_point_args() out of the compile loop.
Otherwise, in the event of a forced recompile, we could end up adding
them twice.
2019-01-17 10:18:38 -06:00
Hans-Kristian Arntzen
d322087d70
Merge pull request #833 from KhronosGroup/fix-829
MSL: Fix image load/store for short vectors.
2019-01-17 15:44:34 +01:00
Hans-Kristian Arntzen
3aa08f764e MSL: Fix image load/store for short vectors.
Same fixes as for GLSL.
2019-01-17 14:54:29 +01:00
Hans-Kristian Arntzen
522c4eea97
Merge pull request #832 from KhronosGroup/fix-828
MSL: Support std140 packing rules for float[] and float2[]
2019-01-17 14:30:06 +01:00
Hans-Kristian Arntzen
73d9da7070 Avoid unintentional name conflict with HLSL backend. 2019-01-17 12:21:16 +01:00
Hans-Kristian Arntzen
91519aaf00
Merge pull request #830 from cdavis5e/forced-signedness-var-ptr
MSL: Fix some types I missed when implementing variable pointers.
2019-01-17 11:54:39 +01:00
Hans-Kristian Arntzen
76bf6d0c34 Fixup some MSL comments. 2019-01-17 11:47:37 +01:00
Hans-Kristian Arntzen
432aaed737 Need to know the original packed type when unpacking loads. 2019-01-17 11:39:46 +01:00
Hans-Kristian Arntzen
40e7723051 Run format_all.sh. 2019-01-17 11:29:50 +01:00
Hans-Kristian Arntzen
f4b74f2f4f Add basic test for std140 small vector arrays. 2019-01-17 11:29:09 +01:00
Hans-Kristian Arntzen
de7e5ccd8b Refactor out packed expressions to extended decorations.
Can't safely just cast to the original enum without lots of hacks.
2019-01-17 11:28:51 +01:00
Hans-Kristian Arntzen
72377366d3 Replace custom use of DecorationCPacked with an explicit one.
Will need to use more variants of this decoration, so might as well make
it clearer what is going on with CPacked.
2019-01-17 10:36:56 +01:00
Hans-Kristian Arntzen
f4026a5618 Refactor access_chain_internal to be more readable from callsite. 2019-01-17 10:30:13 +01:00
Hans-Kristian Arntzen
15b52bee48 Deal with packing/unpacking on store.
Still a bit buggy, since we cannot deduce between float2[] and
packed_float2. Need a deeper refactor to plumb this through ...
2019-01-17 10:06:23 +01:00
Chip Davis
1d7d910765 MSL: Fix some types I missed when implementing variable pointers. 2019-01-16 16:15:57 -06:00
Hans-Kristian Arntzen
64ca1ec677 MSL: Start considering float[] and float2[] in std140 layout. 2019-01-16 16:16:39 +01:00
Hans-Kristian Arntzen
9e3a41ad00
Merge pull request #821 from cdavis5e/pass-sampled-images
MSL: Fix passing a sampled image to a function.
2019-01-15 09:05:54 +01:00
Hans-Kristian Arntzen
11b7c5975a
Merge pull request #825 from KhronosGroup/fix-819
MSL: Add option to pad fragment outputs.
2019-01-14 16:34:12 +01:00
Chip Davis
664df22d12 MSL: Fix passing a sampled image to a function.
In the past, SPIRV-Cross threw an error in this case because it couldn't
work out which swizzle from the auxiliary buffer needs to be passed.
Now, we pass the swizzle around with the texture object, like a combined
image-sampler and its associated sampler.
2019-01-14 09:29:31 -06:00
Hans-Kristian Arntzen
b8033d7525 MSL: Add option to pad fragment outputs.
If not enough components are provided in the shader,
the shader MSL compiler throws an error rather than make components
undefined. This hurts portability, so we need to add explicit padding
here.
2019-01-14 15:11:52 +01:00
Hans-Kristian Arntzen
b0f0fb7b7c
Merge pull request #824 from KhronosGroup/fix-751
Fix deadlock on Travis with --parallel.
2019-01-14 14:24:36 +01:00
Hans-Kristian Arntzen
b4faf13c86
Merge pull request #823 from KhronosGroup/fix-818
MSL: Fix case where we pass arrays to functions by value.
2019-01-14 14:24:24 +01:00
Hans-Kristian Arntzen
973b3155c4 Fix deadlock on Travis with --parallel.
We cannot throw any exception or call exit() in an async task, or Python deadlocks.
Catch any errors and propagate them to top thread.
2019-01-14 11:23:46 +01:00
Hans-Kristian Arntzen
7ee04936ac MSL: Fix case where we pass arrays to functions by value.
MSL does not support value semantics for arrays (sigh), so we need to
force constant references and deal with copies if we have a different
address space than what we end up guessing.
2019-01-14 11:00:14 +01:00
Hans-Kristian Arntzen
afb81e036b
Merge pull request #822 from cdavis5e/illegal-identifiers-msl
MSL: Add more illegal identifiers.
2019-01-14 08:57:13 +01:00
Chip Davis
c4b08bd770 MSL: Add more illegal identifiers.
Add most macros from the Metal standard library headers that aren't in
the reserved namespace (i.e. those that don't start with `_`).
2019-01-14 00:08:09 -06:00
Hans-Kristian Arntzen
0d63e89404
Change reference to AppVeyor status 2019-01-11 13:08:05 +01:00
Hans-Kristian Arntzen
6e1c3ccb72 Run format_all.sh. 2019-01-11 12:56:00 +01:00
Hans-Kristian Arntzen
81cb8b54a3
Merge pull request #816 from KhronosGroup/fix-794
HLSL: Support BaseVertex/BaseInstance offsets.
2019-01-11 12:52:50 +01:00
Hans-Kristian Arntzen
4394249b86
Merge pull request #815 from KhronosGroup/fix-811
HLSL: Support dual-source blending.
2019-01-11 12:52:26 +01:00
Hans-Kristian Arntzen
e4e53e8443
Merge pull request #813 from KhronosGroup/fix-781
Optimize SPIR-V ID traversal, make it more correct and be more robust against large ID bounds.
2019-01-11 12:52:11 +01:00
Hans-Kristian Arntzen
a2a44d944e HLSL: Support BaseVertex/BaseInstance offsets.
Opt-in, since user need to know about a cbuffer.
Conflicts a bit with the GLSL option for base instance,
since that one is enabled by default, but the HLSL one isn't (because
user needs to know about a magic cbuffer, whereas GLSL can only get
default initialized uniform).
2019-01-11 10:32:14 +01:00
Hans-Kristian Arntzen
a365ff17bd HLSL: Support dual-source blending. 2019-01-11 10:03:45 +01:00
Hans-Kristian Arntzen
2fb9aa251e Workaround bugs on MSVC.
Bug:
https://developercommunity.visualstudio.com/content/problem/303996/c-error-c2668-ambiguous-overloaded-in-lambda-with.html
2019-01-11 09:29:28 +01:00
Hans-Kristian Arntzen
b82cede208 Iterate over just types in reflection backend. 2019-01-10 14:42:17 +01:00
Hans-Kristian Arntzen
57be90321b Use hashmaps in CFG as well.
The arrays are incredibly sparse for the most part as we only need
entires per basic block.

For a small shader with ID bound of 8 million, we now have about 30x
uplift.
2019-01-10 14:35:34 +01:00