Commit Graph

3032 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
5e9c2d060e MSL: Cleanup fallback IO block emission.
Need to emit in add_variable_to_iface(). Unifies the code paths a fair
bit.
2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
e32c474911 MSL: Handle masking of TESC IO block members. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
dc54f75eec MSL: Fixup gl_PerVertex names if we're emitting masked builtins. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
40f628f49c MSL: Add test for complex control point outputs. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
46c48ee6b5 MSL: Rewrite how IO blocks are emitted in multi-patch mode.
Firstly, never flatten inputs or outputs in multi-patch mode.
The main scenario where we do need to care is Block IO.
In this case, we should only flatten the top-level member, and after
that we use access chains as normal.

Using structs in Input storage class is now possible as well. We don't
need to consider per-location fixups at all here. In Vulkan, IO structs
must match exactly. Only plain vectors can have smaller vector sizes as
a special case.
2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
425e968720 MSL: Handle flattening of patch block outputs as well.
Always propagate InterfaceMember decoration.
2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
8e2dbe0d38 MSL: Do not declare patch variables on stack. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
ff3f5bcba5 MSL: Handle masking of builtin control points. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
6ecdd64a91 MSL: Emit a masked builtin IO block if necessary. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
436b1250da MSL: Do not perform scalar fixups for control-point outputs. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
22c9b63e78 MSL: Fix argument_decl check for builtin. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
c635c35c12 MSL: Temporarily allow empty output struct. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
a59e25db18 MSL: Small refactors. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
74b2acab9b MSL: Always emit block variable for block types. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
ae7bb41ef4 MSL: Test that we can mask location writes in TESC. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
3255d6cef0 MSL: Explicitly only consider masked variables to be thread-group-like. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
ba93b6518d MSL: Fix masking of vertex block outputs. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
a393de31e6 MSL: Refactor out variable/block member masking. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
857295a9ab MSL: Add tests for masking with --for-tess. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
43b6ea2c9a MSL: Remove position mask tests. They will fail compilation. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
e7b37392bf MSL: Emit correct address space for masked arguments. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
65b5ff7ece MSL: Don't emit weird reference type for spvUnsafeArray types. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
e7824c8b6e MSL: Handle masked outputs in extract_global_variables.
Need to conditionally add gl_in or gl_out.
2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
50a6bc058a MSL: Force builtin arrays for builtin array types.
Handles argument_decl() correctly.
2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
88b54f5dab MSL: Add tests for vertex output masking. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
394c038bfd MSL: Do not consider effective storage for any composite. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
04988b89b9 MSL: Handle effective storage for masked CP outputs. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
f2b5fb3f45 MSL: Emit threadgroup storage class for masked control point outputs.
Shader can still rely on writes to threadgroup memory to be visible.
2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
ea91579a7f MSL: Do not redirect tess access chains on masked outputs. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
9c1cadd440 Add --mask-stage-output-* CLI options. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
f682e89188 MSL: Correctly emit array type for masked outputs. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
2a2d57df13 MSL: Sketch out API to aid LTO-style optimization. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
9a144bb2b9 Clean up member sorting. 2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
0997e81118 MSL: Sort builtin IO block members by builtin type.
Ensures consistent block matching.
2021-04-19 12:10:49 +02:00
Hans-Kristian Arntzen
b4aa6dacfa MSVC: Add /bigobj for debug builds. 2021-04-19 12:10:23 +02:00
Hans-Kristian Arntzen
45818c14e4
Merge pull request #1648 from billhollings/msl-pad-arg-buff-structs
MSL: Support padding Metal argument buffer entries based on argument index.
2021-04-19 10:36:02 +02:00
Bill Hollings
b3bfe22eaa MSL: Fixes to support padding Metal argument buffer entries based on argument index.
For buffers, support all MSLResourceBinding::basetype pointers, not just void*.
Rename MSLResourceBinding::base_type to basetype for consistent use in other structs.
2021-04-18 17:34:55 -04:00
Bill Hollings
daba0dfba6 MSL: Fixes to support padding Metal argument buffer entries based on argument index.
For completeness, add [[id(N)]] qualifier to padding struct members.
Run clang-format.
2021-04-17 15:20:53 -04:00
Bill Hollings
9060e5a13c MSL: Fixes to support padding Metal argument buffer entries based on argument index.
Use separate lookups for texture and sampler members when padding for SamplerImages.
Remove unreachable code following SPIRV_CROSS_THROW.
2021-04-16 15:00:59 -04:00
Bill Hollings
9866cf4496 MSL: Fixes to support padding Metal argument buffer entries based on argument index.
Add lookup from argument buffer argument index to resource binding for efficiency.
Fix error in advancing padding counts with combined image samplers.
Run clang-format.
2021-04-16 09:05:15 -04:00
Bill Hollings
6c0e11f907 Merge branch 'master' of https://github.com/billhollings/SPIRV-Cross into msl-pad-arg-buff-structs 2021-04-15 10:04:45 -04:00
Hans-Kristian Arntzen
582749ac68
Merge pull request #1650 from Dredhog/active-builtins-c-api
c: Add missing API to update and query active builtins.
2021-04-14 16:20:16 +02:00
lukas.taparauskas
edde535574 c: Remove SPVC_PUBLIC_API prefix from API implementation 2021-04-14 16:23:54 +03:00
lukas.taparauskas
215f31b33f c: Add missing API to query active builtins. 2021-04-14 15:44:00 +03:00
Bill Hollings
17dab614dc MSL: Support padding Metal argument buffer entries based on argument index.
If CompilerMSL::Options::pad_argument_buffer_resources enabled, Metal argument buffer
struct members are positionally aligned to their argument indexes by adding synthetic
padding members when needed. The types and sizes of these synthetic members are
identified in the resource_bindings vector provided through the API.

Add CompilerMSL::Options::pad_argument_buffer_resources to enable padding
Metal argument buffer structs to positionally match members to argument indexes.
Add MSLResourceBinding::base_type to identify resource type through API.
2021-04-13 19:01:20 -04:00
Hans-Kristian Arntzen
d2e1e7ba98 Fix Github CI in PRs. 2021-03-26 18:40:43 +01:00
Hans-Kristian Arntzen
28ae7b8f35
Merge pull request #1642 from mehmetoguzderin/msl-long-ulong-member
MSL: Support long ulong types in buffers in 2.3+.
2021-03-26 18:02:25 +01:00
Mehmet Oguz Derin
e2f7a753d2 Move condition to default block 2021-03-26 16:29:44 +03:00
Mehmet Oguz Derin
0a0c9db9be
MSL: Support long ulong types in buffers in 2.3+.
[Metal Shading Language Specification](https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf) states that:

> Note: As of Metal 2.3, Metal supports buffers that contain long or ulong data types.

This PR aims to support long and ulong data types in buffers for Metal 2.3+.
2021-03-26 02:41:26 +03:00
Hans-Kristian Arntzen
84d1f8aa2a
Use Github actions CI tag. 2021-03-12 15:36:03 +01:00