From 557a65dbcfedf37e6c4e510eb3bc8a3340b9702c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sun, 1 Sep 2019 22:06:03 -0700 Subject: [PATCH] Updated spirv-cross. --- .../asm/comp/atomic-decrement.asm.comp | 2 +- .../asm/comp/atomic-increment.asm.comp | 2 +- .../comp/buffer-write-relative-addr.asm.comp | 2 +- .../asm/comp/buffer-write.asm.comp | 2 +- .../frag/lut-promotion-initializer.asm.frag | 57 ++++- .../frag/single-function-private-lut.asm.frag | 2 +- ...input-array-builtin-array.invalid.asm.tesc | 57 ++++- .../comp/composite-array-initialization.comp | 57 ++++- .../shaders-msl/comp/composite-construct.comp | 57 ++++- ...vocation-id-writable-ssbo-in-function.comp | 2 +- .../comp/global-invocation-id.comp | 2 +- .../opt/shaders-msl/comp/inverse.comp | 6 +- .../shaders-msl/comp/local-invocation-id.comp | 2 +- .../comp/local-invocation-index.comp | 2 +- .../reference/opt/shaders-msl/comp/mod.comp | 2 +- .../opt/shaders-msl/comp/writable-ssbo.comp | 2 +- .../vert/shader-draw-parameters.desktop.vert | 2 +- .../shaders-msl/frag/buffer-read-write.frag | 2 +- .../opt/shaders-msl/frag/lut-promotion.frag | 55 ++++- .../opt/shaders-msl/frag/mrt-array.frag | 2 +- .../opt/shaders-msl/vert/functions.vert | 10 +- .../opt/shaders-msl/vert/no_stage_out.vert | 2 +- .../vert/read-from-row-major-array.vert | 2 +- .../opt/shaders-msl/vert/sign-int-types.vert | 2 +- .../opt/shaders-msl/vert/texture_buffer.vert | 2 +- .../vulkan/vert/vulkan-vertex.vk.vert | 2 +- .../phi-temporary-copy-loop-variable.asm.comp | 1 - .../frag/selection-merge-to-continue.asm.frag | 3 - .../frag/switch-merge-to-continue.asm.frag | 1 - ...temporary-use-continue-block-as-value.frag | 3 - .../loop-dominator-and-switch-default.frag | 1 - .../shaders/frag/post-depth-coverage-es.frag | 14 ++ .../opt/shaders/frag/post-depth-coverage.frag | 4 + .../comp/bitfield-signed-operations.asm.comp | 105 +++++++++ .../shaders-hlsl-no-opt/comp/bitfield.comp | 4 +- .../comp/bitfield-signed-operations.asm.comp | 29 +++ .../asm/comp/bitscan.asm.comp | 6 +- .../asm/comp/glsl-signed-operations.asm.comp | 6 +- .../storage-buffer-pointer-argument.asm.comp | 2 +- .../asm/comp/variable-pointers.asm.comp | 6 +- .../asm/frag/texture-access.swizzle.asm.frag | 2 +- .../composite-extract-row-major.asm.comp | 2 +- .../comp/array-copy-threadgroup-memory.comp | 79 +++++++ .../shaders-msl-no-opt/comp/bitfield.comp | 16 +- .../shaders-msl-no-opt/comp/glsl.std450.comp | 18 +- .../frag/texture-access-int.swizzle.frag | 2 +- .../frag/texture-access-leaf.swizzle.frag | 4 +- .../frag/texture-access-uint.swizzle.frag | 2 +- .../frag/texture-access.swizzle.frag | 2 +- .../packing/matrix-2x2-scalar.comp | 16 +- .../packing/matrix-2x2-std140.comp | 16 +- .../packing/matrix-2x2-std430.comp | 16 +- .../packing/matrix-2x3-scalar.comp | 16 +- .../packing/matrix-2x3-std140.comp | 16 +- .../packing/matrix-2x3-std430.comp | 16 +- .../packing/matrix-2x4-scalar.comp | 16 +- .../packing/matrix-2x4-std140.comp | 16 +- .../packing/matrix-2x4-std430.comp | 16 +- .../packing/matrix-3x2-scalar.comp | 16 +- .../packing/matrix-3x2-std140.comp | 16 +- .../packing/matrix-3x2-std430.comp | 16 +- .../packing/matrix-3x3-scalar.comp | 16 +- .../packing/matrix-3x3-std140.comp | 16 +- .../packing/matrix-3x3-std430.comp | 16 +- .../packing/matrix-3x4-scalar.comp | 16 +- .../packing/matrix-3x4-std140.comp | 16 +- .../packing/matrix-3x4-std430.comp | 16 +- .../packing/matrix-4x2-scalar.comp | 16 +- .../packing/matrix-4x2-std140.comp | 16 +- .../packing/matrix-4x2-std430.comp | 16 +- .../packing/matrix-4x3-scalar.comp | 16 +- .../packing/matrix-4x3-std140.comp | 16 +- .../packing/matrix-4x3-std430.comp | 16 +- .../packing/matrix-4x4-scalar.comp | 16 +- .../packing/matrix-4x4-std140.comp | 16 +- .../packing/matrix-4x4-std430.comp | 16 +- .../vert/functions_nested.vert | 14 +- .../vert/pass-array-by-value.vert | 63 +++++- .../texture-access-function.swizzle.vk.frag | 4 +- .../asm/comp/atomic-decrement.asm.comp | 2 +- .../asm/comp/atomic-increment.asm.comp | 2 +- .../comp/buffer-write-relative-addr.asm.comp | 2 +- .../asm/comp/buffer-write.asm.comp | 2 +- .../comp/global-parameter-name-alias.asm.comp | 4 +- .../image-load-store-short-vector.asm.comp | 2 +- .../struct-resource-name-aliasing.asm.comp | 2 +- .../asm/comp/variable-pointers-2.asm.comp | 4 +- ...ariable-pointers-store-forwarding.asm.comp | 2 +- .../vector-builtin-type-cast-func.asm.comp | 2 +- .../asm/frag/empty-struct.asm.frag | 4 +- .../extract-packed-from-composite.asm.frag | 2 +- .../asm/frag/function-overload-alias.asm.frag | 8 +- .../asm/frag/line-directive.line.asm.frag | 2 +- .../frag/lut-promotion-initializer.asm.frag | 57 ++++- .../asm/frag/pass-by-value.asm.frag | 2 +- .../frag/single-function-private-lut.asm.frag | 57 ++++- .../asm/frag/unknown-depth-state.asm.frag | 4 +- ...input-array-builtin-array.invalid.asm.tesc | 63 +++++- ...act-transposed-matrix-from-struct.asm.vert | 2 +- .../asm/vert/invariant.msl21.asm.vert | 2 +- .../vert/uint-vertex-id-instance-id.asm.vert | 2 +- .../access-private-workgroup-in-function.comp | 4 +- .../shaders-msl/comp/array-length.comp | 2 +- .../array-length.msl2.argument.discrete.comp | 2 +- .../reference/shaders-msl/comp/barriers.comp | 22 +- .../comp/cfg-preserve-parameter.comp | 8 +- .../shaders-msl/comp/complex-type-alias.comp | 2 +- .../comp/composite-array-initialization.comp | 59 ++++- .../shaders-msl/comp/composite-construct.comp | 57 ++++- .../comp/copy-array-of-arrays.comp | 163 +++++++++++--- .../reference/shaders-msl/comp/functions.comp | 2 +- ...vocation-id-writable-ssbo-in-function.comp | 4 +- .../comp/global-invocation-id.comp | 2 +- .../reference/shaders-msl/comp/inverse.comp | 6 +- .../shaders-msl/comp/local-invocation-id.comp | 2 +- .../comp/local-invocation-index.comp | 2 +- .../reference/shaders-msl/comp/mod.comp | 2 +- .../comp/shared-array-of-arrays.comp | 2 +- .../shaders-msl/comp/type-alias.comp | 4 +- .../shaders-msl/comp/writable-ssbo.comp | 2 +- .../desktop-only/tesc/basic.desktop.sso.tesc | 2 +- .../vert/shader-draw-parameters.desktop.vert | 2 +- .../frag/argument-buffers.msl2.argument.frag | 4 +- ...wizzle.msl2.argument.discrete.swizzle.frag | 6 +- ...array-of-texture-swizzle.msl2.swizzle.frag | 4 +- .../shaders-msl/frag/buffer-read-write.frag | 2 +- .../shaders-msl/frag/constant-array.frag | 2 +- .../shaders-msl/frag/constant-composites.frag | 55 ++++- .../shaders-msl/frag/flush_params.frag | 4 +- .../frag/fp16.desktop.invalid.frag | 18 +- ...agment-component-padding.pad-fragment.frag | 2 +- .../frag/helper-invocation.msl21.frag | 2 +- .../frag/image-query-lod.msl22.frag | 2 +- .../shaders-msl/frag/input-attachment-ms.frag | 2 +- .../shaders-msl/frag/input-attachment.frag | 2 +- .../shaders-msl/frag/lut-promotion.frag | 57 ++++- .../reference/shaders-msl/frag/mrt-array.frag | 6 +- .../shaders-msl/frag/packing-test-3.frag | 2 +- ...rivate-variable-prototype-declaration.frag | 4 +- .../shaders-msl/frag/readonly-ssbo.frag | 2 +- .../sample-depth-separate-image-sampler.frag | 4 +- .../frag/sample-position-func.frag | 2 +- .../frag/sampler-image-arrays.msl2.frag | 6 +- .../reference/shaders-msl/frag/sampler.frag | 2 +- .../frag/separate-image-sampler-argument.frag | 2 +- .../frag/shader-arithmetic-8bit.frag | 8 +- .../shadow-compare-global-alias.invalid.frag | 8 +- .../frag/stencil-export.msl21.frag | 2 +- .../frag/write-depth-in-function.frag | 2 +- .../shaders-msl/tesc/water_tess.tesc | 10 +- .../shaders-msl/tese/input-array.tese | 2 +- .../shaders-msl/tese/input-types.tese | 2 +- .../reference/shaders-msl/tese/quad.tese | 2 +- .../shaders-msl/tese/set-from-function.tese | 2 +- .../shaders-msl/tese/water_tess.tese | 6 +- .../reference/shaders-msl/vert/functions.vert | 10 +- .../shaders-msl/vert/in_out_array_mat.vert | 4 +- .../vert/leaf-function.capture.vert | 2 +- .../shaders-msl/vert/no_stage_out.vert | 2 +- .../vert/read-from-row-major-array.vert | 6 +- .../vert/resource-arrays-leaf.ios.vert | 2 +- .../shaders-msl/vert/return-array.vert | 63 +++++- .../shaders-msl/vert/set_builtin_in_func.vert | 2 +- .../shaders-msl/vert/sign-int-types.vert | 2 +- .../shaders-msl/vert/texture_buffer.vert | 2 +- .../vulkan/vert/vulkan-vertex.vk.vert | 2 +- .../comp/bitfield-signed-operations.asm.comp | 27 +++ ...ined-image-sampler-dxc-min16float.asm.frag | 28 +++ .../asm/frag/ldexp-uint-exponent.asm.frag | 11 + ...tch-single-case-multiple-exit-cfg.asm.frag | 29 +++ .../phi-temporary-copy-loop-variable.asm.comp | 1 - .../frag/for-loop-phi-only-continue.asm.frag | 1 - .../frag/op-phi-swap-continue-block.asm.frag | 1 - .../frag/selection-merge-to-continue.asm.frag | 2 - .../shaders/frag/post-depth-coverage-es.frag | 14 ++ .../shaders/frag/post-depth-coverage.frag | 4 + .../comp/bitfield-signed-operations.asm.comp | 97 +++++++++ .../comp/bitfield-signed-operations.asm.comp | 97 +++++++++ .../comp/array-copy-threadgroup-memory.comp | 18 ++ .../comp/bitfield-signed-operations.asm.comp | 97 +++++++++ ...ined-image-sampler-dxc-min16float.asm.frag | 95 ++++++++ .../asm/frag/ldexp-uint-exponent.asm.frag | 36 +++ ...tch-single-case-multiple-exit-cfg.asm.frag | 57 +++++ .../shaders/frag/post-depth-coverage-es.frag | 13 ++ 3rdparty/spirv-cross/spirv_cfg.cpp | 104 ++++++++- 3rdparty/spirv-cross/spirv_cfg.hpp | 10 +- 3rdparty/spirv-cross/spirv_common.hpp | 6 +- 3rdparty/spirv-cross/spirv_cross.cpp | 97 ++++----- 3rdparty/spirv-cross/spirv_cross.hpp | 8 +- .../spirv-cross/spirv_cross_containers.hpp | 3 +- 3rdparty/spirv-cross/spirv_glsl.cpp | 205 ++++++++++++++++-- 3rdparty/spirv-cross/spirv_glsl.hpp | 9 +- 3rdparty/spirv-cross/spirv_hlsl.cpp | 5 +- 3rdparty/spirv-cross/spirv_msl.cpp | 125 +++++++---- 3rdparty/spirv-cross/spirv_msl.hpp | 3 +- 195 files changed, 2552 insertions(+), 726 deletions(-) create mode 100644 3rdparty/spirv-cross/reference/opt/shaders/frag/post-depth-coverage-es.frag create mode 100644 3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp create mode 100644 3rdparty/spirv-cross/reference/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.frag create mode 100644 3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag create mode 100644 3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag create mode 100644 3rdparty/spirv-cross/reference/shaders/frag/post-depth-coverage-es.frag create mode 100644 3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 3rdparty/spirv-cross/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp create mode 100644 3rdparty/spirv-cross/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp create mode 100644 3rdparty/spirv-cross/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.frag create mode 100644 3rdparty/spirv-cross/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag create mode 100644 3rdparty/spirv-cross/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag create mode 100644 3rdparty/spirv-cross/shaders/frag/post-depth-coverage-es.frag diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp index 04d92a346..bbc9a95a9 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp @@ -13,7 +13,7 @@ struct u0_counters }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp index b0fd1d4f3..5710c9102 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp @@ -13,7 +13,7 @@ struct u0_counters }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp index fa2b5fe53..d8998bd20 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp @@ -11,7 +11,7 @@ struct cb5_struct }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp index 159d09b38..c4a0476c3 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp @@ -11,7 +11,7 @@ struct cb }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag index 610d447a8..030fbb04b 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag @@ -19,17 +19,58 @@ struct main0_in int index [[user(locn0)]]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } fragment main0_out main0(main0_in in [[stage_in]]) @@ -61,7 +102,7 @@ fragment main0_out main0(main0_in in [[stage_in]]) } int _37 = in.index & 3; out.FragColor += foobar[_37].z; - spvArrayCopyFromConstant1(baz, _90); + spvArrayCopyFromConstantToStack1(baz, _90); out.FragColor += baz[_37].z; return out; } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag index 4081c3d89..7d1ab8658 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag @@ -19,7 +19,7 @@ struct main0_out // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc index bbda7be5b..a9940940b 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc @@ -33,17 +33,58 @@ struct main0_in float4 gl_Position [[attribute(1)]]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]]) @@ -56,7 +97,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_ return; VertexOutput _223[3] = { VertexOutput{ gl_in[0].gl_Position, gl_in[0].VertexOutput_uv }, VertexOutput{ gl_in[1].gl_Position, gl_in[1].VertexOutput_uv }, VertexOutput{ gl_in[2].gl_Position, gl_in[2].VertexOutput_uv } }; VertexOutput param[3]; - spvArrayCopyFromStack1(param, _223); + spvArrayCopyFromStackToStack1(param, _223); gl_out[gl_InvocationID].gl_Position = param[gl_InvocationID].pos; gl_out[gl_InvocationID]._entryPointOutput.uv = param[gl_InvocationID].uv; threadgroup_barrier(mem_flags::mem_device); diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp index 8dec8bddb..e7a950e57 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp @@ -29,24 +29,65 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u); constant Data _25[2] = { Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } kernel void main0(device SSBO& _53 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]]) { Data _31[2] = { Data{ X, 2.0 }, Data{ 3.0, 5.0 } }; Data data2[2]; - spvArrayCopyFromStack1(data2, _31); + spvArrayCopyFromStackToStack1(data2, _31); _53.outdata[gl_WorkGroupID.x].a = _25[gl_LocalInvocationID.x].a + data2[gl_LocalInvocationID.x].a; _53.outdata[gl_WorkGroupID.x].b = _25[gl_LocalInvocationID.x].b + data2[gl_LocalInvocationID.x].b; } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp index 6d44fc57b..c0189371a 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp @@ -15,24 +15,65 @@ struct SSBO1 float4 bs[1]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } kernel void main0(device SSBO0& _16 [[buffer(0)]], device SSBO1& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { float4 _37[2] = { _16.as[gl_GlobalInvocationID.x], _32.bs[gl_GlobalInvocationID.x] }; float4 values[2]; - spvArrayCopyFromStack1(values, _37); + spvArrayCopyFromStackToStack1(values, _37); _16.as[0] = values[gl_LocalInvocationIndex]; _32.bs[1] = float4(40.0); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp index fe0212ec3..9900b5931 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp @@ -13,7 +13,7 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id.comp index fe0212ec3..9900b5931 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/global-invocation-id.comp @@ -13,7 +13,7 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp index f2f499b91..3ea692fab 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp @@ -33,7 +33,7 @@ inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float4x4 spvInverse4x4(float4x4 m) +inline float4x4 spvInverse4x4(float4x4 m) { float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) @@ -68,7 +68,7 @@ float4x4 spvInverse4x4(float4x4 m) // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float3x3 spvInverse3x3(float3x3 m) +inline float3x3 spvInverse3x3(float3x3 m) { float3x3 adj; // The adjoint matrix (inverse after dividing by determinant) @@ -95,7 +95,7 @@ float3x3 spvInverse3x3(float3x3 m) // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float2x2 spvInverse2x2(float2x2 m) +inline float2x2 spvInverse2x2(float2x2 m) { float2x2 adj; // The adjoint matrix (inverse after dividing by determinant) diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-id.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-id.comp index 772e5e0d8..362aaa30c 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-id.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-id.comp @@ -13,7 +13,7 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-index.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-index.comp index 41adbdca5..f8c1550ea 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-index.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/local-invocation-index.comp @@ -13,7 +13,7 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/mod.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/mod.comp index 8574f87b7..e37995713 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/mod.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/mod.comp @@ -17,7 +17,7 @@ struct SSBO2 // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/writable-ssbo.comp b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/writable-ssbo.comp index 9dc53b6dd..dcec81a36 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/writable-ssbo.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/comp/writable-ssbo.comp @@ -13,7 +13,7 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert b/3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert index 1d203ba98..a32c1948f 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert @@ -11,7 +11,7 @@ struct main0_out vertex main0_out main0(uint gl_BaseVertex [[base_vertex]], uint gl_BaseInstance [[base_instance]]) { main0_out out = {}; - out.gl_Position = float4(float(gl_BaseVertex), float(gl_BaseInstance), 0.0, 1.0); + out.gl_Position = float4(float(int(gl_BaseVertex)), float(int(gl_BaseInstance)), 0.0, 1.0); return out; } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag b/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag index 2b2ac7f06..36b1a1809 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag @@ -11,7 +11,7 @@ struct main0_out }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag b/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag index c9169b790..0e4c73f2e 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag @@ -19,17 +19,58 @@ struct main0_in int index [[user(locn0)]]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } fragment main0_out main0(main0_in in [[stage_in]]) diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag b/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag index d7cea6baf..c8237e941 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag @@ -21,7 +21,7 @@ struct main0_in // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/functions.vert b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/functions.vert index 9af0f3f35..7a598d48a 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/functions.vert +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/functions.vert @@ -31,28 +31,28 @@ struct main0_in // Implementation of the GLSL radians() function template -T radians(T d) +inline T radians(T d) { return d * T(0.01745329251); } // Implementation of the GLSL degrees() function template -T degrees(T r) +inline T degrees(T r) { return r * T(57.2957795131); } // Implementation of the GLSL findLSB() function template -T spvFindLSB(T x) +inline T spvFindLSB(T x) { return select(ctz(x), T(-1), x == T(0)); } // Implementation of the signed GLSL findMSB() function template -T spvFindSMSB(T x) +inline T spvFindSMSB(T x) { T v = select(x, T(-1) - x, x < T(0)); return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); @@ -72,7 +72,7 @@ inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float4x4 spvInverse4x4(float4x4 m) +inline float4x4 spvInverse4x4(float4x4 m) { float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert index 28098ee88..30613cc4b 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/no_stage_out.vert @@ -15,6 +15,6 @@ struct main0_in vertex void main0(main0_in in [[stage_in]], device _10& _12 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) { - _12._m0[gl_VertexIndex] = in.m_19; + _12._m0[int(gl_VertexIndex)] = in.m_19; } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/read-from-row-major-array.vert b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/read-from-row-major-array.vert index be3c5e4ee..ec3e7b724 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/read-from-row-major-array.vert +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/read-from-row-major-array.vert @@ -23,7 +23,7 @@ vertex main0_out main0(main0_in in [[stage_in]], constant Block& _104 [[buffer(0 { main0_out out = {}; out.gl_Position = in.a_position; - out.v_vtxResult = ((float(abs(float3(_104.var[0][0][0][0], _104.var[0][0][1][0], _104.var[0][0][2][0])[0] - 2.0) < 0.0500000007450580596923828125) * float(abs(float3(_104.var[0][0][0][0], _104.var[0][0][1][0], _104.var[0][0][2][0])[1] - 6.0) < 0.0500000007450580596923828125)) * float(abs(float3(_104.var[0][0][0][0], _104.var[0][0][1][0], _104.var[0][0][2][0])[2] - (-6.0)) < 0.0500000007450580596923828125)) * ((float(abs(float3(_104.var[0][0][0][1], _104.var[0][0][1][1], _104.var[0][0][2][1])[0]) < 0.0500000007450580596923828125) * float(abs(float3(_104.var[0][0][0][1], _104.var[0][0][1][1], _104.var[0][0][2][1])[1] - 5.0) < 0.0500000007450580596923828125)) * float(abs(float3(_104.var[0][0][0][1], _104.var[0][0][1][1], _104.var[0][0][2][1])[2] - 5.0) < 0.0500000007450580596923828125)); + out.v_vtxResult = ((float(abs(_104.var[0][0][0][0] - 2.0) < 0.0500000007450580596923828125) * float(abs(_104.var[0][0][1][0] - 6.0) < 0.0500000007450580596923828125)) * float(abs(_104.var[0][0][2][0] - (-6.0)) < 0.0500000007450580596923828125)) * ((float(abs(_104.var[0][0][0][1]) < 0.0500000007450580596923828125) * float(abs(_104.var[0][0][1][1] - 5.0) < 0.0500000007450580596923828125)) * float(abs(_104.var[0][0][2][1] - 5.0) < 0.0500000007450580596923828125)); return out; } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/sign-int-types.vert b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/sign-int-types.vert index 2f518b129..a51064522 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/sign-int-types.vert +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/sign-int-types.vert @@ -38,7 +38,7 @@ struct main0_in // Implementation of the GLSL sign() function for integer types template::value>::type> -T sign(T x) +inline T sign(T x) { return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0)); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert index ee3956fad..677a2f8fd 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert @@ -11,7 +11,7 @@ struct main0_out }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert b/3rdparty/spirv-cross/reference/opt/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert index 53e26e4a8..86a0cea5b 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert +++ b/3rdparty/spirv-cross/reference/opt/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert @@ -11,7 +11,7 @@ struct main0_out vertex main0_out main0(uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) { main0_out out = {}; - out.gl_Position = float4(1.0, 2.0, 3.0, 4.0) * float(gl_VertexIndex + gl_InstanceIndex); + out.gl_Position = float4(1.0, 2.0, 3.0, 4.0) * float(int(gl_VertexIndex) + int(gl_InstanceIndex)); return out; } diff --git a/3rdparty/spirv-cross/reference/opt/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp b/3rdparty/spirv-cross/reference/opt/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp index 9266982b7..4f8d2ffa7 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp +++ b/3rdparty/spirv-cross/reference/opt/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp @@ -14,7 +14,6 @@ void main() { break; } - continue; } imageStore(outImageTexture, ivec2(gl_GlobalInvocationID.xy), vec4(float(_30 - 1), float(_30), 1.0, 1.0)); } diff --git a/3rdparty/spirv-cross/reference/opt/shaders/asm/frag/selection-merge-to-continue.asm.frag b/3rdparty/spirv-cross/reference/opt/shaders/asm/frag/selection-merge-to-continue.asm.frag index 05c17c7a6..370e50058 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders/asm/frag/selection-merge-to-continue.asm.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders/asm/frag/selection-merge-to-continue.asm.frag @@ -11,14 +11,11 @@ void main() if (v0.x == 20.0) { FragColor += vec4(v0[_54 & 3]); - continue; } else { FragColor += vec4(v0[_54 & 1]); - continue; } - continue; } } diff --git a/3rdparty/spirv-cross/reference/opt/shaders/asm/frag/switch-merge-to-continue.asm.frag b/3rdparty/spirv-cross/reference/opt/shaders/asm/frag/switch-merge-to-continue.asm.frag index ea4a25995..d40a3f807 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders/asm/frag/switch-merge-to-continue.asm.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders/asm/frag/switch-merge-to-continue.asm.frag @@ -25,7 +25,6 @@ void main() break; } } - continue; } } diff --git a/3rdparty/spirv-cross/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag b/3rdparty/spirv-cross/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag index 91d7e37cd..89be3d5a6 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders/frag/hoisted-temporary-use-continue-block-as-value.frag @@ -15,14 +15,11 @@ void main() if ((vA + _57) == 20) { _58 = 50; - continue; } else { _58 = ((vB + _57) == 40) ? 60 : _60; - continue; } - continue; } } diff --git a/3rdparty/spirv-cross/reference/opt/shaders/frag/loop-dominator-and-switch-default.frag b/3rdparty/spirv-cross/reference/opt/shaders/frag/loop-dominator-and-switch-default.frag index 00f4b6be4..2c193483d 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders/frag/loop-dominator-and-switch-default.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders/frag/loop-dominator-and-switch-default.frag @@ -50,7 +50,6 @@ void main() vec4 _79 = _83; _79.y = _83.y + 0.5; _89 = _79; - continue; } fragColor = _82; } diff --git a/3rdparty/spirv-cross/reference/opt/shaders/frag/post-depth-coverage-es.frag b/3rdparty/spirv-cross/reference/opt/shaders/frag/post-depth-coverage-es.frag new file mode 100644 index 000000000..d086560e5 --- /dev/null +++ b/3rdparty/spirv-cross/reference/opt/shaders/frag/post-depth-coverage-es.frag @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_post_depth_coverage : require +#extension GL_OES_sample_variables : require +precision mediump float; +precision highp int; +layout(early_fragment_tests, post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(gl_SampleMaskIn[0])); +} + diff --git a/3rdparty/spirv-cross/reference/opt/shaders/frag/post-depth-coverage.frag b/3rdparty/spirv-cross/reference/opt/shaders/frag/post-depth-coverage.frag index 3e78fcd0a..caca9c03c 100644 --- a/3rdparty/spirv-cross/reference/opt/shaders/frag/post-depth-coverage.frag +++ b/3rdparty/spirv-cross/reference/opt/shaders/frag/post-depth-coverage.frag @@ -1,5 +1,9 @@ #version 450 +#if defined(GL_ARB_post_depth_coverge) #extension GL_ARB_post_depth_coverage : require +#else +#extension GL_EXT_post_depth_coverage : require +#endif layout(early_fragment_tests, post_depth_coverage) in; layout(location = 0) out vec4 FragColor; diff --git a/3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 000000000..ae5fe5adb --- /dev/null +++ b/3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,105 @@ +RWByteAddressBuffer _3 : register(u0); + +uint SPIRV_Cross_bitfieldInsert(uint Base, uint Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint2 SPIRV_Cross_bitfieldInsert(uint2 Base, uint2 Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint3 SPIRV_Cross_bitfieldInsert(uint3 Base, uint3 Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint4 SPIRV_Cross_bitfieldInsert(uint4 Base, uint4 Insert, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31)); + return (Base & ~Mask) | ((Insert << Offset) & Mask); +} + +uint SPIRV_Cross_bitfieldUExtract(uint Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +uint2 SPIRV_Cross_bitfieldUExtract(uint2 Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +uint3 SPIRV_Cross_bitfieldUExtract(uint3 Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +uint4 SPIRV_Cross_bitfieldUExtract(uint4 Base, uint Offset, uint Count) +{ + uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1); + return (Base >> Offset) & Mask; +} + +int SPIRV_Cross_bitfieldSExtract(int Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +int2 SPIRV_Cross_bitfieldSExtract(int2 Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int2 Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +int3 SPIRV_Cross_bitfieldSExtract(int3 Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int3 Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +int4 SPIRV_Cross_bitfieldSExtract(int4 Base, int Offset, int Count) +{ + int Mask = Count == 32 ? -1 : ((1 << Count) - 1); + int4 Masked = (Base >> Offset) & Mask; + int ExtendShift = (32 - Count) & 31; + return (Masked << ExtendShift) >> ExtendShift; +} + +void comp_main() +{ + int4 _19 = int4(_3.Load4(0)); + uint4 _20 = _3.Load4(16); + _3.Store4(0, uint4(countbits(_19))); + _3.Store4(16, uint4(countbits(_19))); + _3.Store4(0, uint4(int4(countbits(_20)))); + _3.Store4(16, countbits(_20)); + _3.Store4(0, uint4(reversebits(_19))); + _3.Store4(16, reversebits(_20)); + _3.Store4(0, uint4(SPIRV_Cross_bitfieldSExtract(_19, 1, 11u))); + _3.Store4(16, SPIRV_Cross_bitfieldSExtract(_20, 11u, 1)); + _3.Store4(0, uint4(SPIRV_Cross_bitfieldUExtract(_19, 1, 11u))); + _3.Store4(16, SPIRV_Cross_bitfieldUExtract(_20, 11u, 1)); + _3.Store4(0, uint4(int4(SPIRV_Cross_bitfieldInsert(_19, _19.wzyx, 1, 11u)))); + _3.Store4(16, SPIRV_Cross_bitfieldInsert(_20, _20.wzyx, 11u, 1)); +} + +[numthreads(1, 1, 1)] +void main() +{ + comp_main(); +} diff --git a/3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/comp/bitfield.comp b/3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/comp/bitfield.comp index 4e93a1453..0dc089c1d 100644 --- a/3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/comp/bitfield.comp +++ b/3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/comp/bitfield.comp @@ -90,7 +90,7 @@ void comp_main() u = SPIRV_Cross_bitfieldInsert(u, 60u, 5, 4); u = reversebits(u); s = reversebits(s); - int v0 = countbits(u); + int v0 = int(countbits(u)); int v1 = countbits(s); int v2 = int(firstbithigh(u)); int v3 = firstbitlow(s); @@ -100,7 +100,7 @@ void comp_main() u_1 = SPIRV_Cross_bitfieldInsert(u_1, uint3(60u, 60u, 60u), 5, 4); u_1 = reversebits(u_1); s_1 = reversebits(s_1); - int3 v0_1 = countbits(u_1); + int3 v0_1 = int3(countbits(u_1)); int3 v1_1 = countbits(s_1); int3 v2_1 = int3(firstbithigh(u_1)); int3 v3_1 = firstbitlow(s_1); diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 000000000..8e198a94d --- /dev/null +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,29 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + int4 ints; + uint4 uints; +}; + +kernel void main0(device SSBO& _3 [[buffer(0)]]) +{ + int4 _19 = _3.ints; + uint4 _20 = _3.uints; + _3.ints = popcount(_19); + _3.uints = uint4(popcount(_19)); + _3.ints = int4(popcount(_20)); + _3.uints = popcount(_20); + _3.ints = reverse_bits(_19); + _3.uints = reverse_bits(_20); + _3.ints = extract_bits(_19, uint(1), 11u); + _3.uints = uint4(extract_bits(int4(_20), 11u, uint(1))); + _3.ints = int4(extract_bits(uint4(_19), uint(1), 11u)); + _3.uints = extract_bits(_20, 11u, uint(1)); + _3.ints = insert_bits(_19, _19.wzyx, uint(1), 11u); + _3.uints = insert_bits(_20, _20.wzyx, 11u, uint(1)); +} + diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitscan.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitscan.asm.comp index 1b9c4bd95..5634d9da6 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitscan.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/bitscan.asm.comp @@ -13,14 +13,14 @@ struct SSBO // Implementation of the GLSL findLSB() function template -T spvFindLSB(T x) +inline T spvFindLSB(T x) { return select(ctz(x), T(-1), x == T(0)); } // Implementation of the signed GLSL findMSB() function template -T spvFindSMSB(T x) +inline T spvFindSMSB(T x) { T v = select(x, T(-1) - x, x < T(0)); return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); @@ -28,7 +28,7 @@ T spvFindSMSB(T x) // Implementation of the unsigned GLSL findMSB() function template -T spvFindUMSB(T x) +inline T spvFindUMSB(T x) { return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0)); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp index 0376bc4fb..7de0020ca 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/glsl-signed-operations.asm.comp @@ -13,7 +13,7 @@ struct SSBO // Implementation of the signed GLSL findMSB() function template -T spvFindSMSB(T x) +inline T spvFindSMSB(T x) { T v = select(x, T(-1) - x, x < T(0)); return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); @@ -21,14 +21,14 @@ T spvFindSMSB(T x) // Implementation of the unsigned GLSL findMSB() function template -T spvFindUMSB(T x) +inline T spvFindUMSB(T x) { return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0)); } // Implementation of the GLSL sign() function for integer types template::value>::type> -T sign(T x) +inline T sign(T x) { return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0)); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp index ec40c6afc..eee35d297 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp @@ -15,7 +15,7 @@ struct SSBORead float b; }; -void copy_out(device float& A, device const float& B) +inline void copy_out(device float& A, device const float& B) { A = B; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp index 37731c720..a42eca2b3 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp @@ -22,17 +22,17 @@ struct baz int e[128]; }; -device int* select_buffer(device foo& buf, device baz& buf2, constant bar& cb) +inline device int* select_buffer(device foo& buf, device baz& buf2, constant bar& cb) { return (cb.d != 0) ? &buf.a[0u] : &buf2.e[0u]; } -device int* select_buffer_null(device foo& buf, constant bar& cb) +inline device int* select_buffer_null(device foo& buf, constant bar& cb) { return (cb.d != 0) ? &buf.a[0u] : nullptr; } -threadgroup int* select_tgsm(constant bar& cb, threadgroup int (&tgsm)[128]) +inline threadgroup int* select_tgsm(constant bar& cb, threadgroup int (&tgsm)[128]) { return (cb.d != 0) ? &tgsm[0u] : nullptr; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag index fce6757b4..afebb421c 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag @@ -6,7 +6,7 @@ using namespace metal; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp index a2d2acbb1..d2c368b8e 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/packing/composite-extract-row-major.asm.comp @@ -11,6 +11,6 @@ struct SSBORow kernel void main0(device SSBORow& _4 [[buffer(0)]]) { - _4.v = float4(_4.row_major0[0][1], _4.row_major0[1][1], _4.row_major0[2][1], _4.row_major0[3][1])[2]; + _4.v = _4.row_major0[2][1]; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp new file mode 100644 index 000000000..85a06afaa --- /dev/null +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp @@ -0,0 +1,79 @@ +#pragma clang diagnostic ignored "-Wmissing-prototypes" + +#include +#include + +using namespace metal; + +constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 1u, 1u); + +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +kernel void main0(uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) +{ + threadgroup float shared_group[8][8]; + threadgroup float shared_group_alt[8][8]; + float blob[8]; + for (int i = 0; i < 8; i++) + { + blob[i] = float(i); + } + spvArrayCopyFromStackToThreadGroup1(shared_group[gl_LocalInvocationIndex], blob); + threadgroup_barrier(mem_flags::mem_threadgroup); + float copied_blob[8]; + spvArrayCopyFromThreadGroupToStack1(copied_blob, shared_group[gl_LocalInvocationIndex ^ 1u]); + spvArrayCopyFromThreadGroupToThreadGroup1(shared_group_alt[gl_LocalInvocationIndex], shared_group[gl_LocalInvocationIndex]); +} + diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/bitfield.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/bitfield.comp index 6da1225ee..7f797add1 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/bitfield.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/bitfield.comp @@ -7,14 +7,14 @@ using namespace metal; // Implementation of the GLSL findLSB() function template -T spvFindLSB(T x) +inline T spvFindLSB(T x) { return select(ctz(x), T(-1), x == T(0)); } // Implementation of the signed GLSL findMSB() function template -T spvFindSMSB(T x) +inline T spvFindSMSB(T x) { T v = select(x, T(-1) - x, x < T(0)); return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); @@ -22,7 +22,7 @@ T spvFindSMSB(T x) // Implementation of the unsigned GLSL findMSB() function template -T spvFindUMSB(T x) +inline T spvFindUMSB(T x) { return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0)); } @@ -31,13 +31,13 @@ kernel void main0() { int signed_value = 0; uint unsigned_value = 0u; - int s = extract_bits(signed_value, 5, 20); - uint u = extract_bits(unsigned_value, 6, 21); - s = insert_bits(s, 40, 5, 4); - u = insert_bits(u, 60u, 5, 4); + int s = extract_bits(signed_value, uint(5), uint(20)); + uint u = extract_bits(unsigned_value, uint(6), uint(21)); + s = insert_bits(s, 40, uint(5), uint(4)); + u = insert_bits(u, 60u, uint(5), uint(4)); u = reverse_bits(u); s = reverse_bits(s); - int v0 = popcount(u); + int v0 = int(popcount(u)); int v1 = popcount(s); int v2 = int(spvFindUMSB(u)); int v3 = spvFindSMSB(s); diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp index 47dd35d02..7ac4269da 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp @@ -26,28 +26,28 @@ struct ResType // Implementation of the GLSL radians() function template -T radians(T d) +inline T radians(T d) { return d * T(0.01745329251); } // Implementation of the GLSL degrees() function template -T degrees(T r) +inline T degrees(T r) { return r * T(57.2957795131); } // Implementation of the GLSL findLSB() function template -T spvFindLSB(T x) +inline T spvFindLSB(T x) { return select(ctz(x), T(-1), x == T(0)); } // Implementation of the signed GLSL findMSB() function template -T spvFindSMSB(T x) +inline T spvFindSMSB(T x) { T v = select(x, T(-1) - x, x < T(0)); return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); @@ -55,14 +55,14 @@ T spvFindSMSB(T x) // Implementation of the unsigned GLSL findMSB() function template -T spvFindUMSB(T x) +inline T spvFindUMSB(T x) { return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0)); } // Implementation of the GLSL sign() function for integer types template::value>::type> -T sign(T x) +inline T sign(T x) { return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0)); } @@ -81,7 +81,7 @@ inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float4x4 spvInverse4x4(float4x4 m) +inline float4x4 spvInverse4x4(float4x4 m) { float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) @@ -116,7 +116,7 @@ float4x4 spvInverse4x4(float4x4 m) // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float3x3 spvInverse3x3(float3x3 m) +inline float3x3 spvInverse3x3(float3x3 m) { float3x3 adj; // The adjoint matrix (inverse after dividing by determinant) @@ -143,7 +143,7 @@ float3x3 spvInverse3x3(float3x3 m) // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float2x2 spvInverse2x2(float2x2 m) +inline float2x2 spvInverse2x2(float2x2 m) { float2x2 adj; // The adjoint matrix (inverse after dividing by determinant) diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag index 4cb0fdd59..b8f431344 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag @@ -6,7 +6,7 @@ using namespace metal; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag index 581f29094..3d3a15311 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag @@ -6,7 +6,7 @@ using namespace metal; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } @@ -131,7 +131,7 @@ inline vec spvGatherCompareSwizzle(sampler s, const thread Tex& t, Ts... p return t.gather_compare(s, spvForward(params)...); } -float4 doSwizzle(thread texture1d tex1d, thread const sampler tex1dSmplr, constant uint& tex1dSwzl, thread texture2d tex2d, thread const sampler tex2dSmplr, constant uint& tex2dSwzl, thread texture3d tex3d, thread const sampler tex3dSmplr, constant uint& tex3dSwzl, thread texturecube texCube, thread const sampler texCubeSmplr, constant uint& texCubeSwzl, thread texture2d_array tex2dArray, thread const sampler tex2dArraySmplr, constant uint& tex2dArraySwzl, thread texturecube_array texCubeArray, thread const sampler texCubeArraySmplr, constant uint& texCubeArraySwzl, thread depth2d depth2d, thread const sampler depth2dSmplr, constant uint& depth2dSwzl, thread depthcube depthCube, thread const sampler depthCubeSmplr, constant uint& depthCubeSwzl, thread depth2d_array depth2dArray, thread const sampler depth2dArraySmplr, constant uint& depth2dArraySwzl, thread depthcube_array depthCubeArray, thread const sampler depthCubeArraySmplr, constant uint& depthCubeArraySwzl, thread texture2d texBuffer) +inline float4 doSwizzle(thread texture1d tex1d, thread const sampler tex1dSmplr, constant uint& tex1dSwzl, thread texture2d tex2d, thread const sampler tex2dSmplr, constant uint& tex2dSwzl, thread texture3d tex3d, thread const sampler tex3dSmplr, constant uint& tex3dSwzl, thread texturecube texCube, thread const sampler texCubeSmplr, constant uint& texCubeSwzl, thread texture2d_array tex2dArray, thread const sampler tex2dArraySmplr, constant uint& tex2dArraySwzl, thread texturecube_array texCubeArray, thread const sampler texCubeArraySmplr, constant uint& texCubeArraySwzl, thread depth2d depth2d, thread const sampler depth2dSmplr, constant uint& depth2dSwzl, thread depthcube depthCube, thread const sampler depthCubeSmplr, constant uint& depthCubeSwzl, thread depth2d_array depth2dArray, thread const sampler depth2dArraySmplr, constant uint& depth2dArraySwzl, thread depthcube_array depthCubeArray, thread const sampler depthCubeArraySmplr, constant uint& depthCubeArraySwzl, thread texture2d texBuffer) { float4 c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl); c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0)), tex2dSwzl); diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag index 86b712536..505bffa17 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag @@ -6,7 +6,7 @@ using namespace metal; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag index fb9865bcf..35886f434 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag @@ -6,7 +6,7 @@ using namespace metal; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp index a0fdf9d91..05cae5ab5 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp @@ -17,46 +17,46 @@ struct SSBORow float2x2 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float2x2 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float2x2 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; v_41.row_major0[1][1] = v_29.col_major0[1].y; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp index e499066fa..d74b5d555 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp @@ -17,52 +17,52 @@ struct SSBORow float2x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float2x2 loaded = float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy); v_29.col_major1[0].xy = loaded[0]; v_29.col_major1[1].xy = loaded[1]; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float2x2 loaded = transpose(float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy)); v_41.row_major0[0].xy = float2(loaded[0][0], loaded[1][0]); v_41.row_major0[1].xy = float2(loaded[0][1], loaded[1][1]); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0[0].xy = float2x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy)[0]; v_29.col_major0[1].xy = float2x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy)[1]; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0[0].xy = float2(float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy)[0][0], float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy)[1][0]); v_41.row_major0[1].xy = float2(float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy)[0][1], float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy)[1][1]); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].xy = float2(float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy)[0][0], float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy)[1][0]); v_29.col_major0[1].xy = float2(float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy)[0][1], float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy)[1][1]); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0[0].xy = float2x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy)[0]; v_41.row_major0[1].xy = float2x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy)[1]; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1].xy = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; v_41.row_major0[1][1] = v_29.col_major0[1].y; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp index a0fdf9d91..05cae5ab5 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp @@ -17,46 +17,46 @@ struct SSBORow float2x2 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float2x2 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float2x2 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; v_41.row_major0[1][1] = v_29.col_major0[1].y; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp index 8c4b5617c..03a067328 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp @@ -19,42 +19,42 @@ struct SSBORow float3x2 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float2x3 loaded = float2x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1])); v_29.col_major1[0] = loaded[0]; v_29.col_major1[1] = loaded[1]; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float2x3 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0[0] = float2x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]))[0]; v_29.col_major0[1] = float2x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]))[1]; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(float2x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]))); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0] = float3(v_41.row_major0[0][0], v_41.row_major0[1][0], v_41.row_major0[2][0]); v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); v_41.row_major0[0][1] = v_29.col_major0[1][0]; @@ -62,7 +62,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[2][1] = v_29.col_major0[1][2]; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0][1u] = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0][1u]; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp index d04df10a6..9ba60b474 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp @@ -17,13 +17,13 @@ struct SSBORow float3x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float2x3 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float2x3 loaded = transpose(float3x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy, v_41.row_major0[2].xy)); v_41.row_major0[0].xy = float2(loaded[0][0], loaded[1][0]); @@ -31,31 +31,31 @@ void load_store_to_variable_row_major(device SSBORow& v_41) v_41.row_major0[2].xy = float2(loaded[0][2], loaded[1][2]); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0[0].xy = float2(v_29.col_major0[0][0], v_29.col_major0[1][0]); v_41.row_major0[1].xy = float2(v_29.col_major0[0][1], v_29.col_major0[1][1]); v_41.row_major0[2].xy = float2(v_29.col_major0[0][2], v_29.col_major0[1][2]); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(float3x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy, v_41.row_major0[2].xy)); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0[0].xy = float3x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy)[0]; v_41.row_major0[1].xy = float3x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy)[1]; v_41.row_major0[2].xy = float3x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy)[2]; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -63,7 +63,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[2][1] = v_29.col_major0[1].z; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp index b86de3475..ff696ea96 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp @@ -17,39 +17,39 @@ struct SSBORow float3x2 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float2x3 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float2x3 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -57,7 +57,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[2][1] = v_29.col_major0[1].z; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp index 2498d6b26..014c91392 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp @@ -17,39 +17,39 @@ struct SSBORow float4x2 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float2x4 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float2x4 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -58,7 +58,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3][1] = v_29.col_major0[1].w; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp index 9d78295c8..50bd393bf 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp @@ -17,13 +17,13 @@ struct SSBORow float4x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float2x4 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float2x4 loaded = transpose(float4x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy, v_41.row_major0[2].xy, v_41.row_major0[3].xy)); v_41.row_major0[0].xy = float2(loaded[0][0], loaded[1][0]); @@ -32,12 +32,12 @@ void load_store_to_variable_row_major(device SSBORow& v_41) v_41.row_major0[3].xy = float2(loaded[0][3], loaded[1][3]); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0[0].xy = float2(v_29.col_major0[0][0], v_29.col_major0[1][0]); v_41.row_major0[1].xy = float2(v_29.col_major0[0][1], v_29.col_major0[1][1]); @@ -45,12 +45,12 @@ void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3].xy = float2(v_29.col_major0[0][3], v_29.col_major0[1][3]); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(float4x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy, v_41.row_major0[2].xy, v_41.row_major0[3].xy)); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0[0].xy = float4x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy, v_41.row_major1[3].xy)[0]; v_41.row_major0[1].xy = float4x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy, v_41.row_major1[3].xy)[1]; @@ -58,7 +58,7 @@ void copy_row_major_to_row_major(device SSBORow& v_41) v_41.row_major0[3].xy = float4x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy, v_41.row_major1[3].xy)[3]; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -67,7 +67,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3][1] = v_29.col_major0[1].w; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp index 2498d6b26..014c91392 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp @@ -17,39 +17,39 @@ struct SSBORow float4x2 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float2x4 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float2x4 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -58,7 +58,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3][1] = v_29.col_major0[1].w; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp index d917a91c4..255e8f4f4 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp @@ -19,49 +19,49 @@ struct SSBORow packed_rm_float3x2 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float3x2 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float3x2 loaded = transpose(float2x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]))); v_41.row_major0[0] = float3(loaded[0][0], loaded[1][0], loaded[2][0]); v_41.row_major0[1] = float3(loaded[0][1], loaded[1][1], loaded[2][1]); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0[0] = float3(v_29.col_major0[0][0], v_29.col_major0[1][0], v_29.col_major0[2][0]); v_41.row_major0[1] = float3(v_29.col_major0[0][1], v_29.col_major0[1][1], v_29.col_major0[2][1]); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(float2x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]))); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0[0] = float2x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]))[0]; v_41.row_major0[1] = float2x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]))[1]; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; v_41.row_major0[1][1] = v_29.col_major0[1].y; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp index eaa725cf5..879d470bc 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp @@ -17,7 +17,7 @@ struct SSBORow float2x3 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float3x2 loaded = float3x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy, v_29.col_major0[2].xy); v_29.col_major1[0].xy = loaded[0]; @@ -25,44 +25,44 @@ void load_store_to_variable_col_major(device SSBOCol& v_29) v_29.col_major1[2].xy = loaded[2]; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float3x2 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0[0].xy = float3x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy, v_29.col_major1[2].xy)[0]; v_29.col_major0[1].xy = float3x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy, v_29.col_major1[2].xy)[1]; v_29.col_major0[2].xy = float3x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy, v_29.col_major1[2].xy)[2]; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(float3x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy, v_29.col_major0[2].xy)); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].xy = float2(v_41.row_major0[0][0], v_41.row_major0[1][0]); v_29.col_major0[1].xy = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_29.col_major0[2].xy = float2(v_41.row_major0[0][2], v_41.row_major0[1][2]); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1].xy = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; v_41.row_major0[1][1] = v_29.col_major0[1].y; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std430.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std430.comp index 04bd790be..5a7b7705d 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std430.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std430.comp @@ -17,46 +17,46 @@ struct SSBORow float2x3 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float3x2 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float3x2 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; v_41.row_major0[1][1] = v_29.col_major0[1].y; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp index 42d285e33..2af056564 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-scalar.comp @@ -20,7 +20,7 @@ struct SSBORow packed_rm_float3x3 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float3x3 loaded = float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2])); v_29.col_major1[0] = loaded[0]; @@ -28,7 +28,7 @@ void load_store_to_variable_col_major(device SSBOCol& v_29) v_29.col_major1[2] = loaded[2]; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float3x3 loaded = transpose(float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))); v_41.row_major0[0] = float3(loaded[0][0], loaded[1][0], loaded[2][0]); @@ -36,35 +36,35 @@ void load_store_to_variable_row_major(device SSBORow& v_41) v_41.row_major0[2] = float3(loaded[0][2], loaded[1][2], loaded[2][2]); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0[0] = float3x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]), float3(v_29.col_major1[2]))[0]; v_29.col_major0[1] = float3x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]), float3(v_29.col_major1[2]))[1]; v_29.col_major0[2] = float3x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]), float3(v_29.col_major1[2]))[2]; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0[0] = float3(float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]))[0][0], float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]))[1][0], float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]))[2][0]); v_41.row_major0[1] = float3(float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]))[0][1], float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]))[1][1], float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]))[2][1]); v_41.row_major0[2] = float3(float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]))[0][2], float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]))[1][2], float3x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]))[2][2]); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0] = float3(float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))[0][0], float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))[1][0], float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))[2][0]); v_29.col_major0[1] = float3(float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))[0][1], float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))[1][1], float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))[2][1]); v_29.col_major0[2] = float3(float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))[0][2], float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))[1][2], float3x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]))[2][2]); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0[0] = float3x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]), float3(v_41.row_major1[2]))[0]; v_41.row_major0[1] = float3x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]), float3(v_41.row_major1[2]))[1]; v_41.row_major0[2] = float3x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]), float3(v_41.row_major1[2]))[2]; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); v_41.row_major0[0][1] = v_29.col_major0[1][0]; @@ -72,7 +72,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[2][1] = v_29.col_major0[1][2]; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0][1u] = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0][1u]; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std140.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std140.comp index ceff01e42..223ea4e04 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std140.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std140.comp @@ -17,39 +17,39 @@ struct SSBORow float3x3 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float3x3 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float3x3 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -57,7 +57,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[2][1] = v_29.col_major0[1].z; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std430.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std430.comp index ceff01e42..223ea4e04 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std430.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x3-std430.comp @@ -17,39 +17,39 @@ struct SSBORow float3x3 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float3x3 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float3x3 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -57,7 +57,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[2][1] = v_29.col_major0[1].z; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp index c7b1b3261..d74d3dadd 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-scalar.comp @@ -19,13 +19,13 @@ struct SSBORow packed_rm_float3x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float3x4 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float3x4 loaded = transpose(float4x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]), float3(v_41.row_major0[3]))); v_41.row_major0[0] = float3(loaded[0][0], loaded[1][0], loaded[2][0]); @@ -34,12 +34,12 @@ void load_store_to_variable_row_major(device SSBORow& v_41) v_41.row_major0[3] = float3(loaded[0][3], loaded[1][3], loaded[2][3]); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0[0] = float3(v_29.col_major0[0][0], v_29.col_major0[1][0], v_29.col_major0[2][0]); v_41.row_major0[1] = float3(v_29.col_major0[0][1], v_29.col_major0[1][1], v_29.col_major0[2][1]); @@ -47,12 +47,12 @@ void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3] = float3(v_29.col_major0[0][3], v_29.col_major0[1][3], v_29.col_major0[2][3]); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(float4x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1]), float3(v_41.row_major0[2]), float3(v_41.row_major0[3]))); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0[0] = float4x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]), float3(v_41.row_major1[2]), float3(v_41.row_major1[3]))[0]; v_41.row_major0[1] = float4x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]), float3(v_41.row_major1[2]), float3(v_41.row_major1[3]))[1]; @@ -60,7 +60,7 @@ void copy_row_major_to_row_major(device SSBORow& v_41) v_41.row_major0[3] = float4x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]), float3(v_41.row_major1[2]), float3(v_41.row_major1[3]))[3]; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -69,7 +69,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3][1] = v_29.col_major0[1].w; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std140.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std140.comp index 9f6a20ed2..19881edcb 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std140.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std140.comp @@ -17,39 +17,39 @@ struct SSBORow float4x3 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float3x4 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float3x4 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -58,7 +58,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3][1] = v_29.col_major0[1].w; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std430.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std430.comp index 9f6a20ed2..19881edcb 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std430.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x4-std430.comp @@ -17,39 +17,39 @@ struct SSBORow float4x3 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float3x4 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float3x4 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -58,7 +58,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3][1] = v_29.col_major0[1].w; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp index f863373e8..627d2cefb 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-scalar.comp @@ -17,46 +17,46 @@ struct SSBORow float2x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float4x2 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float4x2 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; v_41.row_major0[1][1] = v_29.col_major0[1].y; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std140.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std140.comp index 684cd82ee..62df118dc 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std140.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std140.comp @@ -17,7 +17,7 @@ struct SSBORow float2x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float4x2 loaded = float4x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy, v_29.col_major0[2].xy, v_29.col_major0[3].xy); v_29.col_major1[0].xy = loaded[0]; @@ -26,13 +26,13 @@ void load_store_to_variable_col_major(device SSBOCol& v_29) v_29.col_major1[3].xy = loaded[3]; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float4x2 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0[0].xy = float4x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy, v_29.col_major1[2].xy, v_29.col_major1[3].xy)[0]; v_29.col_major0[1].xy = float4x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy, v_29.col_major1[2].xy, v_29.col_major1[3].xy)[1]; @@ -40,12 +40,12 @@ void copy_col_major_to_col_major(device SSBOCol& v_29) v_29.col_major0[3].xy = float4x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy, v_29.col_major1[2].xy, v_29.col_major1[3].xy)[3]; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(float4x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy, v_29.col_major0[2].xy, v_29.col_major0[3].xy)); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].xy = float2(v_41.row_major0[0][0], v_41.row_major0[1][0]); v_29.col_major0[1].xy = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); @@ -53,19 +53,19 @@ void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) v_29.col_major0[3].xy = float2(v_41.row_major0[0][3], v_41.row_major0[1][3]); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1].xy = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; v_41.row_major0[1][1] = v_29.col_major0[1].y; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std430.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std430.comp index f863373e8..627d2cefb 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std430.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x2-std430.comp @@ -17,46 +17,46 @@ struct SSBORow float2x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float4x2 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float4x2 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; v_41.row_major0[1][1] = v_29.col_major0[1].y; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp index 7f921db07..fd5e28ddf 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-scalar.comp @@ -19,7 +19,7 @@ struct SSBORow float3x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float4x3 loaded = float4x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]), float3(v_29.col_major0[3])); v_29.col_major1[0] = loaded[0]; @@ -28,13 +28,13 @@ void load_store_to_variable_col_major(device SSBOCol& v_29) v_29.col_major1[3] = loaded[3]; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float4x3 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0[0] = float4x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]), float3(v_29.col_major1[2]), float3(v_29.col_major1[3]))[0]; v_29.col_major0[1] = float4x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]), float3(v_29.col_major1[2]), float3(v_29.col_major1[3]))[1]; @@ -42,12 +42,12 @@ void copy_col_major_to_col_major(device SSBOCol& v_29) v_29.col_major0[3] = float4x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]), float3(v_29.col_major1[2]), float3(v_29.col_major1[3]))[3]; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(float4x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]), float3(v_29.col_major0[2]), float3(v_29.col_major0[3]))); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0] = float3(v_41.row_major0[0][0], v_41.row_major0[1][0], v_41.row_major0[2][0]); v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); @@ -55,12 +55,12 @@ void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) v_29.col_major0[3] = float3(v_41.row_major0[0][3], v_41.row_major0[1][3], v_41.row_major0[2][3]); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); v_41.row_major0[0][1] = v_29.col_major0[1][0]; @@ -68,7 +68,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[2][1] = v_29.col_major0[1][2]; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0][1u] = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0][1u]; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std140.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std140.comp index 574f02e8d..8baba0e9d 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std140.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std140.comp @@ -17,39 +17,39 @@ struct SSBORow float3x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float4x3 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float4x3 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -57,7 +57,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[2][1] = v_29.col_major0[1].z; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std430.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std430.comp index 574f02e8d..8baba0e9d 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std430.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x3-std430.comp @@ -17,39 +17,39 @@ struct SSBORow float3x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float4x3 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float4x3 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -57,7 +57,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[2][1] = v_29.col_major0[1].z; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp index 45bf0d87d..6cc48993d 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-scalar.comp @@ -17,39 +17,39 @@ struct SSBORow float4x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float4x4 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float4x4 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -58,7 +58,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3][1] = v_29.col_major0[1].w; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std140.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std140.comp index 45bf0d87d..6cc48993d 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std140.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std140.comp @@ -17,39 +17,39 @@ struct SSBORow float4x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float4x4 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float4x4 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -58,7 +58,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3][1] = v_29.col_major0[1].w; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std430.comp b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std430.comp index 45bf0d87d..6cc48993d 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std430.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-4x4-std430.comp @@ -17,39 +17,39 @@ struct SSBORow float4x4 row_major1; }; -void load_store_to_variable_col_major(device SSBOCol& v_29) +inline void load_store_to_variable_col_major(device SSBOCol& v_29) { float4x4 loaded = v_29.col_major0; v_29.col_major1 = loaded; } -void load_store_to_variable_row_major(device SSBORow& v_41) +inline void load_store_to_variable_row_major(device SSBORow& v_41) { float4x4 loaded = transpose(v_41.row_major0); v_41.row_major0 = transpose(loaded); } -void copy_col_major_to_col_major(device SSBOCol& v_29) +inline void copy_col_major_to_col_major(device SSBOCol& v_29) { v_29.col_major0 = v_29.col_major1; } -void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41) { v_41.row_major0 = transpose(v_29.col_major0); } -void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0 = transpose(v_41.row_major0); } -void copy_row_major_to_row_major(device SSBORow& v_41) +inline void copy_row_major_to_row_major(device SSBORow& v_41) { v_41.row_major0 = v_41.row_major1; } -void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]); v_41.row_major0[0][1] = v_29.col_major0[1].x; @@ -58,7 +58,7 @@ void copy_columns(device SSBOCol& v_29, device SSBORow& v_41) v_41.row_major0[3][1] = v_29.col_major0[1].w; } -void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) +inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41) { v_29.col_major0[0].y = v_41.row_major0[1u][0]; v_41.row_major0[1u][0] = v_29.col_major0[0].y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vert/functions_nested.vert b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vert/functions_nested.vert index 5d67f408b..0f2b70bb0 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vert/functions_nested.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vert/functions_nested.vert @@ -37,12 +37,12 @@ struct main0_out }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } -attr_desc fetch_desc(thread const int& location, constant VertexBuffer& v_227) +inline attr_desc fetch_desc(thread const int& location, constant VertexBuffer& v_227) { int attribute_flags = v_227.input_attributes[location].w; attr_desc result; @@ -55,7 +55,7 @@ attr_desc fetch_desc(thread const int& location, constant VertexBuffer& v_227) return result; } -uint get_bits(thread const uint4& v, thread const int& swap) +inline uint get_bits(thread const uint4& v, thread const int& swap) { if (swap != 0) { @@ -64,7 +64,7 @@ uint get_bits(thread const uint4& v, thread const int& swap) return ((v.x | (v.y << uint(8))) | (v.z << uint(16))) | (v.w << uint(24)); } -float4 fetch_attr(thread const attr_desc& desc, thread const int& vertex_id, thread const texture2d input_stream) +inline float4 fetch_attr(thread const attr_desc& desc, thread const int& vertex_id, thread const texture2d input_stream) { float4 result = float4(0.0, 0.0, 0.0, 1.0); bool reverse_order = false; @@ -132,11 +132,11 @@ float4 fetch_attr(thread const attr_desc& desc, thread const int& vertex_id, thr return _210; } -float4 read_location(thread const int& location, constant VertexBuffer& v_227, thread uint& gl_VertexIndex, thread texture2d buff_in_2, thread texture2d buff_in_1) +inline float4 read_location(thread const int& location, constant VertexBuffer& v_227, thread uint& gl_VertexIndex, thread texture2d buff_in_2, thread texture2d buff_in_1) { int param = location; attr_desc desc = fetch_desc(param, v_227); - int vertex_id = gl_VertexIndex - int(v_227.vertex_base_index); + int vertex_id = int(gl_VertexIndex) - int(v_227.vertex_base_index); if (desc.is_volatile != 0) { attr_desc param_1 = desc; @@ -151,7 +151,7 @@ float4 read_location(thread const int& location, constant VertexBuffer& v_227, t } } -void vs_adjust(thread float4& dst_reg0, thread float4& dst_reg1, thread float4& dst_reg7, constant VertexBuffer& v_227, thread uint& gl_VertexIndex, thread texture2d buff_in_2, thread texture2d buff_in_1, constant VertexConstantsBuffer& v_309) +inline void vs_adjust(thread float4& dst_reg0, thread float4& dst_reg1, thread float4& dst_reg7, constant VertexBuffer& v_227, thread uint& gl_VertexIndex, thread texture2d buff_in_2, thread texture2d buff_in_1, constant VertexConstantsBuffer& v_309) { int param = 3; float4 in_diff_color = read_location(param, v_227, gl_VertexIndex, buff_in_2, buff_in_1); diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert index ab5631366..5fc73a3a3 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vert/pass-array-by-value.vert @@ -18,29 +18,70 @@ struct main0_in int Index2 [[attribute(1)]]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -float4 consume_constant_arrays2(thread const float4 (&positions)[4], thread const float4 (&positions2)[4], thread int& Index1, thread int& Index2) +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +inline float4 consume_constant_arrays2(thread const float4 (&positions)[4], thread const float4 (&positions2)[4], thread int& Index1, thread int& Index2) { float4 indexable[4]; - spvArrayCopyFromStack1(indexable, positions); + spvArrayCopyFromStackToStack1(indexable, positions); float4 indexable_1[4]; - spvArrayCopyFromStack1(indexable_1, positions2); + spvArrayCopyFromStackToStack1(indexable_1, positions2); return indexable[Index1] + indexable_1[Index2]; } -float4 consume_constant_arrays(thread const float4 (&positions)[4], thread const float4 (&positions2)[4], thread int& Index1, thread int& Index2) +inline float4 consume_constant_arrays(thread const float4 (&positions)[4], thread const float4 (&positions2)[4], thread int& Index1, thread int& Index2) { return consume_constant_arrays2(positions, positions2, Index1, Index2); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag index 9c3fff593..e7a740379 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl-no-opt/vulkan/frag/texture-access-function.swizzle.vk.frag @@ -11,7 +11,7 @@ struct main0_out }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } @@ -136,7 +136,7 @@ inline vec spvGatherCompareSwizzle(sampler s, const thread Tex& t, Ts... p return t.gather_compare(s, spvForward(params)...); } -float4 do_samples(thread const texture1d t1, thread const sampler t1Smplr, constant uint& t1Swzl, thread const texture2d t2, constant uint& t2Swzl, thread const texture3d t3, thread const sampler t3Smplr, constant uint& t3Swzl, thread const texturecube tc, constant uint& tcSwzl, thread const texture2d_array t2a, thread const sampler t2aSmplr, constant uint& t2aSwzl, thread const texturecube_array tca, thread const sampler tcaSmplr, constant uint& tcaSwzl, thread const texture2d tb, thread const depth2d d2, thread const sampler d2Smplr, constant uint& d2Swzl, thread const depthcube dc, thread const sampler dcSmplr, constant uint& dcSwzl, thread const depth2d_array d2a, constant uint& d2aSwzl, thread const depthcube_array dca, thread const sampler dcaSmplr, constant uint& dcaSwzl, thread sampler defaultSampler, thread sampler shadowSampler) +inline float4 do_samples(thread const texture1d t1, thread const sampler t1Smplr, constant uint& t1Swzl, thread const texture2d t2, constant uint& t2Swzl, thread const texture3d t3, thread const sampler t3Smplr, constant uint& t3Swzl, thread const texturecube tc, constant uint& tcSwzl, thread const texture2d_array t2a, thread const sampler t2aSmplr, constant uint& t2aSwzl, thread const texturecube_array tca, thread const sampler tcaSmplr, constant uint& tcaSwzl, thread const texture2d tb, thread const depth2d d2, thread const sampler d2Smplr, constant uint& d2Swzl, thread const depthcube dc, thread const sampler dcSmplr, constant uint& dcSwzl, thread const depth2d_array d2a, constant uint& d2aSwzl, thread const depthcube_array dca, thread const sampler dcaSmplr, constant uint& dcaSwzl, thread sampler defaultSampler, thread sampler shadowSampler) { float4 c = spvTextureSwizzle(t1.sample(t1Smplr, 0.0), t1Swzl); c = spvTextureSwizzle(t2.sample(defaultSampler, float2(0.0)), t2Swzl); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/atomic-decrement.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/atomic-decrement.asm.comp index b06c0e9cd..ca9ba1544 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/atomic-decrement.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/atomic-decrement.asm.comp @@ -13,7 +13,7 @@ struct u0_counters }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/atomic-increment.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/atomic-increment.asm.comp index 71af7bee3..b8d5b3cca 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/atomic-increment.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/atomic-increment.asm.comp @@ -13,7 +13,7 @@ struct u0_counters }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp index 217782ce7..54323859c 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp @@ -11,7 +11,7 @@ struct cb5_struct }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/buffer-write.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/buffer-write.asm.comp index 159d09b38..c4a0476c3 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/buffer-write.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/buffer-write.asm.comp @@ -11,7 +11,7 @@ struct cb }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp index 967d14bfc..0c0d8b599 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/global-parameter-name-alias.asm.comp @@ -10,13 +10,13 @@ struct ssbo uint _data[1]; }; -void Load(thread const uint& size, const device ssbo& ssbo_1) +inline void Load(thread const uint& size, const device ssbo& ssbo_1) { int byteAddrTemp = int(size >> uint(2)); uint4 data = uint4(ssbo_1._data[byteAddrTemp], ssbo_1._data[byteAddrTemp + 1], ssbo_1._data[byteAddrTemp + 2], ssbo_1._data[byteAddrTemp + 3]); } -void _main(thread const uint3& id, const device ssbo& ssbo_1) +inline void _main(thread const uint3& id, const device ssbo& ssbo_1) { uint param = 4u; Load(param, ssbo_1); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/image-load-store-short-vector.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/image-load-store-short-vector.asm.comp index c90faf9ef..4770033bc 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/image-load-store-short-vector.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/image-load-store-short-vector.asm.comp @@ -5,7 +5,7 @@ using namespace metal; -void _main(thread const uint3& id, thread texture2d TargetTexture) +inline void _main(thread const uint3& id, thread texture2d TargetTexture) { float2 loaded = TargetTexture.read(uint2(id.xy)).xy; float2 storeTemp = loaded + float2(1.0); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp index a3323bf25..8ea934730 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/struct-resource-name-aliasing.asm.comp @@ -10,7 +10,7 @@ struct bufA uint _data[1]; }; -void _main(device bufA& bufA_1, device bufA& bufB) +inline void _main(device bufA& bufA_1, device bufA& bufB) { bufA_1._data[0] = 0u; bufB._data[0] = 0u; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp index 07b22d684..7855c4c82 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-2.asm.comp @@ -17,12 +17,12 @@ struct bar int d; }; -device foo* select_buffer(device foo& a, constant bar& cb) +inline device foo* select_buffer(device foo& a, constant bar& cb) { return (cb.d != 0) ? &a : nullptr; } -thread uint3* select_input(thread uint3& gl_GlobalInvocationID, thread uint3& gl_LocalInvocationID, constant bar& cb) +inline thread uint3* select_input(thread uint3& gl_GlobalInvocationID, thread uint3& gl_LocalInvocationID, constant bar& cb) { return (cb.d != 0) ? &gl_GlobalInvocationID : &gl_LocalInvocationID; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp index b2f8fc424..11a39ad23 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/variable-pointers-store-forwarding.asm.comp @@ -15,7 +15,7 @@ struct bar int b; }; -device int* _24(device foo& a, device bar& b, thread uint3& gl_GlobalInvocationID) +inline device int* _24(device foo& a, device bar& b, thread uint3& gl_GlobalInvocationID) { return (gl_GlobalInvocationID.x != 0u) ? &a.a : &b.b; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp index e4092261d..e4573f37a 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/comp/vector-builtin-type-cast-func.asm.comp @@ -12,7 +12,7 @@ struct cb1_struct constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(16u, 16u, 1u); -int2 get_texcoord(thread const int2& base, thread const int2& index, thread uint3& gl_LocalInvocationID) +inline int2 get_texcoord(thread const int2& base, thread const int2& index, thread uint3& gl_LocalInvocationID) { return (base * int3(gl_LocalInvocationID).xy) + index; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag index 0a56f1f15..61d49d783 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/empty-struct.asm.frag @@ -10,12 +10,12 @@ struct EmptyStructTest int empty_struct_member; }; -float GetValue(thread const EmptyStructTest& self) +inline float GetValue(thread const EmptyStructTest& self) { return 0.0; } -float GetValue_1(EmptyStructTest self) +inline float GetValue_1(EmptyStructTest self) { return 0.0; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag index 1f92b341a..ec5534515 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag @@ -28,7 +28,7 @@ struct main0_out float4 _entryPointOutput [[color(0)]]; }; -float4 _main(thread const float4& pos, constant buf& v_11) +inline float4 _main(thread const float4& pos, constant buf& v_11) { int _46 = int(pos.x) % 16; Foo foo; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/function-overload-alias.asm.frag b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/function-overload-alias.asm.frag index 1a6314c81..13e359680 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/function-overload-alias.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/function-overload-alias.asm.frag @@ -10,22 +10,22 @@ struct main0_out float4 FragColor [[color(0)]]; }; -float4 foo(thread const float4& foo_1) +inline float4 foo(thread const float4& foo_1) { return foo_1 + float4(1.0); } -float4 foo(thread const float3& foo_1) +inline float4 foo(thread const float3& foo_1) { return foo_1.xyzz + float4(1.0); } -float4 foo_1(thread const float4& foo_2) +inline float4 foo_1(thread const float4& foo_2) { return foo_2 + float4(2.0); } -float4 foo(thread const float2& foo_2) +inline float4 foo(thread const float2& foo_2) { return foo_2.xyxy + float4(2.0); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/line-directive.line.asm.frag b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/line-directive.line.asm.frag index e1d2a9d7b..b44b83d03 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/line-directive.line.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/line-directive.line.asm.frag @@ -16,7 +16,7 @@ struct main0_in }; #line 6 "test.frag" -void func(thread float& FragColor, thread float& vColor) +inline void func(thread float& FragColor, thread float& vColor) { #line 8 "test.frag" FragColor = 1.0; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag index 48f3317d2..428a9bf24 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag @@ -19,17 +19,58 @@ struct main0_in int index [[user(locn0)]]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } fragment main0_out main0(main0_in in [[stage_in]]) @@ -59,7 +100,7 @@ fragment main0_out main0(main0_in in [[stage_in]]) foobar[1].z = 20.0; } out.FragColor += foobar[in.index & 3].z; - spvArrayCopyFromConstant1(baz, _90); + spvArrayCopyFromConstantToStack1(baz, _90); out.FragColor += baz[in.index & 3].z; return out; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag index 6ed945ecf..1935c3f81 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/pass-by-value.asm.frag @@ -15,7 +15,7 @@ struct main0_out float FragColor [[color(0)]]; }; -float add_value(float v, float w) +inline float add_value(float v, float w) { return v + w; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/single-function-private-lut.asm.frag b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/single-function-private-lut.asm.frag index 628d5c7c1..127f18181 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/single-function-private-lut.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/single-function-private-lut.asm.frag @@ -19,22 +19,63 @@ struct main0_out // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } fragment main0_out main0(float4 gl_FragCoord [[position]]) diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag index ce2b95196..8bc8d36f2 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag @@ -15,12 +15,12 @@ struct main0_in float3 vUV [[user(locn0)]]; }; -float sample_combined(thread float3& vUV, thread depth2d uShadow, thread const sampler uShadowSmplr) +inline float sample_combined(thread float3& vUV, thread depth2d uShadow, thread const sampler uShadowSmplr) { return uShadow.sample_compare(uShadowSmplr, vUV.xy, vUV.z); } -float sample_separate(thread float3& vUV, thread depth2d uTexture, thread sampler uSampler) +inline float sample_separate(thread float3& vUV, thread depth2d uTexture, thread sampler uSampler) { return uTexture.sample_compare(uSampler, vUV.xy, vUV.z); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc b/3rdparty/spirv-cross/reference/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc index 6a765117e..ebe723de6 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc @@ -45,20 +45,61 @@ struct main0_in float4 gl_Position [[attribute(1)]]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -HSOut _hs_main(thread const VertexOutput (&p)[3], thread const uint& i) +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +inline HSOut _hs_main(thread const VertexOutput (&p)[3], thread const uint& i) { HSOut _output; _output.pos = p[i].pos; @@ -66,7 +107,7 @@ HSOut _hs_main(thread const VertexOutput (&p)[3], thread const uint& i) return _output; } -HSConstantOut PatchHS(thread const VertexOutput (&_patch)[3]) +inline HSConstantOut PatchHS(thread const VertexOutput (&_patch)[3]) { HSConstantOut _output; _output.EdgeTess[0] = (float2(1.0) + _patch[0].uv).x; @@ -93,7 +134,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_ p[2].uv = gl_in[2].VertexOutput_uv; uint i = gl_InvocationID; VertexOutput param[3]; - spvArrayCopyFromStack1(param, p); + spvArrayCopyFromStackToStack1(param, p); uint param_1 = i; HSOut flattenTemp = _hs_main(param, param_1); gl_out[gl_InvocationID].gl_Position = flattenTemp.pos; @@ -102,7 +143,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_ if (int(gl_InvocationID) == 0) { VertexOutput param_2[3]; - spvArrayCopyFromStack1(param_2, p); + spvArrayCopyFromStackToStack1(param_2, p); HSConstantOut _patchConstantResult = PatchHS(param_2); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(_patchConstantResult.EdgeTess[0]); spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(_patchConstantResult.EdgeTess[1]); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert b/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert index 667d363a3..455735d01 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/extract-transposed-matrix-from-struct.asm.vert @@ -39,7 +39,7 @@ struct main0_in float3 PosL [[attribute(0)]]; }; -V2F _VS(thread const float3& PosL, thread const uint& instanceID, const device gInstanceData& gInstanceData_1) +inline V2F _VS(thread const float3& PosL, thread const uint& instanceID, const device gInstanceData& gInstanceData_1) { InstanceData instData; instData.MATRIX_MVP = transpose(gInstanceData_1._data[instanceID].MATRIX_MVP); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/invariant.msl21.asm.vert b/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/invariant.msl21.asm.vert index 1e3a86531..798a44043 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/invariant.msl21.asm.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/invariant.msl21.asm.vert @@ -10,7 +10,7 @@ struct main0_out float4 gl_Position [[position, invariant]]; }; -float4 _main() +inline float4 _main() { return float4(1.0); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert b/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert index 89ca17f98..231336df4 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/asm/vert/uint-vertex-id-instance-id.asm.vert @@ -10,7 +10,7 @@ struct main0_out float4 gl_Position [[position]]; }; -float4 _main(thread const uint& vid, thread const uint& iid) +inline float4 _main(thread const uint& vid, thread const uint& iid) { return float4(float(vid + iid)); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/access-private-workgroup-in-function.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/access-private-workgroup-in-function.comp index 17acda967..d21c19579 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/access-private-workgroup-in-function.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/access-private-workgroup-in-function.comp @@ -5,12 +5,12 @@ using namespace metal; -void set_f(thread int& f) +inline void set_f(thread int& f) { f = 40; } -void set_shared_u(threadgroup int& u) +inline void set_shared_u(threadgroup int& u) { u = 50; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/array-length.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/array-length.comp index 8406d1e50..11f0b47c5 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/array-length.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/array-length.comp @@ -16,7 +16,7 @@ struct SSBO1 float bz[1]; }; -uint get_size(device SSBO& v_14, constant uint& v_14BufferSize, device SSBO1* (&ssbos)[2], constant uint* ssbosBufferSize) +inline uint get_size(device SSBO& v_14, constant uint& v_14BufferSize, device SSBO1* (&ssbos)[2], constant uint* ssbosBufferSize) { return uint(int((v_14BufferSize - 16) / 16) + int((ssbosBufferSize[1] - 0) / 4)); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/array-length.msl2.argument.discrete.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/array-length.msl2.argument.discrete.comp index 73bd3f6d7..6d70cbb57 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/array-length.msl2.argument.discrete.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/array-length.msl2.argument.discrete.comp @@ -39,7 +39,7 @@ struct spvDescriptorSetBuffer1 constant uint* spvBufferSizeConstants [[id(2)]]; }; -uint get_size(device SSBO& v_16, constant uint& v_16BufferSize, device SSBO1* constant (&ssbos)[2], constant uint* ssbosBufferSize, device SSBO2& v_38, constant uint& v_38BufferSize, device SSBO3* (&ssbos2)[2], constant uint* ssbos2BufferSize) +inline uint get_size(device SSBO& v_16, constant uint& v_16BufferSize, device SSBO1* constant (&ssbos)[2], constant uint* ssbosBufferSize, device SSBO2& v_38, constant uint& v_38BufferSize, device SSBO3* (&ssbos2)[2], constant uint* ssbos2BufferSize) { uint len = uint(int((v_16BufferSize - 16) / 16)); len += uint(int((ssbosBufferSize[1] - 0) / 4)); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/barriers.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/barriers.comp index 560fd8b53..8c9cfb5d1 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/barriers.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/barriers.comp @@ -7,57 +7,57 @@ using namespace metal; constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 1u, 1u); -void barrier_shared() +inline void barrier_shared() { threadgroup_barrier(mem_flags::mem_threadgroup); } -void full_barrier() +inline void full_barrier() { threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); } -void image_barrier() +inline void image_barrier() { threadgroup_barrier(mem_flags::mem_texture); } -void buffer_barrier() +inline void buffer_barrier() { threadgroup_barrier(mem_flags::mem_device); } -void group_barrier() +inline void group_barrier() { threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); } -void barrier_shared_exec() +inline void barrier_shared_exec() { threadgroup_barrier(mem_flags::mem_threadgroup); } -void full_barrier_exec() +inline void full_barrier_exec() { threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); } -void image_barrier_exec() +inline void image_barrier_exec() { threadgroup_barrier(mem_flags::mem_texture); } -void buffer_barrier_exec() +inline void buffer_barrier_exec() { threadgroup_barrier(mem_flags::mem_device); } -void group_barrier_exec() +inline void group_barrier_exec() { threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup | mem_flags::mem_texture); } -void exec_barrier() +inline void exec_barrier() { threadgroup_barrier(mem_flags::mem_threadgroup); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/cfg-preserve-parameter.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/cfg-preserve-parameter.comp index d65beee5d..91fe5384d 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/cfg-preserve-parameter.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/cfg-preserve-parameter.comp @@ -5,7 +5,7 @@ using namespace metal; -void out_test_0(thread const int& cond, thread int& i) +inline void out_test_0(thread const int& cond, thread int& i) { if (cond == 0) { @@ -17,7 +17,7 @@ void out_test_0(thread const int& cond, thread int& i) } } -void out_test_1(thread const int& cond, thread int& i) +inline void out_test_1(thread const int& cond, thread int& i) { switch (cond) { @@ -34,7 +34,7 @@ void out_test_1(thread const int& cond, thread int& i) } } -void inout_test_0(thread const int& cond, thread int& i) +inline void inout_test_0(thread const int& cond, thread int& i) { if (cond == 0) { @@ -42,7 +42,7 @@ void inout_test_0(thread const int& cond, thread int& i) } } -void inout_test_1(thread const int& cond, thread int& i) +inline void inout_test_1(thread const int& cond, thread int& i) { switch (cond) { diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/complex-type-alias.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/complex-type-alias.comp index 9101f89b7..ad429cbf7 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/complex-type-alias.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/complex-type-alias.comp @@ -44,7 +44,7 @@ struct SSBO constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 8u, 1u); -void Zero(thread Foo0& v) +inline void Zero(thread Foo0& v) { v.a = 0.0; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.comp index ac10e7501..d4051beda 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/composite-array-initialization.comp @@ -29,20 +29,61 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u); constant Data _25[2] = { Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -Data combine(thread const Data& a, thread const Data& b) +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +inline Data combine(thread const Data& a, thread const Data& b) { return Data{ a.a + b.a, a.b + b.b }; } @@ -52,7 +93,7 @@ kernel void main0(device SSBO& _53 [[buffer(0)]], uint3 gl_WorkGroupID [[threadg Data data[2] = { Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } }; Data _31[2] = { Data{ X, 2.0 }, Data{ 3.0, 5.0 } }; Data data2[2]; - spvArrayCopyFromStack1(data2, _31); + spvArrayCopyFromStackToStack1(data2, _31); Data param = data[gl_LocalInvocationID.x]; Data param_1 = data2[gl_LocalInvocationID.x]; Data _73 = combine(param, param_1); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/composite-construct.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/composite-construct.comp index 4b5ea37e9..87fcfcd8d 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/composite-construct.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/composite-construct.comp @@ -23,24 +23,65 @@ struct Composite constant float4 _43[2] = { float4(20.0), float4(40.0) }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } kernel void main0(device SSBO0& _16 [[buffer(0)]], device SSBO1& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]]) { float4 _37[2] = { _16.as[gl_GlobalInvocationID.x], _32.bs[gl_GlobalInvocationID.x] }; float4 values[2]; - spvArrayCopyFromStack1(values, _37); + spvArrayCopyFromStackToStack1(values, _37); Composite c = Composite{ values[0], _43[1] }; _16.as[0] = values[gl_LocalInvocationIndex]; _32.bs[1] = c.b; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.comp index 0fa6c6bfd..e3b3660a8 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/copy-array-of-arrays.comp @@ -17,59 +17,172 @@ constant float _19[2] = { 3.0, 4.0 }; constant float _20[2][2] = { { 1.0, 2.0 }, { 3.0, 4.0 } }; constant float _21[2][2][2] = { { { 1.0, 2.0 }, { 3.0, 4.0 } }, { { 1.0, 2.0 }, { 3.0, 4.0 } } }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) -{ - for (uint i = 0; i < N; dst[i] = src[i], i++); -} - -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) -{ - for (uint i = 0; i < N; dst[i] = src[i], i++); -} - -template -void spvArrayCopyFromStack2(thread T (&dst)[A][B], thread const T (&src)[A][B]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { for (uint i = 0; i < A; i++) { - spvArrayCopyFromStack1(dst[i], src[i]); + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; } } template -void spvArrayCopyFromConstant2(thread T (&dst)[A][B], constant T (&src)[A][B]) +inline void spvArrayCopyFromConstantToStack2(thread T (&dst)[A][B], constant T (&src)[A][B]) { for (uint i = 0; i < A; i++) { - spvArrayCopyFromConstant1(dst[i], src[i]); + spvArrayCopyFromConstantToStack1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromConstantToThreadGroup2(threadgroup T (&dst)[A][B], constant T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromConstantToThreadGroup1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToStack2(thread T (&dst)[A][B], thread const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToStack1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup2(threadgroup T (&dst)[A][B], thread const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToThreadGroup1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack2(thread T (&dst)[A][B], threadgroup const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToStack1(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup2(threadgroup T (&dst)[A][B], threadgroup const T (&src)[A][B]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToThreadGroup1(dst[i], src[i]); } } template -void spvArrayCopyFromStack3(thread T (&dst)[A][B][C], thread const T (&src)[A][B][C]) +inline void spvArrayCopyFromConstantToStack3(thread T (&dst)[A][B][C], constant T (&src)[A][B][C]) { for (uint i = 0; i < A; i++) { - spvArrayCopyFromStack2(dst[i], src[i]); + spvArrayCopyFromConstantToStack2(dst[i], src[i]); } } template -void spvArrayCopyFromConstant3(thread T (&dst)[A][B][C], constant T (&src)[A][B][C]) +inline void spvArrayCopyFromConstantToThreadGroup3(threadgroup T (&dst)[A][B][C], constant T (&src)[A][B][C]) { for (uint i = 0; i < A; i++) { - spvArrayCopyFromConstant2(dst[i], src[i]); + spvArrayCopyFromConstantToThreadGroup2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToStack3(thread T (&dst)[A][B][C], thread const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToStack2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup3(threadgroup T (&dst)[A][B][C], thread const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromStackToThreadGroup2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack3(thread T (&dst)[A][B][C], threadgroup const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToStack2(dst[i], src[i]); + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup3(threadgroup T (&dst)[A][B][C], threadgroup const T (&src)[A][B][C]) +{ + for (uint i = 0; i < A; i++) + { + spvArrayCopyFromThreadGroupToThreadGroup2(dst[i], src[i]); } } kernel void main0(device BUF& o [[buffer(0)]]) { float c[2][2][2]; - spvArrayCopyFromConstant3(c, _21); + spvArrayCopyFromConstantToStack3(c, _21); o.a = int(c[1][1][1]); float _43[2] = { o.b, o.c }; float _48[2] = { o.b, o.b }; @@ -79,9 +192,9 @@ kernel void main0(device BUF& o [[buffer(0)]]) float _60[2][2] = { { _54[0], _54[1] }, { _59[0], _59[1] } }; float _61[2][2][2] = { { { _49[0][0], _49[0][1] }, { _49[1][0], _49[1][1] } }, { { _60[0][0], _60[0][1] }, { _60[1][0], _60[1][1] } } }; float d[2][2][2]; - spvArrayCopyFromStack3(d, _61); + spvArrayCopyFromStackToStack3(d, _61); float e[2][2][2]; - spvArrayCopyFromStack3(e, d); + spvArrayCopyFromStackToStack3(e, d); o.b = e[1][0][1]; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/functions.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/functions.comp index d8f6e55a4..947077879 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/functions.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/functions.comp @@ -5,7 +5,7 @@ using namespace metal; -void myfunc(threadgroup int (&foo)[1337]) +inline void myfunc(threadgroup int (&foo)[1337]) { foo[0] = 13; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp index 1b525c1f9..f398ef671 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/global-invocation-id-writable-ssbo-in-function.comp @@ -13,12 +13,12 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } -float getB(device myBlock& myStorage, thread uint3& gl_GlobalInvocationID) +inline float getB(device myBlock& myStorage, thread uint3& gl_GlobalInvocationID) { return myStorage.b[gl_GlobalInvocationID.x]; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/global-invocation-id.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/global-invocation-id.comp index fe0212ec3..9900b5931 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/global-invocation-id.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/global-invocation-id.comp @@ -13,7 +13,7 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/inverse.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/inverse.comp index f2f499b91..3ea692fab 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/inverse.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/inverse.comp @@ -33,7 +33,7 @@ inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float4x4 spvInverse4x4(float4x4 m) +inline float4x4 spvInverse4x4(float4x4 m) { float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) @@ -68,7 +68,7 @@ float4x4 spvInverse4x4(float4x4 m) // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float3x3 spvInverse3x3(float3x3 m) +inline float3x3 spvInverse3x3(float3x3 m) { float3x3 adj; // The adjoint matrix (inverse after dividing by determinant) @@ -95,7 +95,7 @@ float3x3 spvInverse3x3(float3x3 m) // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float2x2 spvInverse2x2(float2x2 m) +inline float2x2 spvInverse2x2(float2x2 m) { float2x2 adj; // The adjoint matrix (inverse after dividing by determinant) diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/local-invocation-id.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/local-invocation-id.comp index 772e5e0d8..362aaa30c 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/local-invocation-id.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/local-invocation-id.comp @@ -13,7 +13,7 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/local-invocation-index.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/local-invocation-index.comp index 41adbdca5..f8c1550ea 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/local-invocation-index.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/local-invocation-index.comp @@ -13,7 +13,7 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/mod.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/mod.comp index e0d290259..82d288f80 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/mod.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/mod.comp @@ -17,7 +17,7 @@ struct SSBO2 // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/shared-array-of-arrays.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/shared-array-of-arrays.comp index 7acb0ab85..510297802 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/shared-array-of-arrays.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/shared-array-of-arrays.comp @@ -12,7 +12,7 @@ struct SSBO constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(4u, 4u, 1u); -void work(threadgroup float (&foo)[4][4], thread uint3& gl_LocalInvocationID, thread uint& gl_LocalInvocationIndex, device SSBO& v_67, thread uint3& gl_GlobalInvocationID) +inline void work(threadgroup float (&foo)[4][4], thread uint3& gl_LocalInvocationID, thread uint& gl_LocalInvocationIndex, device SSBO& v_67, thread uint3& gl_GlobalInvocationID) { foo[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = float(gl_LocalInvocationIndex); threadgroup_barrier(mem_flags::mem_threadgroup); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/type-alias.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/type-alias.comp index 25a49f59f..a1bd93361 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/type-alias.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/type-alias.comp @@ -40,12 +40,12 @@ struct SSBO2 float4 outputs[1]; }; -float4 overload(thread const S0& s0) +inline float4 overload(thread const S0& s0) { return s0.a; } -float4 overload(thread const S1& s1) +inline float4 overload(thread const S1& s1) { return s1.a; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/comp/writable-ssbo.comp b/3rdparty/spirv-cross/reference/shaders-msl/comp/writable-ssbo.comp index 9dc53b6dd..dcec81a36 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/comp/writable-ssbo.comp +++ b/3rdparty/spirv-cross/reference/shaders-msl/comp/writable-ssbo.comp @@ -13,7 +13,7 @@ struct myBlock // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc b/3rdparty/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc index 9acece62c..3da718142 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc +++ b/3rdparty/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc @@ -20,7 +20,7 @@ struct main0_in float4 gl_Position [[attribute(0)]]; }; -void set_position(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup main0_in* thread & gl_in) +inline void set_position(device main0_out* thread & gl_out, thread uint& gl_InvocationID, threadgroup main0_in* thread & gl_in) { gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert b/3rdparty/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert index 1d203ba98..a32c1948f 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/desktop-only/vert/shader-draw-parameters.desktop.vert @@ -11,7 +11,7 @@ struct main0_out vertex main0_out main0(uint gl_BaseVertex [[base_vertex]], uint gl_BaseInstance [[base_instance]]) { main0_out out = {}; - out.gl_Position = float4(float(gl_BaseVertex), float(gl_BaseInstance), 0.0, 1.0); + out.gl_Position = float4(float(int(gl_BaseVertex)), float(int(gl_BaseInstance)), 0.0, 1.0); return out; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag index 1cf972771..7092dfdbd 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag @@ -62,7 +62,7 @@ struct main0_in float2 vUV [[user(locn0)]]; }; -float4 sample_in_function2(thread texture2d uTexture, thread const sampler uTextureSmplr, thread float2& vUV, thread const array, 4> uTexture2, thread const array uSampler, thread const array, 2> uTextures, thread const array uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers) +inline float4 sample_in_function2(thread texture2d uTexture, thread const sampler uTextureSmplr, thread float2& vUV, thread const array, 4> uTexture2, thread const array uSampler, thread const array, 2> uTextures, thread const array uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers) { float4 ret = uTexture.sample(uTextureSmplr, vUV); ret += uTexture2[2].sample(uSampler[1], vUV); @@ -73,7 +73,7 @@ float4 sample_in_function2(thread texture2d uTexture, thread const sample return ret; } -float4 sample_in_function(thread texture2d uTexture, thread const sampler uTextureSmplr, thread float2& vUV, thread const array, 4> uTexture2, thread const array uSampler, thread const array, 2> uTextures, thread const array uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers, constant UBO& v_90, constant UBOs* constant (&ubos)[4]) +inline float4 sample_in_function(thread texture2d uTexture, thread const sampler uTextureSmplr, thread float2& vUV, thread const array, 4> uTexture2, thread const array uSampler, thread const array, 2> uTextures, thread const array uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers, constant UBO& v_90, constant UBOs* constant (&ubos)[4]) { float4 ret = sample_in_function2(uTexture, uTextureSmplr, vUV, uTexture2, uSampler, uTextures, uTexturesSmplr, v_60, ssbos, registers); ret += v_90.ubo; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag index 702409ee7..6578bab1c 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag @@ -142,17 +142,17 @@ inline vec spvGatherCompareSwizzle(sampler s, const thread Tex& t, Ts... p return t.gather_compare(s, spvForward(params)...); } -float4 sample_in_func_1(thread const array, 4> uSampler0, thread const array uSampler0Smplr, constant uint* uSampler0Swzl, thread float2& vUV) +inline float4 sample_in_func_1(thread const array, 4> uSampler0, thread const array uSampler0Smplr, constant uint* uSampler0Swzl, thread float2& vUV) { return spvTextureSwizzle(uSampler0[2].sample(uSampler0Smplr[2], vUV), uSampler0Swzl[2]); } -float4 sample_in_func_2(thread float2& vUV, thread texture2d uSampler1, thread const sampler uSampler1Smplr, constant uint& uSampler1Swzl) +inline float4 sample_in_func_2(thread float2& vUV, thread texture2d uSampler1, thread const sampler uSampler1Smplr, constant uint& uSampler1Swzl) { return spvTextureSwizzle(uSampler1.sample(uSampler1Smplr, vUV), uSampler1Swzl); } -float4 sample_single_in_func(thread const texture2d s, thread const sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +inline float4 sample_single_in_func(thread const texture2d s, thread const sampler sSmplr, constant uint& sSwzl, thread float2& vUV) { return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag index ebaa28a57..55632d1d5 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag @@ -135,12 +135,12 @@ inline vec spvGatherCompareSwizzle(sampler s, const thread Tex& t, Ts... p return t.gather_compare(s, spvForward(params)...); } -float4 sample_in_func(thread const array, 4> uSampler, thread const array uSamplerSmplr, constant uint* uSamplerSwzl, thread float2& vUV) +inline float4 sample_in_func(thread const array, 4> uSampler, thread const array uSamplerSmplr, constant uint* uSamplerSwzl, thread float2& vUV) { return spvTextureSwizzle(uSampler[2].sample(uSamplerSmplr[2], vUV), uSamplerSwzl[2]); } -float4 sample_single_in_func(thread const texture2d s, thread const sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +inline float4 sample_single_in_func(thread const texture2d s, thread const sampler sSmplr, constant uint& sSwzl, thread float2& vUV) { return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/buffer-read-write.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/buffer-read-write.frag index 2b2ac7f06..36b1a1809 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/buffer-read-write.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/buffer-read-write.frag @@ -11,7 +11,7 @@ struct main0_out }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/constant-array.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/constant-array.frag index c4e87d987..0950d23d9 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/constant-array.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/constant-array.frag @@ -27,7 +27,7 @@ struct main0_in int index [[user(locn0)]]; }; -float4 resolve(thread const Foobar& f) +inline float4 resolve(thread const Foobar& f) { return float4(f.a + f.b); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/constant-composites.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/constant-composites.frag index 504beaa06..ccaac97bc 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/constant-composites.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/constant-composites.frag @@ -24,17 +24,58 @@ struct main0_in int line [[user(locn0)]]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } fragment main0_out main0(main0_in in [[stage_in]]) diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/flush_params.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/flush_params.frag index e2f2a48cb..ef3b688b4 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/flush_params.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/flush_params.frag @@ -15,12 +15,12 @@ struct main0_out float4 FragColor [[color(0)]]; }; -void foo2(thread Structy& f) +inline void foo2(thread Structy& f) { f.c = float4(10.0); } -Structy foo() +inline Structy foo() { Structy param; foo2(param); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/fp16.desktop.invalid.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/fp16.desktop.invalid.frag index 55be16a0b..4791a0bb8 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/fp16.desktop.invalid.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/fp16.desktop.invalid.frag @@ -21,36 +21,36 @@ struct main0_in // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } // Implementation of the GLSL radians() function template -T radians(T d) +inline T radians(T d) { return d * T(0.01745329251); } // Implementation of the GLSL degrees() function template -T degrees(T r) +inline T degrees(T r) { return r * T(57.2957795131); } -half2x2 test_mat2(thread const half2& a, thread const half2& b, thread const half2& c, thread const half2& d) +inline half2x2 test_mat2(thread const half2& a, thread const half2& b, thread const half2& c, thread const half2& d) { return half2x2(half2(a), half2(b)) * half2x2(half2(c), half2(d)); } -half3x3 test_mat3(thread const half3& a, thread const half3& b, thread const half3& c, thread const half3& d, thread const half3& e, thread const half3& f) +inline half3x3 test_mat3(thread const half3& a, thread const half3& b, thread const half3& c, thread const half3& d, thread const half3& e, thread const half3& f) { return half3x3(half3(a), half3(b), half3(c)) * half3x3(half3(d), half3(e), half3(f)); } -void test_constants() +inline void test_constants() { half a = half(1.0); half b = half(1.5); @@ -62,12 +62,12 @@ void test_constants() half h = half(9.5367431640625e-07); } -half test_result() +inline half test_result() { return half(1.0); } -void test_conversions() +inline void test_conversions() { half one = test_result(); int a = int(one); @@ -80,7 +80,7 @@ void test_conversions() half d2 = half(d); } -void test_builtins(thread half4& v4, thread half3& v3, thread half& v1) +inline void test_builtins(thread half4& v4, thread half3& v3, thread half& v1) { half4 res = radians(v4); res = degrees(v4); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/fragment-component-padding.pad-fragment.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/fragment-component-padding.pad-fragment.frag index 2d339c473..58bafc9e5 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/fragment-component-padding.pad-fragment.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/fragment-component-padding.pad-fragment.frag @@ -18,7 +18,7 @@ struct main0_in float3 vColor [[user(locn0)]]; }; -void set_globals(thread float (&FragColors)[2], thread float3& vColor, thread float2& FragColor2, thread float3& FragColor3) +inline void set_globals(thread float (&FragColors)[2], thread float3& vColor, thread float2& FragColor2, thread float3& FragColor3) { FragColors[0] = vColor.x; FragColors[1] = vColor.y; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/helper-invocation.msl21.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/helper-invocation.msl21.frag index 8d32f4860..bc2b17c7f 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/helper-invocation.msl21.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/helper-invocation.msl21.frag @@ -15,7 +15,7 @@ struct main0_in float2 vUV [[user(locn0)]]; }; -float4 foo(thread bool& gl_HelperInvocation, thread texture2d uSampler, thread const sampler uSamplerSmplr, thread float2& vUV) +inline float4 foo(thread bool& gl_HelperInvocation, thread texture2d uSampler, thread const sampler uSamplerSmplr, thread float2& vUV) { float4 color; if (!gl_HelperInvocation) diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/image-query-lod.msl22.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/image-query-lod.msl22.frag index 4ec61c24d..430744274 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/image-query-lod.msl22.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/image-query-lod.msl22.frag @@ -15,7 +15,7 @@ struct main0_in float3 vUV [[user(locn0)]]; }; -void from_function(thread float2& FragColor, thread texture2d uSampler2D, thread const sampler uSampler2DSmplr, thread float3& vUV, thread texture3d uSampler3D, thread const sampler uSampler3DSmplr, thread texturecube uSamplerCube, thread const sampler uSamplerCubeSmplr, thread texture2d uTexture2D, thread sampler uSampler, thread texture3d uTexture3D, thread texturecube uTextureCube) +inline void from_function(thread float2& FragColor, thread texture2d uSampler2D, thread const sampler uSampler2DSmplr, thread float3& vUV, thread texture3d uSampler3D, thread const sampler uSampler3DSmplr, thread texturecube uSamplerCube, thread const sampler uSamplerCubeSmplr, thread texture2d uTexture2D, thread sampler uSampler, thread texture3d uTexture3D, thread texturecube uTextureCube) { float2 _22; _22.x = uSampler2D.calculate_clamped_lod(uSampler2DSmplr, vUV.xy); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.frag index d38712e91..80dd6d665 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/input-attachment-ms.frag @@ -10,7 +10,7 @@ struct main0_out float4 FragColor [[color(0)]]; }; -float4 load_subpasses(thread const texture2d_ms uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord) +inline float4 load_subpasses(thread const texture2d_ms uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord) { return uInput.read(uint2(gl_FragCoord.xy), gl_SampleID); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/input-attachment.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/input-attachment.frag index 3cc929182..722472269 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/input-attachment.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/input-attachment.frag @@ -10,7 +10,7 @@ struct main0_out float4 FragColor [[color(0)]]; }; -float4 load_subpasses(thread const texture2d uInput, thread float4& gl_FragCoord) +inline float4 load_subpasses(thread const texture2d uInput, thread float4& gl_FragCoord) { return uInput.read(uint2(gl_FragCoord.xy), 0); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/lut-promotion.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/lut-promotion.frag index f7e51edb8..1af7f872b 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/lut-promotion.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/lut-promotion.frag @@ -19,17 +19,58 @@ struct main0_in int index [[user(locn0)]]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } fragment main0_out main0(main0_in in [[stage_in]]) @@ -59,7 +100,7 @@ fragment main0_out main0(main0_in in [[stage_in]]) } out.FragColor += foobar[in.index & 3].z; float4 baz[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) }; - spvArrayCopyFromConstant1(baz, _104); + spvArrayCopyFromConstantToStack1(baz, _104); out.FragColor += baz[in.index & 3].z; return out; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/mrt-array.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/mrt-array.frag index daf7edb4c..1cd06a292 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/mrt-array.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/mrt-array.frag @@ -21,17 +21,17 @@ struct main0_in // Implementation of the GLSL mod() function, which is slightly different than Metal fmod() template -Tx mod(Tx x, Ty y) +inline Tx mod(Tx x, Ty y) { return x - y * floor(x / y); } -void write_deeper_in_function(thread float4 (&FragColor)[4], thread float4& vA, thread float4& vB) +inline void write_deeper_in_function(thread float4 (&FragColor)[4], thread float4& vA, thread float4& vB) { FragColor[3] = vA * vB; } -void write_in_function(thread float4 (&FragColor)[4], thread float4& vA, thread float4& vB) +inline void write_in_function(thread float4 (&FragColor)[4], thread float4& vA, thread float4& vB) { FragColor[2] = vA - vB; write_deeper_in_function(FragColor, vA, vB); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/packing-test-3.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/packing-test-3.frag index d8310d6ac..172186188 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/packing-test-3.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/packing-test-3.frag @@ -32,7 +32,7 @@ struct main0_out float4 _entryPointOutput [[color(0)]]; }; -float4 _main(thread const VertexOutput& IN, constant CB0& v_26) +inline float4 _main(thread const VertexOutput& IN, constant CB0& v_26) { TestStruct st; st.position = float3(v_26.CB0[1].position); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/private-variable-prototype-declaration.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/private-variable-prototype-declaration.frag index d014623bc..c5462ee31 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/private-variable-prototype-declaration.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/private-variable-prototype-declaration.frag @@ -15,12 +15,12 @@ struct main0_out float3 FragColor [[color(0)]]; }; -void someFunction(thread AStruct& s) +inline void someFunction(thread AStruct& s) { s.foobar = float4(1.0); } -void otherFunction(thread float3& global_variable) +inline void otherFunction(thread float3& global_variable) { global_variable = float3(1.0); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/readonly-ssbo.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/readonly-ssbo.frag index 771c225d6..439f14c17 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/readonly-ssbo.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/readonly-ssbo.frag @@ -15,7 +15,7 @@ struct main0_out float4 FragColor [[color(0)]]; }; -float4 read_from_function(const device SSBO& v_13) +inline float4 read_from_function(const device SSBO& v_13) { return v_13.v; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag index a9c0f8b41..ce87db5ab 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag @@ -10,12 +10,12 @@ struct main0_out float FragColor [[color(0)]]; }; -float sample_depth_from_function(thread const depth2d uT, thread const sampler uS) +inline float sample_depth_from_function(thread const depth2d uT, thread const sampler uS) { return uT.sample_compare(uS, float3(0.5).xy, float3(0.5).z); } -float sample_color_from_function(thread const texture2d uT, thread const sampler uS) +inline float sample_color_from_function(thread const texture2d uT, thread const sampler uS) { return uT.sample(uS, float2(0.5)).x; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/sample-position-func.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/sample-position-func.frag index 06fa53063..e95d5bfb0 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/sample-position-func.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/sample-position-func.frag @@ -15,7 +15,7 @@ struct main0_in int index [[user(locn0)]]; }; -float4 getColor(thread const int& i, thread float2& gl_SamplePosition) +inline float4 getColor(thread const int& i, thread float2& gl_SamplePosition) { return float4(gl_SamplePosition, float(i), 1.0); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag index 10a771626..a500dfeb2 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag @@ -16,17 +16,17 @@ struct main0_in int vIndex [[user(locn1)]]; }; -float4 sample_from_global(thread int& vIndex, thread float2& vTex, thread const array, 4> uSampler, thread const array uSamplerSmplr) +inline float4 sample_from_global(thread int& vIndex, thread float2& vTex, thread const array, 4> uSampler, thread const array uSamplerSmplr) { return uSampler[vIndex].sample(uSamplerSmplr[vIndex], (vTex + float2(0.100000001490116119384765625))); } -float4 sample_from_argument(thread const array, 4> samplers, thread const array samplersSmplr, thread int& vIndex, thread float2& vTex) +inline float4 sample_from_argument(thread const array, 4> samplers, thread const array samplersSmplr, thread int& vIndex, thread float2& vTex) { return samplers[vIndex].sample(samplersSmplr[vIndex], (vTex + float2(0.20000000298023223876953125))); } -float4 sample_single_from_argument(thread const texture2d samp, thread const sampler sampSmplr, thread float2& vTex) +inline float4 sample_single_from_argument(thread const texture2d samp, thread const sampler sampSmplr, thread float2& vTex) { return samp.sample(sampSmplr, (vTex + float2(0.300000011920928955078125))); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/sampler.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/sampler.frag index 395854699..86917ea08 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/sampler.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/sampler.frag @@ -16,7 +16,7 @@ struct main0_in float2 vTex [[user(locn1)]]; }; -float4 sample_texture(thread const texture2d tex, thread const sampler texSmplr, thread const float2& uv) +inline float4 sample_texture(thread const texture2d tex, thread const sampler texSmplr, thread const float2& uv) { return tex.sample(texSmplr, uv); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/separate-image-sampler-argument.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/separate-image-sampler-argument.frag index 46c0524ab..7f7e0bd17 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/separate-image-sampler-argument.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/separate-image-sampler-argument.frag @@ -10,7 +10,7 @@ struct main0_out float4 FragColor [[color(0)]]; }; -float4 samp(thread const texture2d t, thread const sampler s) +inline float4 samp(thread const texture2d t, thread const sampler s) { return t.sample(s, float2(0.5)); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/shader-arithmetic-8bit.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/shader-arithmetic-8bit.frag index 28ef04372..76f2d9b9f 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/shader-arithmetic-8bit.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/shader-arithmetic-8bit.frag @@ -34,7 +34,7 @@ struct main0_in int4 vColor [[user(locn0)]]; }; -void packing_int8(device SSBO& ssbo) +inline void packing_int8(device SSBO& ssbo) { short i16 = 10; int i32 = 20; @@ -48,7 +48,7 @@ void packing_int8(device SSBO& ssbo) ssbo.i8[3] = i8_4.w; } -void packing_uint8(device SSBO& ssbo) +inline void packing_uint8(device SSBO& ssbo) { ushort u16 = 10u; uint u32 = 20u; @@ -62,7 +62,7 @@ void packing_uint8(device SSBO& ssbo) ssbo.u8[3] = u8_4.w; } -void compute_int8(device SSBO& ssbo, thread int4& vColor, constant Push& registers, constant UBO& ubo, thread int4& FragColorInt) +inline void compute_int8(device SSBO& ssbo, thread int4& vColor, constant Push& registers, constant UBO& ubo, thread int4& FragColorInt) { char4 tmp = char4(vColor); tmp += char4(registers.i8); @@ -74,7 +74,7 @@ void compute_int8(device SSBO& ssbo, thread int4& vColor, constant Push& registe FragColorInt = int4(tmp); } -void compute_uint8(device SSBO& ssbo, thread int4& vColor, constant Push& registers, constant UBO& ubo, thread uint4& FragColorUint) +inline void compute_uint8(device SSBO& ssbo, thread int4& vColor, constant Push& registers, constant UBO& ubo, thread uint4& FragColorUint) { uchar4 tmp = uchar4(char4(vColor)); tmp += uchar4(registers.u8); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/shadow-compare-global-alias.invalid.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/shadow-compare-global-alias.invalid.frag index 4bd5d3209..fa0a10b0a 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/shadow-compare-global-alias.invalid.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/shadow-compare-global-alias.invalid.frag @@ -15,22 +15,22 @@ struct main0_in float3 vUV [[user(locn0)]]; }; -float Samp(thread const float3& uv, thread depth2d uTex, thread sampler uSamp) +inline float Samp(thread const float3& uv, thread depth2d uTex, thread sampler uSamp) { return uTex.sample_compare(uSamp, uv.xy, uv.z); } -float Samp2(thread const float3& uv, thread depth2d uSampler, thread const sampler uSamplerSmplr, thread float3& vUV) +inline float Samp2(thread const float3& uv, thread depth2d uSampler, thread const sampler uSamplerSmplr, thread float3& vUV) { return uSampler.sample_compare(uSamplerSmplr, vUV.xy, vUV.z); } -float Samp3(thread const depth2d uT, thread const sampler uS, thread const float3& uv, thread float3& vUV) +inline float Samp3(thread const depth2d uT, thread const sampler uS, thread const float3& uv, thread float3& vUV) { return uT.sample_compare(uS, vUV.xy, vUV.z); } -float Samp4(thread const depth2d uS, thread const sampler uSSmplr, thread const float3& uv, thread float3& vUV) +inline float Samp4(thread const depth2d uS, thread const sampler uSSmplr, thread const float3& uv, thread float3& vUV) { return uS.sample_compare(uSSmplr, vUV.xy, vUV.z); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/stencil-export.msl21.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/stencil-export.msl21.frag index eb85a2158..a4f11c896 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/stencil-export.msl21.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/stencil-export.msl21.frag @@ -12,7 +12,7 @@ struct main0_out uint gl_FragStencilRefARB [[stencil]]; }; -void update_stencil(thread uint& gl_FragStencilRefARB) +inline void update_stencil(thread uint& gl_FragStencilRefARB) { gl_FragStencilRefARB = uint(int(gl_FragStencilRefARB) + 10); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/frag/write-depth-in-function.frag b/3rdparty/spirv-cross/reference/shaders-msl/frag/write-depth-in-function.frag index 6837a9b3e..eab4ef4c5 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/frag/write-depth-in-function.frag +++ b/3rdparty/spirv-cross/reference/shaders-msl/frag/write-depth-in-function.frag @@ -11,7 +11,7 @@ struct main0_out float gl_FragDepth [[depth(any)]]; }; -void set_output_depth(thread float& gl_FragDepth) +inline void set_output_depth(thread float& gl_FragDepth) { gl_FragDepth = 0.20000000298023223876953125; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/tesc/water_tess.tesc b/3rdparty/spirv-cross/reference/shaders-msl/tesc/water_tess.tesc index e984509f2..596abe130 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/tesc/water_tess.tesc +++ b/3rdparty/spirv-cross/reference/shaders-msl/tesc/water_tess.tesc @@ -26,7 +26,7 @@ struct main0_in float2 vPatchPosBase [[attribute(0)]]; }; -bool frustum_cull(thread const float2& p0, constant UBO& v_41) +inline bool frustum_cull(thread const float2& p0, constant UBO& v_41) { float2 min_xz = (p0 - float2(10.0)) * v_41.uScale.xy; float2 max_xz = ((p0 + v_41.uPatchSize) + float2(10.0)) * v_41.uScale.xy; @@ -49,7 +49,7 @@ bool frustum_cull(thread const float2& p0, constant UBO& v_41) return !_215; } -float lod_factor(thread const float2& pos_, constant UBO& v_41) +inline float lod_factor(thread const float2& pos_, constant UBO& v_41) { float2 pos = pos_ * v_41.uScale.xy; float3 dist_to_cam = v_41.uCamPos - float3(pos.x, 0.0, pos.y); @@ -57,17 +57,17 @@ float lod_factor(thread const float2& pos_, constant UBO& v_41) return fast::clamp(level, 0.0, v_41.uMaxTessLevel.x); } -float4 tess_level(thread const float4& lod, constant UBO& v_41) +inline float4 tess_level(thread const float4& lod, constant UBO& v_41) { return exp2(-lod) * v_41.uMaxTessLevel.y; } -float tess_level(thread const float& lod, constant UBO& v_41) +inline float tess_level(thread const float& lod, constant UBO& v_41) { return v_41.uMaxTessLevel.y * exp2(-lod); } -void compute_tess_levels(thread const float2& p0, constant UBO& v_41, device float2& vOutPatchPosBase, device float4& vPatchLods, device half (&gl_TessLevelOuter)[4], device half (&gl_TessLevelInner)[2]) +inline void compute_tess_levels(thread const float2& p0, constant UBO& v_41, device float2& vOutPatchPosBase, device float4& vPatchLods, device half (&gl_TessLevelOuter)[4], device half (&gl_TessLevelInner)[2]) { vOutPatchPosBase = p0; float2 param = p0 + (float2(-0.5) * v_41.uPatchSize); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/tese/input-array.tese b/3rdparty/spirv-cross/reference/shaders-msl/tese/input-array.tese index 2ac5731fe..33ac58419 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/tese/input-array.tese +++ b/3rdparty/spirv-cross/reference/shaders-msl/tese/input-array.tese @@ -21,7 +21,7 @@ struct main0_patchIn patch_control_point gl_in; }; -void set_position(thread float4& gl_Position, thread patch_control_point& gl_in, thread float2& gl_TessCoord) +inline void set_position(thread float4& gl_Position, thread patch_control_point& gl_in, thread float2& gl_TessCoord) { gl_Position = (gl_in[0].Floats * gl_TessCoord.x) + (gl_in[1].Floats2 * gl_TessCoord.y); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/tese/input-types.tese b/3rdparty/spirv-cross/reference/shaders-msl/tese/input-types.tese index 9012a7e1a..6091434fc 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/tese/input-types.tese +++ b/3rdparty/spirv-cross/reference/shaders-msl/tese/input-types.tese @@ -47,7 +47,7 @@ struct main0_patchIn patch_control_point gl_in; }; -void set_from_function(thread float4& gl_Position, thread patch_control_point& gl_in, thread PatchBlock& patch_block, thread float4& vColors, thread Foo& vFoo) +inline void set_from_function(thread float4& gl_Position, thread patch_control_point& gl_in, thread PatchBlock& patch_block, thread float4& vColors, thread Foo& vFoo) { gl_Position = gl_in[0].Block_a; gl_Position += gl_in[0].Block_b; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/tese/quad.tese b/3rdparty/spirv-cross/reference/shaders-msl/tese/quad.tese index df3d260fa..9c4f2e271 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/tese/quad.tese +++ b/3rdparty/spirv-cross/reference/shaders-msl/tese/quad.tese @@ -16,7 +16,7 @@ struct main0_patchIn float4 gl_TessLevelOuter [[attribute(1)]]; }; -void set_position(thread float4& gl_Position, thread float2& gl_TessCoord, thread float2& gl_TessLevelInner, thread float4& gl_TessLevelOuter) +inline void set_position(thread float4& gl_Position, thread float2& gl_TessCoord, thread float2& gl_TessLevelInner, thread float4& gl_TessLevelOuter) { gl_Position = float4(((gl_TessCoord.x * gl_TessLevelInner.x) * gl_TessLevelOuter.x) + (((1.0 - gl_TessCoord.x) * gl_TessLevelInner.x) * gl_TessLevelOuter.z), ((gl_TessCoord.y * gl_TessLevelInner.y) * gl_TessLevelOuter.y) + (((1.0 - gl_TessCoord.y) * gl_TessLevelInner.y) * gl_TessLevelOuter.w), 0.0, 1.0); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/tese/set-from-function.tese b/3rdparty/spirv-cross/reference/shaders-msl/tese/set-from-function.tese index f6e41ee5c..f629878d3 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/tese/set-from-function.tese +++ b/3rdparty/spirv-cross/reference/shaders-msl/tese/set-from-function.tese @@ -37,7 +37,7 @@ struct main0_patchIn patch_control_point gl_in; }; -void set_from_function(thread float4& gl_Position, thread patch_control_point& gl_in, thread float4& vColors, thread Foo& vFoo) +inline void set_from_function(thread float4& gl_Position, thread patch_control_point& gl_in, thread float4& vColors, thread Foo& vFoo) { gl_Position = gl_in[0].Block_a; gl_Position += gl_in[0].Block_b; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/tese/water_tess.tese b/3rdparty/spirv-cross/reference/shaders-msl/tese/water_tess.tese index 9b6c0aca8..eb19dbfce 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/tese/water_tess.tese +++ b/3rdparty/spirv-cross/reference/shaders-msl/tese/water_tess.tese @@ -28,12 +28,12 @@ struct main0_patchIn float4 vPatchLods [[attribute(1)]]; }; -float2 lerp_vertex(thread const float2& tess_coord, thread float2& vOutPatchPosBase, constant UBO& v_31) +inline float2 lerp_vertex(thread const float2& tess_coord, thread float2& vOutPatchPosBase, constant UBO& v_31) { return vOutPatchPosBase + (tess_coord * v_31.uPatchSize); } -float2 lod_factor(thread const float2& tess_coord, thread float4& vPatchLods) +inline float2 lod_factor(thread const float2& tess_coord, thread float4& vPatchLods) { float2 x = mix(vPatchLods.yx, vPatchLods.zw, float2(tess_coord.x)); float level = mix(x.x, x.y, tess_coord.y); @@ -42,7 +42,7 @@ float2 lod_factor(thread const float2& tess_coord, thread float4& vPatchLods) return float2(floor_level, fract_level); } -float3 sample_height_displacement(thread const float2& uv, thread const float2& off, thread const float2& lod, thread texture2d uHeightmapDisplacement, thread const sampler uHeightmapDisplacementSmplr) +inline float3 sample_height_displacement(thread const float2& uv, thread const float2& off, thread const float2& lod, thread texture2d uHeightmapDisplacement, thread const sampler uHeightmapDisplacementSmplr) { return mix(uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, (uv + (off * 0.5)), level(lod.x)).xyz, uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, (uv + (off * 1.0)), level(lod.x + 1.0)).xyz, float3(lod.y)); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/functions.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/functions.vert index 9af0f3f35..7a598d48a 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/functions.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/functions.vert @@ -31,28 +31,28 @@ struct main0_in // Implementation of the GLSL radians() function template -T radians(T d) +inline T radians(T d) { return d * T(0.01745329251); } // Implementation of the GLSL degrees() function template -T degrees(T r) +inline T degrees(T r) { return r * T(57.2957795131); } // Implementation of the GLSL findLSB() function template -T spvFindLSB(T x) +inline T spvFindLSB(T x) { return select(ctz(x), T(-1), x == T(0)); } // Implementation of the signed GLSL findMSB() function template -T spvFindSMSB(T x) +inline T spvFindSMSB(T x) { T v = select(x, T(-1) - x, x < T(0)); return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0)); @@ -72,7 +72,7 @@ inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b // Returns the inverse of a matrix, by using the algorithm of calculating the classical // adjoint and dividing by the determinant. The contents of the matrix are changed. -float4x4 spvInverse4x4(float4x4 m) +inline float4x4 spvInverse4x4(float4x4 m) { float4x4 adj; // The adjoint matrix (inverse after dividing by determinant) diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/in_out_array_mat.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/in_out_array_mat.vert index 95be574a5..71b6ab3ab 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/in_out_array_mat.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/in_out_array_mat.vert @@ -38,13 +38,13 @@ struct main0_in float4 inViewMat_3 [[attribute(8)]]; }; -void write_deeper_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread float4 (&colors)[3]) +inline void write_deeper_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread float4 (&colors)[3]) { outTransModel[1].y = ubo.lodBias; color = colors[2]; } -void write_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread float4 (&colors)[3], thread float3& inNormal) +inline void write_in_function(thread float4x4& outTransModel, constant UBO& ubo, thread float4& color, thread float4 (&colors)[3], thread float3& inNormal) { outTransModel[2] = float4(inNormal, 1.0); write_deeper_in_function(outTransModel, ubo, color, colors); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/leaf-function.capture.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/leaf-function.capture.vert index 5a8469d1a..289d4ff55 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/leaf-function.capture.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/leaf-function.capture.vert @@ -22,7 +22,7 @@ struct main0_in float3 aNormal [[attribute(1)]]; }; -void set_output(device float4& gl_Position, constant UBO& v_18, thread float4& aVertex, device float3& vNormal, thread float3& aNormal) +inline void set_output(device float4& gl_Position, constant UBO& v_18, thread float4& aVertex, device float3& vNormal, thread float3& aNormal) { gl_Position = v_18.uMVP * aVertex; vNormal = aNormal; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert index 28098ee88..30613cc4b 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/no_stage_out.vert @@ -15,6 +15,6 @@ struct main0_in vertex void main0(main0_in in [[stage_in]], device _10& _12 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) { - _12._m0[gl_VertexIndex] = in.m_19; + _12._m0[int(gl_VertexIndex)] = in.m_19; } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/read-from-row-major-array.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/read-from-row-major-array.vert index 2d322a69d..35af2e99f 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/read-from-row-major-array.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/read-from-row-major-array.vert @@ -21,12 +21,12 @@ struct main0_in float4 a_position [[attribute(0)]]; }; -float compare_float(thread const float& a, thread const float& b) +inline float compare_float(thread const float& a, thread const float& b) { return float(abs(a - b) < 0.0500000007450580596923828125); } -float compare_vec3(thread const float3& a, thread const float3& b) +inline float compare_vec3(thread const float3& a, thread const float3& b) { float param = a.x; float param_1 = b.x; @@ -37,7 +37,7 @@ float compare_vec3(thread const float3& a, thread const float3& b) return (compare_float(param, param_1) * compare_float(param_2, param_3)) * compare_float(param_4, param_5); } -float compare_mat2x3(thread const float2x3& a, thread const float2x3& b) +inline float compare_mat2x3(thread const float2x3& a, thread const float2x3& b) { float3 param = a[0]; float3 param_1 = b[0]; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert index 97e97e6fd..d23edacb2 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert @@ -22,7 +22,7 @@ struct constant_block #endif constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0; -void doWork(device storage_block* (&storage)[2], constant constant_block* (&constants)[4], thread const array, 3> images) +inline void doWork(device storage_block* (&storage)[2], constant constant_block* (&constants)[4], thread const array, 3> images) { storage[0]->baz = uint4(constants[3]->foo); storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy; diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/return-array.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/return-array.vert index cd06fddaa..0833388ac 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/return-array.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/return-array.vert @@ -18,30 +18,71 @@ struct main0_in float4 vInput1 [[attribute(1)]]; }; -// Implementation of an array copy function to cover GLSL's ability to copy an array via assignment. -template -void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N]) +template +inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -template -void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N]) +template +inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A]) { - for (uint i = 0; i < N; dst[i] = src[i], i++); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -void test(thread float4 (&SPIRV_Cross_return_value)[2]) +template +inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A]) { - spvArrayCopyFromConstant1(SPIRV_Cross_return_value, _20); + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } } -void test2(thread float4 (&SPIRV_Cross_return_value)[2], thread float4& vInput0, thread float4& vInput1) +template +inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +template +inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A]) +{ + for (uint i = 0; i < A; i++) + { + dst[i] = src[i]; + } +} + +inline void test(thread float4 (&SPIRV_Cross_return_value)[2]) +{ + spvArrayCopyFromConstantToStack1(SPIRV_Cross_return_value, _20); +} + +inline void test2(thread float4 (&SPIRV_Cross_return_value)[2], thread float4& vInput0, thread float4& vInput1) { float4 foobar[2]; foobar[0] = vInput0; foobar[1] = vInput1; - spvArrayCopyFromStack1(SPIRV_Cross_return_value, foobar); + spvArrayCopyFromStackToStack1(SPIRV_Cross_return_value, foobar); } vertex main0_out main0(main0_in in [[stage_in]]) diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/set_builtin_in_func.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/set_builtin_in_func.vert index 2952748dc..54c4cedb8 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/set_builtin_in_func.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/set_builtin_in_func.vert @@ -11,7 +11,7 @@ struct main0_out float gl_PointSize [[point_size]]; }; -void write_outblock(thread float4& gl_Position, thread float& gl_PointSize) +inline void write_outblock(thread float4& gl_Position, thread float& gl_PointSize) { gl_PointSize = 1.0; gl_Position = float4(gl_PointSize); diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/sign-int-types.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/sign-int-types.vert index 2f518b129..a51064522 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/sign-int-types.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/sign-int-types.vert @@ -38,7 +38,7 @@ struct main0_in // Implementation of the GLSL sign() function for integer types template::value>::type> -T sign(T x) +inline T sign(T x) { return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0)); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vert/texture_buffer.vert b/3rdparty/spirv-cross/reference/shaders-msl/vert/texture_buffer.vert index ee3956fad..677a2f8fd 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vert/texture_buffer.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vert/texture_buffer.vert @@ -11,7 +11,7 @@ struct main0_out }; // Returns 2D texture coords corresponding to 1D texel buffer coords -uint2 spvTexelBufferCoord(uint tc) +inline uint2 spvTexelBufferCoord(uint tc) { return uint2(tc % 4096, tc / 4096); } diff --git a/3rdparty/spirv-cross/reference/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert b/3rdparty/spirv-cross/reference/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert index 53e26e4a8..86a0cea5b 100644 --- a/3rdparty/spirv-cross/reference/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert +++ b/3rdparty/spirv-cross/reference/shaders-msl/vulkan/vert/vulkan-vertex.vk.vert @@ -11,7 +11,7 @@ struct main0_out vertex main0_out main0(uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) { main0_out out = {}; - out.gl_Position = float4(1.0, 2.0, 3.0, 4.0) * float(gl_VertexIndex + gl_InstanceIndex); + out.gl_Position = float4(1.0, 2.0, 3.0, 4.0) * float(int(gl_VertexIndex) + int(gl_InstanceIndex)); return out; } diff --git a/3rdparty/spirv-cross/reference/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/3rdparty/spirv-cross/reference/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 000000000..f535ba7f4 --- /dev/null +++ b/3rdparty/spirv-cross/reference/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,27 @@ +#version 450 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer SSBO +{ + ivec4 ints; + uvec4 uints; +} _3; + +void main() +{ + ivec4 _19 = _3.ints; + uvec4 _20 = _3.uints; + _3.ints = bitCount(_19); + _3.uints = uvec4(bitCount(_19)); + _3.ints = bitCount(_20); + _3.uints = uvec4(bitCount(_20)); + _3.ints = bitfieldReverse(_19); + _3.uints = bitfieldReverse(_20); + _3.ints = bitfieldExtract(_19, 1, int(11u)); + _3.uints = uvec4(bitfieldExtract(ivec4(_20), int(11u), 1)); + _3.ints = ivec4(bitfieldExtract(uvec4(_19), 1, int(11u))); + _3.uints = bitfieldExtract(_20, int(11u), 1); + _3.ints = bitfieldInsert(_19, _19.wzyx, 1, int(11u)); + _3.uints = bitfieldInsert(_20, _20.wzyx, int(11u), 1); +} + diff --git a/3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.frag b/3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.frag new file mode 100644 index 000000000..5fa822b39 --- /dev/null +++ b/3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.frag @@ -0,0 +1,28 @@ +#version 310 es +precision mediump float; +precision highp int; + +struct PSInput +{ + highp vec4 color; + highp vec2 uv; +}; + +uniform mediump sampler2D SPIRV_Cross_CombinedtexSamp; + +layout(location = 0) in highp vec4 in_var_COLOR; +layout(location = 1) in highp vec2 in_var_TEXCOORD0; +layout(location = 0) out highp vec4 out_var_SV_TARGET; + +highp vec4 src_PSMain(PSInput _input) +{ + vec4 a = _input.color * texture(SPIRV_Cross_CombinedtexSamp, _input.uv); + return a; +} + +void main() +{ + PSInput param_var_input = PSInput(in_var_COLOR, in_var_TEXCOORD0); + out_var_SV_TARGET = src_PSMain(param_var_input); +} + diff --git a/3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag b/3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag new file mode 100644 index 000000000..9acdd0196 --- /dev/null +++ b/3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag @@ -0,0 +1,11 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out highp vec4 _GLF_color; + +void main() +{ + _GLF_color = ldexp(vec4(1.0), ivec4(uvec4(bitCount(uvec4(1u))))); +} + diff --git a/3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag b/3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag new file mode 100644 index 000000000..66ac130d9 --- /dev/null +++ b/3rdparty/spirv-cross/reference/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag @@ -0,0 +1,29 @@ +#version 310 es +precision mediump float; +precision highp int; + +layout(location = 0) out highp vec4 _GLF_color; + +vec2 _19; + +void main() +{ + highp vec2 _30; + switch (0) + { + default: + { + if (gl_FragCoord.x != gl_FragCoord.x) + { + _30 = _19; + break; + } + highp vec2 _29 = _19; + _29.y = _19.y; + _30 = _29; + break; + } + } + _GLF_color = vec4(_30, 1.0, 1.0); +} + diff --git a/3rdparty/spirv-cross/reference/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp b/3rdparty/spirv-cross/reference/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp index 9266982b7..4f8d2ffa7 100644 --- a/3rdparty/spirv-cross/reference/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp +++ b/3rdparty/spirv-cross/reference/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp @@ -14,7 +14,6 @@ void main() { break; } - continue; } imageStore(outImageTexture, ivec2(gl_GlobalInvocationID.xy), vec4(float(_30 - 1), float(_30), 1.0, 1.0)); } diff --git a/3rdparty/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag b/3rdparty/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag index feb45db44..310114294 100644 --- a/3rdparty/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders/asm/frag/for-loop-phi-only-continue.asm.frag @@ -12,7 +12,6 @@ void main() { _20 = _19 + 1.0; _23 = _22 + 1; - continue; } FragColor = vec4(_19); } diff --git a/3rdparty/spirv-cross/reference/shaders/asm/frag/op-phi-swap-continue-block.asm.frag b/3rdparty/spirv-cross/reference/shaders/asm/frag/op-phi-swap-continue-block.asm.frag index 3dae3e161..d62b63a0e 100644 --- a/3rdparty/spirv-cross/reference/shaders/asm/frag/op-phi-swap-continue-block.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders/asm/frag/op-phi-swap-continue-block.asm.frag @@ -18,7 +18,6 @@ void main() _24 = _5.uJ; for (int _26 = 0; _26 < _5.uCount; _23_copy = _23, _23 = _24, _24 = _23_copy, _26++) { - continue; } FragColor = float(_24 - _23) * float(_5.uJ * _5.uK); } diff --git a/3rdparty/spirv-cross/reference/shaders/asm/frag/selection-merge-to-continue.asm.frag b/3rdparty/spirv-cross/reference/shaders/asm/frag/selection-merge-to-continue.asm.frag index 82b5973f8..edbce0cca 100644 --- a/3rdparty/spirv-cross/reference/shaders/asm/frag/selection-merge-to-continue.asm.frag +++ b/3rdparty/spirv-cross/reference/shaders/asm/frag/selection-merge-to-continue.asm.frag @@ -11,12 +11,10 @@ void main() if (v0.x == 20.0) { FragColor += vec4(v0[i & 3]); - continue; } else { FragColor += vec4(v0[i & 1]); - continue; } } } diff --git a/3rdparty/spirv-cross/reference/shaders/frag/post-depth-coverage-es.frag b/3rdparty/spirv-cross/reference/shaders/frag/post-depth-coverage-es.frag new file mode 100644 index 000000000..d086560e5 --- /dev/null +++ b/3rdparty/spirv-cross/reference/shaders/frag/post-depth-coverage-es.frag @@ -0,0 +1,14 @@ +#version 310 es +#extension GL_EXT_post_depth_coverage : require +#extension GL_OES_sample_variables : require +precision mediump float; +precision highp int; +layout(early_fragment_tests, post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(float(gl_SampleMaskIn[0])); +} + diff --git a/3rdparty/spirv-cross/reference/shaders/frag/post-depth-coverage.frag b/3rdparty/spirv-cross/reference/shaders/frag/post-depth-coverage.frag index 3e78fcd0a..caca9c03c 100644 --- a/3rdparty/spirv-cross/reference/shaders/frag/post-depth-coverage.frag +++ b/3rdparty/spirv-cross/reference/shaders/frag/post-depth-coverage.frag @@ -1,5 +1,9 @@ #version 450 +#if defined(GL_ARB_post_depth_coverge) #extension GL_ARB_post_depth_coverage : require +#else +#extension GL_EXT_post_depth_coverage : require +#endif layout(early_fragment_tests, post_depth_coverage) in; layout(location = 0) out vec4 FragColor; diff --git a/3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 000000000..435fa3222 --- /dev/null +++ b/3rdparty/spirv-cross/shaders-hlsl-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "ints" + OpMemberName %SSBO 1 "uints" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + + %int_1 = OpConstant %int 1 + %uint_11 = OpConstant %uint 11 + + %SSBO = OpTypeStruct %v4int %v4uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0 + %uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1 + %ints = OpLoad %v4int %ints_ptr + %uints = OpLoad %v4uint %uints_ptr + + %ints_alt = OpVectorShuffle %v4int %ints %ints 3 2 1 0 + %uints_alt = OpVectorShuffle %v4uint %uints %uints 3 2 1 0 + + %int_to_int_popcount = OpBitCount %v4int %ints + %int_to_uint_popcount = OpBitCount %v4uint %ints + %uint_to_int_popcount = OpBitCount %v4int %uints + %uint_to_uint_popcount = OpBitCount %v4uint %uints + + ; BitReverse must have matching types w.r.t. sign, yay. + %int_to_int_reverse = OpBitReverse %v4int %ints + ;%int_to_uint_reverse = OpBitReverse %v4uint %ints + ;%uint_to_int_reverse = OpBitReverse %v4int %uints + %uint_to_uint_reverse = OpBitReverse %v4uint %uints + + ; Base and Result must match. + %int_to_int_sbit = OpBitFieldSExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_sbit = OpBitFieldSExtract %v4uint %ints %offset %count + ;%uint_to_int_sbit = OpBitFieldSExtract %v4int %uints %offset %count + %uint_to_uint_sbit = OpBitFieldSExtract %v4uint %uints %uint_11 %int_1 + + ; Base and Result must match. + %int_to_int_ubit = OpBitFieldUExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_ubit = OpBitFieldUExtract %v4uint %ints %offset %count + ;%uint_to_int_ubit = OpBitFieldUExtract %v4int %uints %offset %count + %uint_to_uint_ubit = OpBitFieldUExtract %v4uint %uints %uint_11 %int_1 + + %int_to_int_insert = OpBitFieldInsert %v4int %ints %ints_alt %int_1 %uint_11 + %uint_to_uint_insert = OpBitFieldInsert %v4uint %uints %uints_alt %uint_11 %int_1 + + OpStore %ints_ptr %int_to_int_popcount + OpStore %uints_ptr %int_to_uint_popcount + OpStore %ints_ptr %uint_to_int_popcount + OpStore %uints_ptr %uint_to_uint_popcount + + OpStore %ints_ptr %int_to_int_reverse + ;OpStore %uints_ptr %int_to_uint_reverse + ;OpStore %ints_ptr %uint_to_int_reverse + OpStore %uints_ptr %uint_to_uint_reverse + + OpStore %ints_ptr %int_to_int_sbit + ;OpStore %uints_ptr %int_to_uint_sbit + ;OpStore %ints_ptr %uint_to_int_sbit + OpStore %uints_ptr %uint_to_uint_sbit + + OpStore %ints_ptr %int_to_int_ubit + ;OpStore %uints_ptr %int_to_uint_ubit + ;OpStore %ints_ptr %uint_to_int_ubit + OpStore %uints_ptr %uint_to_uint_ubit + + OpStore %ints_ptr %int_to_int_insert + OpStore %uints_ptr %uint_to_uint_insert + + OpReturn + OpFunctionEnd diff --git a/3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 000000000..435fa3222 --- /dev/null +++ b/3rdparty/spirv-cross/shaders-msl-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "ints" + OpMemberName %SSBO 1 "uints" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + + %int_1 = OpConstant %int 1 + %uint_11 = OpConstant %uint 11 + + %SSBO = OpTypeStruct %v4int %v4uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0 + %uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1 + %ints = OpLoad %v4int %ints_ptr + %uints = OpLoad %v4uint %uints_ptr + + %ints_alt = OpVectorShuffle %v4int %ints %ints 3 2 1 0 + %uints_alt = OpVectorShuffle %v4uint %uints %uints 3 2 1 0 + + %int_to_int_popcount = OpBitCount %v4int %ints + %int_to_uint_popcount = OpBitCount %v4uint %ints + %uint_to_int_popcount = OpBitCount %v4int %uints + %uint_to_uint_popcount = OpBitCount %v4uint %uints + + ; BitReverse must have matching types w.r.t. sign, yay. + %int_to_int_reverse = OpBitReverse %v4int %ints + ;%int_to_uint_reverse = OpBitReverse %v4uint %ints + ;%uint_to_int_reverse = OpBitReverse %v4int %uints + %uint_to_uint_reverse = OpBitReverse %v4uint %uints + + ; Base and Result must match. + %int_to_int_sbit = OpBitFieldSExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_sbit = OpBitFieldSExtract %v4uint %ints %offset %count + ;%uint_to_int_sbit = OpBitFieldSExtract %v4int %uints %offset %count + %uint_to_uint_sbit = OpBitFieldSExtract %v4uint %uints %uint_11 %int_1 + + ; Base and Result must match. + %int_to_int_ubit = OpBitFieldUExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_ubit = OpBitFieldUExtract %v4uint %ints %offset %count + ;%uint_to_int_ubit = OpBitFieldUExtract %v4int %uints %offset %count + %uint_to_uint_ubit = OpBitFieldUExtract %v4uint %uints %uint_11 %int_1 + + %int_to_int_insert = OpBitFieldInsert %v4int %ints %ints_alt %int_1 %uint_11 + %uint_to_uint_insert = OpBitFieldInsert %v4uint %uints %uints_alt %uint_11 %int_1 + + OpStore %ints_ptr %int_to_int_popcount + OpStore %uints_ptr %int_to_uint_popcount + OpStore %ints_ptr %uint_to_int_popcount + OpStore %uints_ptr %uint_to_uint_popcount + + OpStore %ints_ptr %int_to_int_reverse + ;OpStore %uints_ptr %int_to_uint_reverse + ;OpStore %ints_ptr %uint_to_int_reverse + OpStore %uints_ptr %uint_to_uint_reverse + + OpStore %ints_ptr %int_to_int_sbit + ;OpStore %uints_ptr %int_to_uint_sbit + ;OpStore %ints_ptr %uint_to_int_sbit + OpStore %uints_ptr %uint_to_uint_sbit + + OpStore %ints_ptr %int_to_int_ubit + ;OpStore %uints_ptr %int_to_uint_ubit + ;OpStore %ints_ptr %uint_to_int_ubit + OpStore %uints_ptr %uint_to_uint_ubit + + OpStore %ints_ptr %int_to_int_insert + OpStore %uints_ptr %uint_to_uint_insert + + OpReturn + OpFunctionEnd diff --git a/3rdparty/spirv-cross/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp b/3rdparty/spirv-cross/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp new file mode 100644 index 000000000..081c39626 --- /dev/null +++ b/3rdparty/spirv-cross/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp @@ -0,0 +1,18 @@ +#version 450 +layout(local_size_x = 8) in; + +shared float shared_group[8][8]; +shared float shared_group_alt[8][8]; + +void main() +{ + float blob[8]; + for (int i = 0; i < 8; i++) + blob[i] = float(i); + shared_group[gl_LocalInvocationIndex] = blob; + + barrier(); + + float copied_blob[8] = shared_group[gl_LocalInvocationIndex ^ 1u]; + shared_group_alt[gl_LocalInvocationIndex] = shared_group[gl_LocalInvocationIndex]; +} diff --git a/3rdparty/spirv-cross/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp b/3rdparty/spirv-cross/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp new file mode 100644 index 000000000..435fa3222 --- /dev/null +++ b/3rdparty/spirv-cross/shaders-no-opt/asm/comp/bitfield-signed-operations.asm.comp @@ -0,0 +1,97 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 26 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + OpName %SSBO "SSBO" + OpMemberName %SSBO 0 "ints" + OpMemberName %SSBO 1 "uints" + OpName %_ "" + OpMemberDecorate %SSBO 0 Offset 0 + OpMemberDecorate %SSBO 1 Offset 16 + OpDecorate %SSBO BufferBlock + OpDecorate %_ DescriptorSet 0 + OpDecorate %_ Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + + %int_1 = OpConstant %int 1 + %uint_11 = OpConstant %uint 11 + + %SSBO = OpTypeStruct %v4int %v4uint +%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO + %_ = OpVariable %_ptr_Uniform_SSBO Uniform + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4int = OpTypePointer Uniform %v4int +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint + %main = OpFunction %void None %3 + %5 = OpLabel + %ints_ptr = OpAccessChain %_ptr_Uniform_v4int %_ %int_0 + %uints_ptr = OpAccessChain %_ptr_Uniform_v4uint %_ %int_1 + %ints = OpLoad %v4int %ints_ptr + %uints = OpLoad %v4uint %uints_ptr + + %ints_alt = OpVectorShuffle %v4int %ints %ints 3 2 1 0 + %uints_alt = OpVectorShuffle %v4uint %uints %uints 3 2 1 0 + + %int_to_int_popcount = OpBitCount %v4int %ints + %int_to_uint_popcount = OpBitCount %v4uint %ints + %uint_to_int_popcount = OpBitCount %v4int %uints + %uint_to_uint_popcount = OpBitCount %v4uint %uints + + ; BitReverse must have matching types w.r.t. sign, yay. + %int_to_int_reverse = OpBitReverse %v4int %ints + ;%int_to_uint_reverse = OpBitReverse %v4uint %ints + ;%uint_to_int_reverse = OpBitReverse %v4int %uints + %uint_to_uint_reverse = OpBitReverse %v4uint %uints + + ; Base and Result must match. + %int_to_int_sbit = OpBitFieldSExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_sbit = OpBitFieldSExtract %v4uint %ints %offset %count + ;%uint_to_int_sbit = OpBitFieldSExtract %v4int %uints %offset %count + %uint_to_uint_sbit = OpBitFieldSExtract %v4uint %uints %uint_11 %int_1 + + ; Base and Result must match. + %int_to_int_ubit = OpBitFieldUExtract %v4int %ints %int_1 %uint_11 + ;%int_to_uint_ubit = OpBitFieldUExtract %v4uint %ints %offset %count + ;%uint_to_int_ubit = OpBitFieldUExtract %v4int %uints %offset %count + %uint_to_uint_ubit = OpBitFieldUExtract %v4uint %uints %uint_11 %int_1 + + %int_to_int_insert = OpBitFieldInsert %v4int %ints %ints_alt %int_1 %uint_11 + %uint_to_uint_insert = OpBitFieldInsert %v4uint %uints %uints_alt %uint_11 %int_1 + + OpStore %ints_ptr %int_to_int_popcount + OpStore %uints_ptr %int_to_uint_popcount + OpStore %ints_ptr %uint_to_int_popcount + OpStore %uints_ptr %uint_to_uint_popcount + + OpStore %ints_ptr %int_to_int_reverse + ;OpStore %uints_ptr %int_to_uint_reverse + ;OpStore %ints_ptr %uint_to_int_reverse + OpStore %uints_ptr %uint_to_uint_reverse + + OpStore %ints_ptr %int_to_int_sbit + ;OpStore %uints_ptr %int_to_uint_sbit + ;OpStore %ints_ptr %uint_to_int_sbit + OpStore %uints_ptr %uint_to_uint_sbit + + OpStore %ints_ptr %int_to_int_ubit + ;OpStore %uints_ptr %int_to_uint_ubit + ;OpStore %ints_ptr %uint_to_int_ubit + OpStore %uints_ptr %uint_to_uint_ubit + + OpStore %ints_ptr %int_to_int_insert + OpStore %uints_ptr %uint_to_uint_insert + + OpReturn + OpFunctionEnd diff --git a/3rdparty/spirv-cross/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.frag b/3rdparty/spirv-cross/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.frag new file mode 100644 index 000000000..dda2f0279 --- /dev/null +++ b/3rdparty/spirv-cross/shaders-no-opt/asm/frag/combined-image-sampler-dxc-min16float.asm.frag @@ -0,0 +1,95 @@ +; SPIR-V +; Version: 1.0 +; Generator: Google spiregg; 0 +; Bound: 48 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %PSMain "main" %in_var_COLOR %in_var_TEXCOORD0 %out_var_SV_TARGET + OpExecutionMode %PSMain OriginUpperLeft + ; Not actually ESSL, but makes testing easier. + OpSource ESSL 310 + OpName %type_2d_image "type.2d.image" + OpName %tex "tex" + OpName %type_sampler "type.sampler" + OpName %Samp "Samp" + OpName %in_var_COLOR "in.var.COLOR" + OpName %in_var_TEXCOORD0 "in.var.TEXCOORD0" + OpName %out_var_SV_TARGET "out.var.SV_TARGET" + OpName %PSMain "PSMain" + OpName %PSInput "PSInput" + OpMemberName %PSInput 0 "color" + OpMemberName %PSInput 1 "uv" + OpName %param_var_input "param.var.input" + OpName %src_PSMain "src.PSMain" + OpName %input "input" + OpName %bb_entry "bb.entry" + OpName %a "a" + OpName %type_sampled_image "type.sampled.image" + OpDecorate %in_var_COLOR Location 0 + OpDecorate %in_var_TEXCOORD0 Location 1 + OpDecorate %out_var_SV_TARGET Location 0 + OpDecorate %tex DescriptorSet 0 + OpDecorate %tex Binding 0 + OpDecorate %Samp DescriptorSet 0 + OpDecorate %Samp Binding 1 + OpDecorate %tex RelaxedPrecision + OpDecorate %a RelaxedPrecision + OpDecorate %38 RelaxedPrecision + OpDecorate %45 RelaxedPrecision + OpDecorate %47 RelaxedPrecision + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float = OpTypeFloat 32 +%type_2d_image = OpTypeImage %float 2D 2 0 0 1 Unknown +%_ptr_UniformConstant_type_2d_image = OpTypePointer UniformConstant %type_2d_image +%type_sampler = OpTypeSampler +%_ptr_UniformConstant_type_sampler = OpTypePointer UniformConstant %type_sampler + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %v2float = OpTypeVector %float 2 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %void = OpTypeVoid + %21 = OpTypeFunction %void + %PSInput = OpTypeStruct %v4float %v2float +%_ptr_Function_PSInput = OpTypePointer Function %PSInput + %31 = OpTypeFunction %v4float %_ptr_Function_PSInput +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Function_v2float = OpTypePointer Function %v2float +%type_sampled_image = OpTypeSampledImage %type_2d_image + %tex = OpVariable %_ptr_UniformConstant_type_2d_image UniformConstant + %Samp = OpVariable %_ptr_UniformConstant_type_sampler UniformConstant +%in_var_COLOR = OpVariable %_ptr_Input_v4float Input +%in_var_TEXCOORD0 = OpVariable %_ptr_Input_v2float Input +%out_var_SV_TARGET = OpVariable %_ptr_Output_v4float Output + %PSMain = OpFunction %void None %21 + %22 = OpLabel +%param_var_input = OpVariable %_ptr_Function_PSInput Function + %26 = OpLoad %v4float %in_var_COLOR + %27 = OpLoad %v2float %in_var_TEXCOORD0 + %28 = OpCompositeConstruct %PSInput %26 %27 + OpStore %param_var_input %28 + %29 = OpFunctionCall %v4float %src_PSMain %param_var_input + OpStore %out_var_SV_TARGET %29 + OpReturn + OpFunctionEnd + %src_PSMain = OpFunction %v4float None %31 + %input = OpFunctionParameter %_ptr_Function_PSInput + %bb_entry = OpLabel + %a = OpVariable %_ptr_Function_v4float Function + %36 = OpAccessChain %_ptr_Function_v4float %input %int_0 + %37 = OpLoad %v4float %36 + %38 = OpLoad %type_2d_image %tex + %39 = OpLoad %type_sampler %Samp + %41 = OpAccessChain %_ptr_Function_v2float %input %int_1 + %42 = OpLoad %v2float %41 + %44 = OpSampledImage %type_sampled_image %38 %39 + %45 = OpImageSampleImplicitLod %v4float %44 %42 None + %46 = OpFMul %v4float %37 %45 + OpStore %a %46 + %47 = OpLoad %v4float %a + OpReturnValue %47 + OpFunctionEnd + diff --git a/3rdparty/spirv-cross/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag b/3rdparty/spirv-cross/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag new file mode 100644 index 000000000..9baebc20f --- /dev/null +++ b/3rdparty/spirv-cross/shaders-no-opt/asm/frag/ldexp-uint-exponent.asm.frag @@ -0,0 +1,36 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 20 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %_GLF_color "_GLF_color" + OpDecorate %_GLF_color Location 0 + OpDecorate %18 RelaxedPrecision + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %uint = OpTypeInt 32 0 + %v4uint = OpTypeVector %uint 4 + %uint_1 = OpConstant %uint 1 + %15 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpBitCount %v4uint %15 + %19 = OpExtInst %v4float %1 Ldexp %11 %18 + OpStore %_GLF_color %19 + OpReturn + OpFunctionEnd diff --git a/3rdparty/spirv-cross/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag b/3rdparty/spirv-cross/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag new file mode 100644 index 000000000..d2bd15a97 --- /dev/null +++ b/3rdparty/spirv-cross/shaders-no-opt/asm/frag/switch-single-case-multiple-exit-cfg.asm.frag @@ -0,0 +1,57 @@ +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 54 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color + OpExecutionMode %main OriginUpperLeft + OpSource ESSL 310 + OpName %main "main" + OpName %gl_FragCoord "gl_FragCoord" + OpName %_GLF_color "_GLF_color" + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %_GLF_color Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %bool = OpTypeBool + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %_GLF_color = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %52 = OpUndef %v2float + %main = OpFunction %void None %3 + %5 = OpLabel + OpSelectionMerge %9 None + OpSwitch %int_0 %8 + %8 = OpLabel + %17 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0 + %18 = OpLoad %float %17 + %22 = OpFOrdNotEqual %bool %18 %18 + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + OpBranch %9 + %24 = OpLabel + %33 = OpCompositeExtract %float %52 1 + %51 = OpCompositeInsert %v2float %33 %52 1 + OpBranch %9 + %9 = OpLabel + %53 = OpPhi %v2float %52 %23 %51 %24 + %42 = OpCompositeExtract %float %53 0 + %43 = OpCompositeExtract %float %53 1 + %48 = OpCompositeConstruct %v4float %42 %43 %float_1 %float_1 + OpStore %_GLF_color %48 + OpReturn + OpFunctionEnd diff --git a/3rdparty/spirv-cross/shaders/frag/post-depth-coverage-es.frag b/3rdparty/spirv-cross/shaders/frag/post-depth-coverage-es.frag new file mode 100644 index 000000000..ecc57e4a8 --- /dev/null +++ b/3rdparty/spirv-cross/shaders/frag/post-depth-coverage-es.frag @@ -0,0 +1,13 @@ +#version 310 es +#extension GL_EXT_post_depth_coverage : require +#extension GL_OES_sample_variables : require +precision mediump float; + +layout(early_fragment_tests, post_depth_coverage) in; + +layout(location = 0) out vec4 FragColor; + +void main() +{ + FragColor = vec4(gl_SampleMaskIn[0]); +} diff --git a/3rdparty/spirv-cross/spirv_cfg.cpp b/3rdparty/spirv-cross/spirv_cfg.cpp index ed31f2367..de7906695 100644 --- a/3rdparty/spirv-cross/spirv_cfg.cpp +++ b/3rdparty/spirv-cross/spirv_cfg.cpp @@ -97,8 +97,22 @@ bool CFG::post_order_visit(uint32_t block_id) // Block back-edges from recursively revisiting ourselves. visit_order[block_id].get() = 0; - // First visit our branch targets. auto &block = compiler.get(block_id); + + // If this is a loop header, add an implied branch to the merge target. + // This is needed to avoid annoying cases with do { ... } while(false) loops often generated by inliners. + // To the CFG, this is linear control flow, but we risk picking the do/while scope as our dominating block. + // This makes sure that if we are accessing a variable outside the do/while, we choose the loop header as dominator. + // We could use has_visited_forward_edge, but this break code-gen where the merge block is unreachable in the CFG. + + // Make a point out of visiting merge target first. This is to make sure that post visit order outside the loop + // is lower than inside the loop, which is going to be key for some traversal algorithms like post-dominance analysis. + // For selection constructs true/false blocks will end up visiting the merge block directly and it works out fine, + // but for loops, only the header might end up actually branching to merge block. + if (block.merge == SPIRBlock::MergeLoop && post_order_visit(block.merge_block)) + add_branch(block_id, block.merge_block); + + // First visit our branch targets. switch (block.terminator) { case SPIRBlock::Direct: @@ -127,14 +141,6 @@ bool CFG::post_order_visit(uint32_t block_id) break; } - // If this is a loop header, add an implied branch to the merge target. - // This is needed to avoid annoying cases with do { ... } while(false) loops often generated by inliners. - // To the CFG, this is linear control flow, but we risk picking the do/while scope as our dominating block. - // This makes sure that if we are accessing a variable outside the do/while, we choose the loop header as dominator. - // We could use has_visited_forward_edge, but this break code-gen where the merge block is unreachable in the CFG. - if (block.merge == SPIRBlock::MergeLoop && post_order_visit(block.merge_block)) - add_branch(block_id, block.merge_block); - // If this is a selection merge, add an implied branch to the merge target. // This is needed to avoid cases where an inner branch dominates the outer branch. // This can happen if one of the branches exit early, e.g.: @@ -148,14 +154,35 @@ bool CFG::post_order_visit(uint32_t block_id) // Add a fake branch so any dominator in either the if (), or else () block, or a lone case statement // will be hoisted out to outside the selection merge. // If size > 1, the variable will be automatically hoisted, so we should not mess with it. + // The exception here is switch blocks, where we can have multiple edges to merge block, + // all coming from same scope, so be more conservative in this case. // Adding fake branches unconditionally breaks parameter preservation analysis, // which looks at how variables are accessed through the CFG. auto pred_itr = preceding_edges.find(block.next_block); if (pred_itr != end(preceding_edges)) { auto &pred = pred_itr->second; - if (pred.size() == 1 && *pred.begin() != block_id) - add_branch(block_id, block.next_block); + auto succ_itr = succeeding_edges.find(block_id); + uint32_t num_succeeding_edges = 0; + if (succ_itr != end(succeeding_edges)) + num_succeeding_edges = succ_itr->second.size(); + + if (block.terminator == SPIRBlock::MultiSelect && num_succeeding_edges == 1) + { + // Multiple branches can come from the same scope due to "break;", so we need to assume that all branches + // come from same case scope in worst case, even if there are multiple preceding edges. + // If we have more than one succeeding edge from the block header, it should be impossible + // to have a dominator be inside the block. + // Only case this can go wrong is if we have 2 or more edges from block header and + // 2 or more edges to merge block, and still have dominator be inside a case label. + if (!pred.empty()) + add_branch(block_id, block.next_block); + } + else + { + if (pred.size() == 1 && *pred.begin() != block_id) + add_branch(block_id, block.next_block); + } } else { @@ -241,6 +268,61 @@ uint32_t CFG::find_loop_dominator(uint32_t block_id) const return block_id; } +bool CFG::node_terminates_control_flow_in_sub_graph(uint32_t from, uint32_t to) const +{ + // Walk backwards, starting from "to" block. + // Only follow pred edges if they have a 1:1 relationship, or a merge relationship. + // If we cannot find a path to "from", we must assume that to is inside control flow in some way. + + auto &from_block = compiler.get(from); + uint32_t ignore_block_id = 0; + if (from_block.merge == SPIRBlock::MergeLoop) + ignore_block_id = from_block.merge_block; + + while (to != from) + { + auto pred_itr = preceding_edges.find(to); + if (pred_itr == end(preceding_edges)) + return false; + + DominatorBuilder builder(*this); + for (auto &edge : pred_itr->second) + builder.add_block(edge); + + uint32_t dominator = builder.get_dominator(); + if (dominator == 0) + return false; + + auto &dom = compiler.get(dominator); + + bool true_path_ignore = false; + bool false_path_ignore = false; + if (ignore_block_id && dom.terminator == SPIRBlock::Select) + { + auto &true_block = compiler.get(dom.true_block); + auto &false_block = compiler.get(dom.false_block); + auto &ignore_block = compiler.get(ignore_block_id); + true_path_ignore = compiler.execution_is_branchless(true_block, ignore_block); + false_path_ignore = compiler.execution_is_branchless(false_block, ignore_block); + } + + if ((dom.merge == SPIRBlock::MergeSelection && dom.next_block == to) || + (dom.merge == SPIRBlock::MergeLoop && dom.merge_block == to) || + (dom.terminator == SPIRBlock::Direct && dom.next_block == to) || + (dom.terminator == SPIRBlock::Select && dom.true_block == to && false_path_ignore) || + (dom.terminator == SPIRBlock::Select && dom.false_block == to && true_path_ignore)) + { + // Allow walking selection constructs if the other branch reaches out of a loop construct. + // It cannot be in-scope anymore. + to = dominator; + } + else + return false; + } + + return true; +} + DominatorBuilder::DominatorBuilder(const CFG &cfg_) : cfg(cfg_) { diff --git a/3rdparty/spirv-cross/spirv_cfg.hpp b/3rdparty/spirv-cross/spirv_cfg.hpp index 7d07d4841..fd3c0e6e7 100644 --- a/3rdparty/spirv-cross/spirv_cfg.hpp +++ b/3rdparty/spirv-cross/spirv_cfg.hpp @@ -88,13 +88,17 @@ public: return; seen_blocks.insert(block); - op(block); - for (auto b : get_succeeding_edges(block)) - walk_from(seen_blocks, b, op); + if (op(block)) + { + for (auto b : get_succeeding_edges(block)) + walk_from(seen_blocks, b, op); + } } uint32_t find_loop_dominator(uint32_t block) const; + bool node_terminates_control_flow_in_sub_graph(uint32_t from, uint32_t to) const; + private: struct VisitOrder { diff --git a/3rdparty/spirv-cross/spirv_common.hpp b/3rdparty/spirv-cross/spirv_common.hpp index 3db55cf5c..1641fdaa5 100644 --- a/3rdparty/spirv-cross/spirv_common.hpp +++ b/3rdparty/spirv-cross/spirv_common.hpp @@ -937,7 +937,8 @@ struct SPIRConstant : IVariant type = TypeConstant }; - union Constant { + union Constant + { uint32_t u32; int32_t i32; float f32; @@ -985,7 +986,8 @@ struct SPIRConstant : IVariant int e = (u16_value >> 10) & 0x1f; int m = (u16_value >> 0) & 0x3ff; - union { + union + { float f32; uint32_t u32; } u; diff --git a/3rdparty/spirv-cross/spirv_cross.cpp b/3rdparty/spirv-cross/spirv_cross.cpp index 3a9670ed4..166a9e0a3 100644 --- a/3rdparty/spirv-cross/spirv_cross.cpp +++ b/3rdparty/spirv-cross/spirv_cross.cpp @@ -265,6 +265,15 @@ SPIRVariable *Compiler::maybe_get_backing_variable(uint32_t chain) return var; } +StorageClass Compiler::get_backing_variable_storage(uint32_t ptr) +{ + auto *var = maybe_get_backing_variable(ptr); + if (var) + return var->storage; + else + return expression_type(ptr).storage; +} + void Compiler::register_read(uint32_t expr, uint32_t chain, bool forwarded) { auto &e = get(expr); @@ -1396,38 +1405,6 @@ bool Compiler::block_is_loop_candidate(const SPIRBlock &block, SPIRBlock::Method return false; } -bool Compiler::block_is_outside_flow_control_from_block(const SPIRBlock &from, const SPIRBlock &to) -{ - auto *start = &from; - - if (start->self == to.self) - return true; - - // Break cycles. - if (is_continue(start->self)) - return false; - - // If our select block doesn't merge, we must break or continue in these blocks, - // so if continues occur branchless within these blocks, consider them branchless as well. - // This is typically used for loop control. - if (start->terminator == SPIRBlock::Select && start->merge == SPIRBlock::MergeNone && - (block_is_outside_flow_control_from_block(get(start->true_block), to) || - block_is_outside_flow_control_from_block(get(start->false_block), to))) - { - return true; - } - else if (start->merge_block && block_is_outside_flow_control_from_block(get(start->merge_block), to)) - { - return true; - } - else if (start->next_block && block_is_outside_flow_control_from_block(get(start->next_block), to)) - { - return true; - } - else - return false; -} - bool Compiler::execution_is_noop(const SPIRBlock &from, const SPIRBlock &to) const { if (!execution_is_branchless(from, to)) @@ -2167,15 +2144,17 @@ bool Compiler::CombinedImageSamplerHandler::end_function_scope(const uint32_t *a if (s) sampler_id = s->self; - register_combined_image_sampler(caller, image_id, sampler_id, param.depth); + register_combined_image_sampler(caller, 0, image_id, sampler_id, param.depth); } } return true; } -void Compiler::CombinedImageSamplerHandler::register_combined_image_sampler(SPIRFunction &caller, uint32_t image_id, - uint32_t sampler_id, bool depth) +void Compiler::CombinedImageSamplerHandler::register_combined_image_sampler(SPIRFunction &caller, + uint32_t combined_module_id, + uint32_t image_id, uint32_t sampler_id, + bool depth) { // We now have a texture ID and a sampler ID which will either be found as a global // or a parameter in our own function. If both are global, they will not need a parameter, @@ -2235,12 +2214,15 @@ void Compiler::CombinedImageSamplerHandler::register_combined_image_sampler(SPIR // Build new variable. compiler.set(combined_id, ptr_type_id, StorageClassFunction, 0); - // Inherit RelaxedPrecision (and potentially other useful flags if deemed relevant). - auto &new_flags = compiler.ir.meta[combined_id].decoration.decoration_flags; - auto &old_flags = compiler.ir.meta[sampler_id].decoration.decoration_flags; - new_flags.reset(); - if (old_flags.get(DecorationRelaxedPrecision)) - new_flags.set(DecorationRelaxedPrecision); + // Inherit RelaxedPrecision. + // If any of OpSampledImage, underlying image or sampler are marked, inherit the decoration. + bool relaxed_precision = + compiler.has_decoration(sampler_id, DecorationRelaxedPrecision) || + compiler.has_decoration(image_id, DecorationRelaxedPrecision) || + (combined_module_id && compiler.has_decoration(combined_module_id, DecorationRelaxedPrecision)); + + if (relaxed_precision) + compiler.set_decoration(combined_id, DecorationRelaxedPrecision); param.id = combined_id; @@ -2447,8 +2429,10 @@ bool Compiler::CombinedImageSamplerHandler::handle(Op opcode, const uint32_t *ar if (sampler) sampler_id = sampler->self; + uint32_t combined_id = args[1]; + auto &combined_type = compiler.get(args[0]); - register_combined_image_sampler(callee, image_id, sampler_id, combined_type.image.depth); + register_combined_image_sampler(callee, combined_id, image_id, sampler_id, combined_type.image.depth); } } @@ -2467,6 +2451,7 @@ bool Compiler::CombinedImageSamplerHandler::handle(Op opcode, const uint32_t *ar if (itr == end(compiler.combined_image_samplers)) { uint32_t sampled_type; + uint32_t combined_module_id; if (is_fetch) { // Have to invent the sampled image type. @@ -2476,10 +2461,12 @@ bool Compiler::CombinedImageSamplerHandler::handle(Op opcode, const uint32_t *ar type.self = sampled_type; type.basetype = SPIRType::SampledImage; type.image.depth = false; + combined_module_id = 0; } else { sampled_type = args[0]; + combined_module_id = args[1]; } auto id = compiler.ir.increase_bound_by(2); @@ -2499,12 +2486,14 @@ bool Compiler::CombinedImageSamplerHandler::handle(Op opcode, const uint32_t *ar compiler.set(combined_id, type_id, StorageClassUniformConstant, 0); // Inherit RelaxedPrecision (and potentially other useful flags if deemed relevant). - auto &new_flags = compiler.ir.meta[combined_id].decoration.decoration_flags; - // Fetch inherits precision from the image, not sampler (there is no sampler). - auto &old_flags = compiler.ir.meta[is_fetch ? image_id : sampler_id].decoration.decoration_flags; - new_flags.reset(); - if (old_flags.get(DecorationRelaxedPrecision)) - new_flags.set(DecorationRelaxedPrecision); + // If any of OpSampledImage, underlying image or sampler are marked, inherit the decoration. + bool relaxed_precision = + (sampler_id && compiler.has_decoration(sampler_id, DecorationRelaxedPrecision)) || + (image_id && compiler.has_decoration(image_id, DecorationRelaxedPrecision)) || + (combined_module_id && compiler.has_decoration(combined_module_id, DecorationRelaxedPrecision)); + + if (relaxed_precision) + compiler.set_decoration(combined_id, DecorationRelaxedPrecision); // Propagate the array type for the original image as well. auto *var = compiler.maybe_get_backing_variable(image_id); @@ -3436,10 +3425,11 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry, AnalyzeVariableScopeA // merge can occur. Walk the CFG to see if we find anything. seen_blocks.clear(); - cfg.walk_from(seen_blocks, header_block.merge_block, [&](uint32_t walk_block) { + cfg.walk_from(seen_blocks, header_block.merge_block, [&](uint32_t walk_block) -> bool { // We found a block which accesses the variable outside the loop. if (blocks.find(walk_block) != end(blocks)) static_loop_init = false; + return true; }); if (!static_loop_init) @@ -3803,6 +3793,15 @@ bool Compiler::CombinedImageSamplerDrefHandler::handle(spv::Op opcode, const uin return true; } +const CFG &Compiler::get_cfg_for_current_function() const +{ + assert(current_function); + auto cfg_itr = function_cfgs.find(current_function->self); + assert(cfg_itr != end(function_cfgs)); + assert(cfg_itr->second); + return *cfg_itr->second; +} + void Compiler::build_function_control_flow_graphs_and_analyze() { CFGBuilder handler(*this); diff --git a/3rdparty/spirv-cross/spirv_cross.hpp b/3rdparty/spirv-cross/spirv_cross.hpp index ca75dc66d..90cc99566 100644 --- a/3rdparty/spirv-cross/spirv_cross.hpp +++ b/3rdparty/spirv-cross/spirv_cross.hpp @@ -605,6 +605,7 @@ protected: bool expression_is_lvalue(uint32_t id) const; bool variable_storage_is_aliased(const SPIRVariable &var); SPIRVariable *maybe_get_backing_variable(uint32_t chain); + spv::StorageClass get_backing_variable_storage(uint32_t ptr); void register_read(uint32_t expr, uint32_t chain, bool forwarded); void register_write(uint32_t chain); @@ -657,7 +658,6 @@ protected: bool function_is_pure(const SPIRFunction &func); bool block_is_pure(const SPIRBlock &block); - bool block_is_outside_flow_control_from_block(const SPIRBlock &from, const SPIRBlock &to); bool execution_is_branchless(const SPIRBlock &from, const SPIRBlock &to) const; bool execution_is_direct_branch(const SPIRBlock &from, const SPIRBlock &to) const; @@ -772,8 +772,8 @@ protected: uint32_t remap_parameter(uint32_t id); void push_remap_parameters(const SPIRFunction &func, const uint32_t *args, uint32_t length); void pop_remap_parameters(); - void register_combined_image_sampler(SPIRFunction &caller, uint32_t texture_id, uint32_t sampler_id, - bool depth); + void register_combined_image_sampler(SPIRFunction &caller, uint32_t combined_id, uint32_t texture_id, + uint32_t sampler_id, bool depth); }; struct DummySamplerForCombinedImageHandler : OpcodeHandler @@ -883,6 +883,8 @@ protected: void build_function_control_flow_graphs_and_analyze(); std::unordered_map> function_cfgs; + const CFG &get_cfg_for_current_function() const; + struct CFGBuilder : OpcodeHandler { CFGBuilder(Compiler &compiler_); diff --git a/3rdparty/spirv-cross/spirv_cross_containers.hpp b/3rdparty/spirv-cross/spirv_cross_containers.hpp index 31a8abbd0..7b507e110 100644 --- a/3rdparty/spirv-cross/spirv_cross_containers.hpp +++ b/3rdparty/spirv-cross/spirv_cross_containers.hpp @@ -61,7 +61,8 @@ public: private: #if defined(_MSC_VER) && _MSC_VER < 1900 // MSVC 2013 workarounds, sigh ... - union { + union + { char aligned_char[sizeof(T) * N]; double dummy_aligner; } u; diff --git a/3rdparty/spirv-cross/spirv_glsl.cpp b/3rdparty/spirv-cross/spirv_glsl.cpp index bf33d83b0..d390e5950 100644 --- a/3rdparty/spirv-cross/spirv_glsl.cpp +++ b/3rdparty/spirv-cross/spirv_glsl.cpp @@ -640,6 +640,19 @@ void CompilerGLSL::emit_header() statement("#endif"); } } + else if (ext == "GL_ARB_post_depth_coverage") + { + if (options.es) + statement("#extension GL_EXT_post_depth_coverage : require"); + else + { + statement("#if defined(GL_ARB_post_depth_coverge)"); + statement("#extension GL_ARB_post_depth_coverage : require"); + statement("#else"); + statement("#extension GL_EXT_post_depth_coverage : require"); + statement("#endif"); + } + } else statement("#extension ", ext, " : require"); } @@ -4225,6 +4238,58 @@ void CompilerGLSL::emit_unary_func_op_cast(uint32_t result_type, uint32_t result inherit_expression_dependencies(result_id, op0); } +// Very special case. Handling bitfieldExtract requires us to deal with different bitcasts of different signs +// and different vector sizes all at once. Need a special purpose method here. +void CompilerGLSL::emit_trinary_func_op_bitextract(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + uint32_t op2, const char *op, + SPIRType::BaseType expected_result_type, + SPIRType::BaseType input_type0, SPIRType::BaseType input_type1, + SPIRType::BaseType input_type2) +{ + auto &out_type = get(result_type); + auto expected_type = out_type; + expected_type.basetype = input_type0; + + string cast_op0 = + expression_type(op0).basetype != input_type0 ? bitcast_glsl(expected_type, op0) : to_unpacked_expression(op0); + + auto op1_expr = to_unpacked_expression(op1); + auto op2_expr = to_unpacked_expression(op2); + + // Use value casts here instead. Input must be exactly int or uint, but SPIR-V might be 16-bit. + expected_type.basetype = input_type1; + expected_type.vecsize = 1; + string cast_op1 = expression_type(op1).basetype != input_type1 ? + join(type_to_glsl_constructor(expected_type), "(", op1_expr, ")") : + op1_expr; + + expected_type.basetype = input_type2; + expected_type.vecsize = 1; + string cast_op2 = expression_type(op2).basetype != input_type2 ? + join(type_to_glsl_constructor(expected_type), "(", op2_expr, ")") : + op2_expr; + + string expr; + if (out_type.basetype != expected_result_type) + { + expected_type.vecsize = out_type.vecsize; + expected_type.basetype = expected_result_type; + expr = bitcast_glsl_op(out_type, expected_type); + expr += '('; + expr += join(op, "(", cast_op0, ", ", cast_op1, ", ", cast_op2, ")"); + expr += ')'; + } + else + { + expr += join(op, "(", cast_op0, ", ", cast_op1, ", ", cast_op2, ")"); + } + + emit_op(result_type, result_id, expr, should_forward(op0) && should_forward(op1) && should_forward(op2)); + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); + inherit_expression_dependencies(result_id, op2); +} + void CompilerGLSL::emit_trinary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, uint32_t op2, const char *op, SPIRType::BaseType input_type) { @@ -4313,6 +4378,44 @@ void CompilerGLSL::emit_quaternary_func_op(uint32_t result_type, uint32_t result inherit_expression_dependencies(result_id, op3); } +void CompilerGLSL::emit_bitfield_insert_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + uint32_t op2, uint32_t op3, const char *op, + SPIRType::BaseType offset_count_type) +{ + // Only need to cast offset/count arguments. Types of base/insert must be same as result type, + // and bitfieldInsert is sign invariant. + bool forward = should_forward(op0) && should_forward(op1) && should_forward(op2) && should_forward(op3); + + auto op0_expr = to_unpacked_expression(op0); + auto op1_expr = to_unpacked_expression(op1); + auto op2_expr = to_unpacked_expression(op2); + auto op3_expr = to_unpacked_expression(op3); + + SPIRType target_type; + target_type.vecsize = 1; + target_type.basetype = offset_count_type; + + if (expression_type(op2).basetype != offset_count_type) + { + // Value-cast here. Input might be 16-bit. GLSL requires int. + op2_expr = join(type_to_glsl_constructor(target_type), "(", op2_expr, ")"); + } + + if (expression_type(op3).basetype != offset_count_type) + { + // Value-cast here. Input might be 16-bit. GLSL requires int. + op3_expr = join(type_to_glsl_constructor(target_type), "(", op3_expr, ")"); + } + + emit_op(result_type, result_id, join(op, "(", op0_expr, ", ", op1_expr, ", ", op2_expr, ", ", op3_expr, ")"), + forward); + + inherit_expression_dependencies(result_id, op0); + inherit_expression_dependencies(result_id, op1); + inherit_expression_dependencies(result_id, op2); + inherit_expression_dependencies(result_id, op3); +} + // EXT_shader_texture_lod only concerns fragment shaders so lod tex functions // are not allowed in ES 2 vertex shaders. But SPIR-V only supports lod tex // functions in vertex shaders so we revert those back to plain calls when @@ -5433,8 +5536,28 @@ void CompilerGLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, } case GLSLstd450Ldexp: - emit_binary_func_op(result_type, id, args[0], args[1], "ldexp"); + { + bool forward = should_forward(args[0]) && should_forward(args[1]); + + auto op0 = to_unpacked_expression(args[0]); + auto op1 = to_unpacked_expression(args[1]); + auto &op1_type = expression_type(args[1]); + if (op1_type.basetype != SPIRType::Int) + { + // Need a value cast here. + auto target_type = op1_type; + target_type.basetype = SPIRType::Int; + op1 = join(type_to_glsl_constructor(target_type), "(", op1, ")"); + } + + auto expr = join("ldexp(", op0, ", ", op1, ")"); + + emit_op(result_type, id, expr, forward); + inherit_expression_dependencies(id, args[0]); + inherit_expression_dependencies(id, args[1]); break; + } + case GLSLstd450PackSnorm4x8: emit_unary_func_op(result_type, id, args[0], "packSnorm4x8"); break; @@ -7777,7 +7900,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) // it is an array, and our backend does not support arrays as value types. // Emit the temporary, and copy it explicitly. e = &emit_uninitialized_temporary_expression(result_type, id); - emit_array_copy(to_expression(id), ptr); + emit_array_copy(to_expression(id), ptr, StorageClassFunction, get_backing_variable_storage(ptr)); } else e = &emit_op(result_type, id, expr, forward, !usage_tracking); @@ -8154,6 +8277,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) if (has_extended_decoration(ops[2], SPIRVCrossDecorationPhysicalTypePacked)) allow_base_expression = false; + // Cannot use base expression for row-major matrix row-extraction since we need to interleave access pattern + // into the base expression. + if (is_non_native_row_major_matrix(ops[2])) + allow_base_expression = false; + AccessChainMeta meta; SPIRExpression *e = nullptr; @@ -8981,23 +9109,36 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction) // Bitfield case OpBitFieldInsert: - // TODO: The signedness of inputs is strict in GLSL, but not in SPIR-V, bitcast if necessary. - GLSL_QFOP(bitfieldInsert); + { + emit_bitfield_insert_op(ops[0], ops[1], ops[2], ops[3], ops[4], ops[5], "bitfieldInsert", SPIRType::Int); break; + } case OpBitFieldSExtract: - case OpBitFieldUExtract: - // TODO: The signedness of inputs is strict in GLSL, but not in SPIR-V, bitcast if necessary. - GLSL_TFOP(bitfieldExtract); + { + emit_trinary_func_op_bitextract(ops[0], ops[1], ops[2], ops[3], ops[4], "bitfieldExtract", int_type, int_type, + SPIRType::Int, SPIRType::Int); break; + } + + case OpBitFieldUExtract: + { + emit_trinary_func_op_bitextract(ops[0], ops[1], ops[2], ops[3], ops[4], "bitfieldExtract", uint_type, uint_type, + SPIRType::Int, SPIRType::Int); + break; + } case OpBitReverse: + // BitReverse does not have issues with sign since result type must match input type. GLSL_UFOP(bitfieldReverse); break; case OpBitCount: - GLSL_UFOP(bitCount); + { + auto basetype = expression_type(ops[2]).basetype; + emit_unary_func_op_cast(ops[0], ops[1], ops[2], "bitCount", basetype, int_type); break; + } // Atomics case OpAtomicExchange: @@ -11169,16 +11310,16 @@ void CompilerGLSL::branch_to_continue(uint32_t from, uint32_t to) if (loop_dominator != 0) { - auto &dominator = get(loop_dominator); + auto &cfg = get_cfg_for_current_function(); // For non-complex continue blocks, we implicitly branch to the continue block // by having the continue block be part of the loop header in for (; ; continue-block). - outside_control_flow = block_is_outside_flow_control_from_block(dominator, from_block); + outside_control_flow = cfg.node_terminates_control_flow_in_sub_graph(loop_dominator, from); } // Some simplification for for-loops. We always end up with a useless continue; // statement since we branch to a loop block. - // Walk the CFG, if we uncoditionally execute the block calling continue assuming we're in the loop block, + // Walk the CFG, if we unconditionally execute the block calling continue assuming we're in the loop block, // we can avoid writing out an explicit continue statement. // Similar optimization to return statements if we know we're outside flow control. if (!outside_control_flow) @@ -11191,6 +11332,8 @@ void CompilerGLSL::branch(uint32_t from, uint32_t to) flush_phi(from, to); flush_control_dependent_expressions(from); + bool to_is_continue = is_continue(to); + // This is only a continue if we branch to our loop dominator. if ((ir.block_meta[to] & ParsedIR::BLOCK_META_LOOP_HEADER_BIT) != 0 && get(from).loop_dominator == to) { @@ -11219,12 +11362,25 @@ void CompilerGLSL::branch(uint32_t from, uint32_t to) } statement("break;"); } - else if (is_continue(to) || (from == to)) + else if (to_is_continue || from == to) { // For from == to case can happen for a do-while loop which branches into itself. // We don't mark these cases as continue blocks, but the only possible way to branch into // ourselves is through means of continue blocks. - branch_to_continue(from, to); + + // If we are merging to a continue block, there is no need to emit the block chain for continue here. + // We can branch to the continue block after we merge execution. + + // Here we make use of structured control flow rules from spec: + // 2.11: - the merge block declared by a header block cannot be a merge block declared by any other header block + // - each header block must strictly dominate its merge block, unless the merge block is unreachable in the CFG + // If we are branching to a merge block, we must be inside a construct which dominates the merge block. + auto &block_meta = ir.block_meta[to]; + bool branching_to_merge = + (block_meta & (ParsedIR::BLOCK_META_SELECTION_MERGE_BIT | ParsedIR::BLOCK_META_MULTISELECT_MERGE_BIT | + ParsedIR::BLOCK_META_LOOP_MERGE_BIT)) != 0; + if (!to_is_continue || !branching_to_merge) + branch_to_continue(from, to); } else if (!is_conditional(to)) emit_block_chain(get(to)); @@ -12073,12 +12229,15 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) } case SPIRBlock::Return: + { for (auto &line : current_function->fixup_hooks_out) line(); if (processing_entry_point) emit_fixup(); + auto &cfg = get_cfg_for_current_function(); + if (block.return_value) { auto &type = expression_type(block.return_value); @@ -12087,9 +12246,12 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) // If we cannot return arrays, we will have a special out argument we can write to instead. // The backend is responsible for setting this up, and redirection the return values as appropriate. if (ir.ids[block.return_value].get_type() != TypeUndef) - emit_array_copy("SPIRV_Cross_return_value", block.return_value); + { + emit_array_copy("SPIRV_Cross_return_value", block.return_value, StorageClassFunction, + get_backing_variable_storage(block.return_value)); + } - if (!block_is_outside_flow_control_from_block(get(current_function->entry_block), block) || + if (!cfg.node_terminates_control_flow_in_sub_graph(current_function->entry_block, block.self) || block.loop_dominator != SPIRBlock::NoDominator) { statement("return;"); @@ -12102,16 +12264,17 @@ void CompilerGLSL::emit_block_chain(SPIRBlock &block) statement("return ", to_expression(block.return_value), ";"); } } - // If this block is the very final block and not called from control flow, - // we do not need an explicit return which looks out of place. Just end the function here. - // In the very weird case of for(;;) { return; } executing return is unconditional, - // but we actually need a return here ... - else if (!block_is_outside_flow_control_from_block(get(current_function->entry_block), block) || + else if (!cfg.node_terminates_control_flow_in_sub_graph(current_function->entry_block, block.self) || block.loop_dominator != SPIRBlock::NoDominator) { + // If this block is the very final block and not called from control flow, + // we do not need an explicit return which looks out of place. Just end the function here. + // In the very weird case of for(;;) { return; } executing return is unconditional, + // but we actually need a return here ... statement("return;"); } break; + } case SPIRBlock::Kill: statement(backend.discard_literal, ";"); @@ -12281,7 +12444,7 @@ uint32_t CompilerGLSL::mask_relevant_memory_semantics(uint32_t semantics) MemorySemanticsCrossWorkgroupMemoryMask | MemorySemanticsSubgroupMemoryMask); } -void CompilerGLSL::emit_array_copy(const string &lhs, uint32_t rhs_id) +void CompilerGLSL::emit_array_copy(const string &lhs, uint32_t rhs_id, StorageClass, StorageClass) { statement(lhs, " = ", to_expression(rhs_id), ";"); } diff --git a/3rdparty/spirv-cross/spirv_glsl.hpp b/3rdparty/spirv-cross/spirv_glsl.hpp index f5582f630..4c273edb4 100644 --- a/3rdparty/spirv-cross/spirv_glsl.hpp +++ b/3rdparty/spirv-cross/spirv_glsl.hpp @@ -458,6 +458,12 @@ protected: SPIRType::BaseType input_type, bool skip_cast_if_equal_type); void emit_trinary_func_op_cast(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, uint32_t op2, const char *op, SPIRType::BaseType input_type); + void emit_trinary_func_op_bitextract(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, + uint32_t op2, const char *op, SPIRType::BaseType expected_result_type, + SPIRType::BaseType input_type0, SPIRType::BaseType input_type1, + SPIRType::BaseType input_type2); + void emit_bitfield_insert_op(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1, uint32_t op2, + uint32_t op3, const char *op, SPIRType::BaseType offset_count_type); void emit_unary_func_op(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op); void emit_unrolled_unary_op(uint32_t result_type, uint32_t result_id, uint32_t operand, const char *op); @@ -536,7 +542,8 @@ protected: std::string layout_for_variable(const SPIRVariable &variable); std::string to_combined_image_sampler(uint32_t image_id, uint32_t samp_id); virtual bool skip_argument(uint32_t id) const; - virtual void emit_array_copy(const std::string &lhs, uint32_t rhs_id); + virtual void emit_array_copy(const std::string &lhs, uint32_t rhs_id, spv::StorageClass lhs_storage, + spv::StorageClass rhs_storage); virtual void emit_block_hints(const SPIRBlock &block); virtual std::string to_initializer_expression(const SPIRVariable &var); diff --git a/3rdparty/spirv-cross/spirv_hlsl.cpp b/3rdparty/spirv-cross/spirv_hlsl.cpp index 0f1fac661..1af127f2f 100644 --- a/3rdparty/spirv-cross/spirv_hlsl.cpp +++ b/3rdparty/spirv-cross/spirv_hlsl.cpp @@ -4641,8 +4641,11 @@ void CompilerHLSL::emit_instruction(const Instruction &instruction) } case OpBitCount: - HLSL_UFOP(countbits); + { + auto basetype = expression_type(ops[2]).basetype; + emit_unary_func_op_cast(ops[0], ops[1], ops[2], "countbits", basetype, basetype); break; + } case OpBitReverse: HLSL_UFOP(reversebits); diff --git a/3rdparty/spirv-cross/spirv_msl.cpp b/3rdparty/spirv-cross/spirv_msl.cpp index 10dc85497..4dbb3ddb1 100644 --- a/3rdparty/spirv-cross/spirv_msl.cpp +++ b/3rdparty/spirv-cross/spirv_msl.cpp @@ -3116,7 +3116,7 @@ void CompilerMSL::emit_custom_functions() case SPVFuncImplMod: statement("// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()"); statement("template"); - statement("Tx mod(Tx x, Ty y)"); + statement("inline Tx mod(Tx x, Ty y)"); begin_scope(); statement("return x - y * floor(x / y);"); end_scope(); @@ -3126,7 +3126,7 @@ void CompilerMSL::emit_custom_functions() case SPVFuncImplRadians: statement("// Implementation of the GLSL radians() function"); statement("template"); - statement("T radians(T d)"); + statement("inline T radians(T d)"); begin_scope(); statement("return d * T(0.01745329251);"); end_scope(); @@ -3136,7 +3136,7 @@ void CompilerMSL::emit_custom_functions() case SPVFuncImplDegrees: statement("// Implementation of the GLSL degrees() function"); statement("template"); - statement("T degrees(T r)"); + statement("inline T degrees(T r)"); begin_scope(); statement("return r * T(57.2957795131);"); end_scope(); @@ -3146,7 +3146,7 @@ void CompilerMSL::emit_custom_functions() case SPVFuncImplFindILsb: statement("// Implementation of the GLSL findLSB() function"); statement("template"); - statement("T spvFindLSB(T x)"); + statement("inline T spvFindLSB(T x)"); begin_scope(); statement("return select(ctz(x), T(-1), x == T(0));"); end_scope(); @@ -3156,7 +3156,7 @@ void CompilerMSL::emit_custom_functions() case SPVFuncImplFindUMsb: statement("// Implementation of the unsigned GLSL findMSB() function"); statement("template"); - statement("T spvFindUMSB(T x)"); + statement("inline T spvFindUMSB(T x)"); begin_scope(); statement("return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0));"); end_scope(); @@ -3166,7 +3166,7 @@ void CompilerMSL::emit_custom_functions() case SPVFuncImplFindSMsb: statement("// Implementation of the signed GLSL findMSB() function"); statement("template"); - statement("T spvFindSMSB(T x)"); + statement("inline T spvFindSMSB(T x)"); begin_scope(); statement("T v = select(x, T(-1) - x, x < T(0));"); statement("return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0));"); @@ -3177,7 +3177,7 @@ void CompilerMSL::emit_custom_functions() case SPVFuncImplSSign: statement("// Implementation of the GLSL sign() function for integer types"); statement("template::value>::type>"); - statement("T sign(T x)"); + statement("inline T sign(T x)"); begin_scope(); statement("return select(select(select(x, T(0), x == T(0)), T(1), x > T(0)), T(-1), x < T(0));"); end_scope(); @@ -3185,40 +3185,27 @@ void CompilerMSL::emit_custom_functions() break; case SPVFuncImplArrayCopy: - statement("// Implementation of an array copy function to cover GLSL's ability to copy an array via " - "assignment."); - statement("template"); - statement("void spvArrayCopyFromStack1(thread T (&dst)[N], thread const T (&src)[N])"); - begin_scope(); - statement("for (uint i = 0; i < N; dst[i] = src[i], i++);"); - end_scope(); - statement(""); - - statement("template"); - statement("void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N])"); - begin_scope(); - statement("for (uint i = 0; i < N; dst[i] = src[i], i++);"); - end_scope(); - statement(""); - break; - case SPVFuncImplArrayOfArrayCopy2Dim: case SPVFuncImplArrayOfArrayCopy3Dim: case SPVFuncImplArrayOfArrayCopy4Dim: case SPVFuncImplArrayOfArrayCopy5Dim: case SPVFuncImplArrayOfArrayCopy6Dim: { + // Unfortunately we cannot template on the address space, so combinatorial explosion it is. static const char *function_name_tags[] = { - "FromStack", - "FromConstant", + "FromConstantToStack", "FromConstantToThreadGroup", "FromStackToStack", + "FromStackToThreadGroup", "FromThreadGroupToStack", "FromThreadGroupToThreadGroup", }; static const char *src_address_space[] = { - "thread const", - "constant", + "constant", "constant", "thread const", "thread const", "threadgroup const", "threadgroup const", }; - for (uint32_t variant = 0; variant < 2; variant++) + static const char *dst_address_space[] = { + "thread", "threadgroup", "thread", "threadgroup", "thread", "threadgroup", + }; + + for (uint32_t variant = 0; variant < 6; variant++) { uint32_t dimensions = spv_func - SPVFuncImplArrayCopyMultidimBase; string tmp = "templateself); - emit_array_copy(to_expression(id_lhs), id_rhs); + emit_array_copy(to_expression(id_lhs), id_rhs, get_backing_variable_storage(id_lhs), + get_backing_variable_storage(id_rhs)); register_write(id_lhs); return true; @@ -5339,10 +5369,11 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) add_function_overload(func); local_variable_names = resource_names; - string decl; processing_entry_point = (func.self == ir.default_entry_point); + string decl = processing_entry_point ? "" : "inline "; + auto &type = get(func.return_type); if (type.array.empty()) @@ -5352,7 +5383,7 @@ void CompilerMSL::emit_function_prototype(SPIRFunction &func, const Bitset &) else { // We cannot return arrays in MSL, so "return" through an out variable. - decl = "void"; + decl += "void"; } decl += " "; @@ -9605,6 +9636,10 @@ void CompilerMSL::bitcast_from_builtin_load(uint32_t source_id, std::string &exp case BuiltInSubgroupSize: case BuiltInSubgroupLocalInvocationId: case BuiltInViewIndex: + case BuiltInVertexIndex: + case BuiltInInstanceIndex: + case BuiltInBaseInstance: + case BuiltInBaseVertex: expected_type = SPIRType::UInt; break; diff --git a/3rdparty/spirv-cross/spirv_msl.hpp b/3rdparty/spirv-cross/spirv_msl.hpp index f0858c9da..7666c743b 100644 --- a/3rdparty/spirv-cross/spirv_msl.hpp +++ b/3rdparty/spirv-cross/spirv_msl.hpp @@ -555,7 +555,8 @@ protected: void add_pragma_line(const std::string &line); void add_typedef_line(const std::string &line); void emit_barrier(uint32_t id_exe_scope, uint32_t id_mem_scope, uint32_t id_mem_sem); - void emit_array_copy(const std::string &lhs, uint32_t rhs_id) override; + void emit_array_copy(const std::string &lhs, uint32_t rhs_id, spv::StorageClass lhs_storage, + spv::StorageClass rhs_storage) override; void build_implicit_builtins(); uint32_t build_constant_uint_array_pointer(); void emit_entry_point_declarations() override;