Commit Graph

2170 Commits

Author SHA1 Message Date
Chip Davis
7eecf5a46b MSL: Support SPV_KHR_multiview.
This is needed to support `VK_KHR_multiview`, which is in turn needed
for Vulkan 1.1 support. Unfortunately, Metal provides no native support
for this, and Apple is once again less than forthcoming, so we have to
implement it all ourselves.

Tessellation and geometry shaders are deliberately unsupported for now.
The problem is that the current implementation encodes the `ViewIndex`
as part of the `InstanceIndex`, which in the SPIR-V environment at least
only exists in the vertex shader. So we need to work out a way to pass
the view index along to the later stages.

This implementation runs vertex shaders for all views up to the highest
bit set in the view mask, even those whose bits are clear. The fragments
for the inactive views are then discarded. Avoiding this is difficult:
calculating the view indices becomes far more complicated if we can only
run for those views which are set in the mask.
2019-06-29 09:43:55 -05:00
Hans-Kristian Arntzen
8ee8e60f70
Merge pull request #1048 from KhronosGroup/fix-1047
Deal with scalar input values for distance/length/normalize.
2019-06-28 14:18:25 +02:00
Hans-Kristian Arntzen
ff87419607 Deal with scalar input values for distance/length/normalize.
HLSL and MSL don't support it, so fall back to simpler intrinsics.
2019-06-28 11:20:14 +02:00
Hans-Kristian Arntzen
d1bdb6d491
Merge pull request #1046 from KhronosGroup/texture-fp16-coord
MSL: Fix sampling with FP16 coordinates.
2019-06-27 15:22:57 +02:00
Hans-Kristian Arntzen
964ec44822
Merge pull request #1045 from KhronosGroup/c-api-get-declared-struct-member-size
Add C API support for get_declared_struct_member_size
2019-06-27 15:12:13 +02:00
Hans-Kristian Arntzen
1543bdaf7b Run format_all.sh. 2019-06-27 15:10:59 +02:00
Hans-Kristian Arntzen
581ed0fd59 HLSL: Does not support case-fallthrough.
Disable any fallthrough on HLSL. Risky business if fallthrough blocks
had a barrier(), but can't do anything about that ...
2019-06-27 15:10:17 +02:00
Hans-Kristian Arntzen
c76b99b711 Handle more cases with FP16 and texture sampling. 2019-06-27 15:04:22 +02:00
Hans-Kristian Arntzen
656d129c00 Add C API for get_declared_struct_member_size. 2019-06-26 19:12:32 +02:00
Hans-Kristian Arntzen
45805857e5 MSL: De-virtualize get_declared_struct_member_size.
It does not make sense to use a virtual call in the Compiler base class
here. Make it clearer by renaming the MSL-specific version to _msl.
2019-06-26 19:11:38 +02:00
Hans-Kristian Arntzen
02b2a1015d MSL: Fix minor XCode /analyze warning.
Written variable, but never read.
2019-06-26 16:10:58 +02:00
Hans-Kristian Arntzen
8f6939cb0d
Merge pull request #1041 from KhronosGroup/fix-1011
MSL: Add support for SubgroupSize / SubgroupInvocationID in fragment.
2019-06-26 15:01:13 +02:00
Hans-Kristian Arntzen
4bbf343a7f
Merge pull request #1043 from KhronosGroup/fix-1042
Fix declaration of loop variables with a Phi helper copy.
2019-06-25 12:08:41 +02:00
Hans-Kristian Arntzen
bcef66fbf3 Fix declaration of loop variables with a Phi helper copy.
Certain Phi variables need to maintain a temporary copy, but we forgot
to declare them when the master variable is a loop variable itself.
2019-06-25 10:45:15 +02:00
Hans-Kristian Arntzen
845628cd4e
Merge pull request #1040 from KhronosGroup/fix-1037
MSL: Support custom bindings for argument buffer itself.
2019-06-24 16:52:41 +02:00
Hans-Kristian Arntzen
ab3798fd91 MSL: Add support for SubgroupSize / SubgroupInvocationID in fragment. 2019-06-24 12:31:54 +02:00
Hans-Kristian Arntzen
048f2380f3 MSL: Support custom bindings for argument buffer itself. 2019-06-24 11:10:20 +02:00
Hans-Kristian Arntzen
9c57364f18
Merge pull request #1039 from KhronosGroup/fix-1038
Workaround GCC 9 bug.
2019-06-24 11:10:12 +02:00
Hans-Kristian Arntzen
7557ff5567 Workaround GCC 9 bug. 2019-06-24 10:17:25 +02:00
Hans-Kristian Arntzen
b4e0163749 Run format_all.sh. 2019-06-21 16:02:22 +02:00
Hans-Kristian Arntzen
2b11b331d6
Merge pull request #1036 from KhronosGroup/msl-auto-binding
MSL: Rewrite how resources are automatically assigned bindings.
2019-06-21 15:58:50 +02:00
Hans-Kristian Arntzen
5dcfa1c639 MSL: Actually return the autobinding value in C API. 2019-06-21 15:58:04 +02:00
Hans-Kristian Arntzen
39f23cd058
Merge pull request #1034 from KhronosGroup/fix-1033
Deal with OpSwitch case fallthrough
2019-06-21 15:55:33 +02:00
Hans-Kristian Arntzen
bcec5cb370 Old MSVC does not like +[] constructs. 2019-06-21 14:59:51 +02:00
Hans-Kristian Arntzen
c365cc1b43 Deal with OpPhi and case fallthrough.
This is quite complex since we cannot flush Phi inside the case labels,
we have to do it outside by emitting a lot of manual branches ourselves.

