diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-04-08 12:47:35 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-04-19 13:10:49 +0300 |
commit | 46c48ee6b5d07d25b2ca54e0eebfc2fd3fd15a30 (patch) | |
tree | ae30c9e59b711496d6b5e3f520bb27941ca7fcd3 /shaders-msl | |
parent | 425e968720cfa1c2ec99e3bb5f4d3bef3c248f3f (diff) |
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.
Diffstat (limited to 'shaders-msl')
-rw-r--r-- | shaders-msl/tesc/complex-patch-out-types.tesc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/shaders-msl/tesc/complex-patch-out-types.tesc b/shaders-msl/tesc/complex-patch-out-types.tesc new file mode 100644 index 00000000..fd56ae46 --- /dev/null +++ b/shaders-msl/tesc/complex-patch-out-types.tesc @@ -0,0 +1,55 @@ +#version 450 +layout(vertices = 4) out; + +struct Meep +{ + float a; + float b; +}; + +layout(location = 0) patch out float a[2]; +layout(location = 2) patch out float b; +layout(location = 3) patch out mat2 m; +layout(location = 5) patch out Meep meep; +layout(location = 7) patch out Meep meeps[2]; + +layout(location = 11) patch out Block +{ + float a[2]; + float b; + mat2 m; + Meep meep; + Meep meeps[2]; +} B; + +void write_in_func() +{ + gl_out[gl_InvocationID].gl_Position = vec4(1.0); + + a[0] = 1.0; + a[1] = 2.0; + b = 3.0; + m = mat2(2.0); + meep.a = 4.0; + meep.b = 5.0; + meeps[0].a = 6.0; + meeps[0].b = 7.0; + meeps[1].a = 8.0; + meeps[1].b = 9.0; + + B.a[0] = 1.0; + B.a[1] = 2.0; + B.b = 3.0; + B.m = mat2(4.0); + B.meep.a = 4.0; + B.meep.b = 5.0; + B.meeps[0].a = 6.0; + B.meeps[0].b = 7.0; + B.meeps[1].a = 8.0; + B.meeps[1].b = 9.0; +} + +void main() +{ + write_in_func(); +} |