This should be extremely rare, but we need to handle this case.
2019-06-21 13:38:23 +02:00
Hans-Kristian Arntzen
3a4a9acac9 MSL: Add C API for querying automatic resource bindings. 2019-06-21 13:19:59 +02:00
Hans-Kristian Arntzen
e2c95bdcbc MSL: Rewrite how resource indices are fallback-assigned.
We used to use the Binding decoration for this, but this method is
hopelessly broken. If no explicit MSL resource remapping exists, we
remap automatically in a manner which should always "just work".
2019-06-21 12:54:08 +02:00
Hans-Kristian Arntzen
22e3beaab9 Deal with switch block fallthrough more correctly ... 2019-06-20 12:14:19 +02:00
Hans-Kristian Arntzen
bc3bf47446 Rewrite how switch block case labels are emitted. 2019-06-20 11:57:05 +02:00
Hans-Kristian Arntzen
a1f7c8dc8e
Merge pull request #1031 from KhronosGroup/fix-1009
MSL: Support 64-bit integers.
2019-06-19 15:29:27 +02:00
Hans-Kristian Arntzen
7fdb418f18
Merge pull request #1028 from KhronosGroup/fix-1010
MSL: Support barycentrics and PrimitiveID in fragment shaders
2019-06-19 15:29:14 +02:00
Hans-Kristian Arntzen
4c20c941f0
Merge pull request #1025 from KhronosGroup/fix-1013
MSL: Support OpImageQueryLod.
2019-06-19 14:07:39 +02:00
Hans-Kristian Arntzen
4daeb1ca55
Merge pull request #1023 from KhronosGroup/fix-1012
MSL: Support MinLod operand.
2019-06-19 14:07:26 +02:00
Hans-Kristian Arntzen
a6798d06a2 MSL: Error out on int64_t/uint64_t buffer members.
Not supported for whatever reason.
2019-06-19 10:14:46 +02:00
Hans-Kristian Arntzen
a6b71ae999 MSL: Support 64-bit integers. 2019-06-19 09:55:00 +02:00
Hans-Kristian Arntzen
2e1cee5e1e MSL: Support PrimitiveID in fragment and barycentrics. 2019-06-19 09:52:35 +02:00
Hans-Kristian Arntzen
707312b83a GLSL: Support NV barycentrics. 2019-06-19 09:52:35 +02:00
Hans-Kristian Arntzen
0671b3c35b MSL: Support OpImageQueryLod.
Correctness is a bit unclear at the moment. The spec document for 2.2 is
not updated for query-lod, but this is the best we can do anyways.
2019-06-19 09:51:56 +02:00
Hans-Kristian Arntzen
f171d82590 MSL: Support MinLod operand. 2019-06-19 09:43:03 +02:00
Hans-Kristian Arntzen
05ea055096
Merge pull request #1032 from KhronosGroup/test-script-workaround
Make sure args.msl22 is set in test_shaders.py.
2019-06-18 19:59:00 +02:00
Hans-Kristian Arntzen
856a8d200e Make sure args.msl22 is set in test_shaders.py.
Works locally, but apparently not on Travis?
2019-06-18 12:22:46 +02:00
Hans-Kristian Arntzen
e9ec5ce7b1
Merge pull request #1030 from KhronosGroup/msl-2.2-invalid-test
MSL: Fix path check in test_shaders.py.
2019-06-18 10:38:35 +02:00
Hans-Kristian Arntzen
33fc2ad8cc MSL: Fix path check in test_shaders.py. 2019-06-18 10:36:10 +02:00
Hans-Kristian Arntzen
146dc453bc
Merge pull request #1029 from KhronosGroup/msl-2.2-validation-fix
Prepare for MSL 2.2 testing
2019-06-17 19:06:02 +02:00
Hans-Kristian Arntzen
be1e27a6e5 MSL: Conditionally validate MSL 2.2 shaders.
Travis CI Xcode image does not support MSL 2.2 yet (beta), so just do
local validation for now.
2019-06-17 16:07:07 +02:00
Hans-Kristian Arntzen
026a167549 MSL: New SDK errors out on cull distance.
Not supported, so just ignore this test for now, it should not have
compiled in the first place.
2019-06-14 12:12:40 +02:00
Hans-Kristian Arntzen
4104e36300
Merge pull request #1027 from KhronosGroup/fix-1026
MSL: Fix regression with Private parameter declaration.
2019-06-13 13:45:01 +02:00
Hans-Kristian Arntzen
d81bfc5b58 MSL: Fix regression with Private parameter declaration.
If we compile multiple times due to forced_recompile, we had
deferred_declaration = true while emitting function prototypes which
broke an assumption. Fix this by clearing out stale state before leaving
a function.
2019-06-13 10:36:21 +02:00
Hans-Kristian Arntzen
95053ea4bc
Merge pull request #1024 from KhronosGroup/fix-1016
GLSL/MSL: Support stencil export
2019-06-12 12:48:10 +02:00
Hans-Kristian Arntzen
00a8539d1d
Merge pull request #1022 from KhronosGroup/fix-1017
MSL: Support Invariant qualifier on position.
2019-06-12 11:35:08 +02:00