Jelajahi Sumber

Updated spirv-cross.

Бранимир Караџић 6 tahun lalu
induk
melakukan
f3544e0b2c
100 mengubah file dengan 10883 tambahan dan 742 penghapusan
  1. 10 0
      3rdparty/spirv-cross/CMakeLists.txt
  2. 13 0
      3rdparty/spirv-cross/main.cpp
  3. 0 22
      3rdparty/spirv-cross/reference/opt/shaders-hlsl/comp/atomic-decrement.asm.comp
  4. 0 22
      3rdparty/spirv-cross/reference/opt/shaders-hlsl/comp/atomic-increment.asm.comp
  5. 2 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp
  6. 2 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp
  7. 2 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp
  8. 2 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp
  9. 42 57
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag
  10. 41 2
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag
  11. 43 2
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag
  12. 121 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.frag
  13. 122 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag
  14. 43 58
      3rdparty/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc
  15. 59 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/comp/complex-composite-constant-array.comp
  16. 44 59
      3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp
  17. 40 55
      3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp
  18. 10 5
      3rdparty/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp
  19. 42 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-work-group-size.comp
  20. 45 4
      3rdparty/spirv-cross/reference/opt/shaders-msl/comp/storage-buffer-std140-vector-array.comp
  21. 43 2
      3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc
  22. 2 4
      3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc
  23. 42 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag
  24. 68 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/array-of-array-lut.frag
  25. 2 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag
  26. 47 5
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/constant-array.frag
  27. 44 2
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/constant-composites.frag
  28. 42 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/fragment-component-padding.pad-fragment.frag
  29. 40 55
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag
  30. 40 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag
  31. 23 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag
  32. 22 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.frag
  33. 58 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag
  34. 67 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.tesc
  35. 77 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.tesc
  36. 70 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.tesc
  37. 6 10
      3rdparty/spirv-cross/reference/opt/shaders-msl/tese/input-types.tese
  38. 85 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array-of-matrix.tese
  39. 78 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array.tese
  40. 43 2
      3rdparty/spirv-cross/reference/opt/shaders-msl/tese/triangle-tess-level.tese
  41. 137 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/vert/float-math.invariant-float-math.vert
  42. 88 0
      3rdparty/spirv-cross/reference/opt/shaders-msl/vert/float-math.vert
  43. 6 3
      3rdparty/spirv-cross/reference/opt/shaders-msl/vert/functions.vert
  44. 42 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/vert/in_out_array_mat.vert
  45. 42 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.frag
  46. 42 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.vert
  47. 2 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert
  48. 42 1
      3rdparty/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag
  49. 356 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/array-copy-error.asm.frag
  50. 314 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag
  51. 1364 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/global-constant-arrays.asm.frag
  52. 1413 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag
  53. 356 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/phi-variable-declaration.asm.frag
  54. 503 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag
  55. 213 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag
  56. 121 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.frag
  57. 122 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag
  58. 318 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.asm.tesc
  59. 467 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.asm.tesc
  60. 411 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.asm.tesc
  61. 178 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.asm.tesc
  62. 419 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese
  63. 415 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese
  64. 216 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese
  65. 318 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-texcoord-array.asm.tese
  66. 466 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/vert/array-missing-copies.asm.vert
  67. 122 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/vert/loop-accesschain-writethrough.asm.vert
  68. 387 0
      3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/vert/texture-buffer.asm.vert
  69. 1 1
      3rdparty/spirv-cross/reference/opt/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp
  70. 37 0
      3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag
  71. 2 1
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp
  72. 6 3
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp
  73. 35 0
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag
  74. 0 235
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag
  75. 4 2
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag
  76. 6 3
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag
  77. 8 4
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag
  78. 2 1
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag
  79. 1 4
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert
  80. 42 1
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag
  81. 43 4
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp
  82. 10 5
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp
  83. 4 2
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag
  84. 2 1
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag
  85. 4 2
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag
  86. 2 1
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag
  87. 2 1
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag
  88. 17 0
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec3.comp
  89. 17 0
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec4.comp
  90. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp
  91. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp
  92. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp
  93. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp
  94. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp
  95. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp
  96. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp
  97. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp
  98. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp
  99. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp
  100. 16 8
      3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp

+ 10 - 0
3rdparty/spirv-cross/CMakeLists.txt

@@ -565,6 +565,16 @@ if (SPIRV_CROSS_CLI)
 						${spirv-cross-externals}
 						${CMAKE_CURRENT_SOURCE_DIR}/shaders-reflection
 						WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
+				add_test(NAME spirv-cross-test-ue4
+						COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --msl --parallel
+						${spirv-cross-externals}
+						${CMAKE_CURRENT_SOURCE_DIR}/shaders-ue4
+						WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
+				add_test(NAME spirv-cross-test-ue4-opt
+						COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --msl --opt --parallel
+						${spirv-cross-externals}
+						${CMAKE_CURRENT_SOURCE_DIR}/shaders-ue4
+						WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
 			endif()
 		elseif(NOT ${PYTHONINTERP_FOUND})
 			message(WARNING "Testing disabled. Could not find python3. If you have python3 installed try running "

+ 13 - 0
3rdparty/spirv-cross/main.cpp

@@ -514,6 +514,9 @@ struct CLIArguments
 	bool msl_domain_lower_left = false;
 	bool msl_argument_buffers = false;
 	bool msl_texture_buffer_native = false;
+	bool msl_framebuffer_fetch = false;
+	bool msl_invariant_float_math = false;
+	bool msl_emulate_cube_array = false;
 	bool msl_multiview = false;
 	bool msl_view_index_from_device_index = false;
 	bool msl_dispatch_base = false;
@@ -598,6 +601,8 @@ static void print_help()
 	                "\t[--msl-domain-lower-left]\n"
 	                "\t[--msl-argument-buffers]\n"
 	                "\t[--msl-texture-buffer-native]\n"
+	                "\t[--msl-framebuffer-fetch]\n"
+	                "\t[--msl-emulate-cube-array]\n"
 	                "\t[--msl-discrete-descriptor-set <index>]\n"
 	                "\t[--msl-device-argument-buffer <index>]\n"
 	                "\t[--msl-multiview]\n"
@@ -756,8 +761,13 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
 			msl_opts.msl_version = args.msl_version;
 		msl_opts.capture_output_to_buffer = args.msl_capture_output_to_buffer;
 		msl_opts.swizzle_texture_samples = args.msl_swizzle_texture_samples;
+		msl_opts.invariant_float_math = args.msl_invariant_float_math;
 		if (args.msl_ios)
+		{
 			msl_opts.platform = CompilerMSL::Options::iOS;
+			msl_opts.ios_use_framebuffer_fetch_subpasses = args.msl_framebuffer_fetch;
+			msl_opts.emulate_cube_array = args.msl_emulate_cube_array;
+		}
 		msl_opts.pad_fragment_output_components = args.msl_pad_fragment_output;
 		msl_opts.tess_domain_origin_lower_left = args.msl_domain_lower_left;
 		msl_opts.argument_buffers = args.msl_argument_buffers;
@@ -1093,6 +1103,9 @@ static int main_inner(int argc, char *argv[])
 	cbs.add("--msl-device-argument-buffer",
 	        [&args](CLIParser &parser) { args.msl_device_argument_buffers.push_back(parser.next_uint()); });
 	cbs.add("--msl-texture-buffer-native", [&args](CLIParser &) { args.msl_texture_buffer_native = true; });
+	cbs.add("--msl-framebuffer-fetch", [&args](CLIParser &) { args.msl_framebuffer_fetch = true; });
+	cbs.add("--msl-invariant-float-math", [&args](CLIParser &) { args.msl_invariant_float_math = true; });
+	cbs.add("--msl-emulate-cube-array", [&args](CLIParser &) { args.msl_emulate_cube_array = true; });
 	cbs.add("--msl-multiview", [&args](CLIParser &) { args.msl_multiview = true; });
 	cbs.add("--msl-view-index-from-device-index",
 	        [&args](CLIParser &) { args.msl_view_index_from_device_index = true; });

+ 0 - 22
3rdparty/spirv-cross/reference/opt/shaders-hlsl/comp/atomic-decrement.asm.comp

@@ -1,22 +0,0 @@
-RWByteAddressBuffer u0_counter : register(u1);
-RWBuffer<uint> u0 : register(u0);
-
-static uint3 gl_GlobalInvocationID;
-struct SPIRV_Cross_Input
-{
-    uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
-};
-
-void comp_main()
-{
-    uint _29;
-    u0_counter.InterlockedAdd(0, -1, _29);
-    u0[uint(asint(asfloat(_29))) + 0u] = uint(int(gl_GlobalInvocationID.x)).x;
-}
-
-[numthreads(4, 1, 1)]
-void main(SPIRV_Cross_Input stage_input)
-{
-    gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
-    comp_main();
-}

+ 0 - 22
3rdparty/spirv-cross/reference/opt/shaders-hlsl/comp/atomic-increment.asm.comp

@@ -1,22 +0,0 @@
-RWByteAddressBuffer u0_counter : register(u1);
-RWBuffer<uint> u0 : register(u0);
-
-static uint3 gl_GlobalInvocationID;
-struct SPIRV_Cross_Input
-{
-    uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
-};
-
-void comp_main()
-{
-    uint _29;
-    u0_counter.InterlockedAdd(0, 1, _29);
-    u0[uint(asint(asfloat(_29))) + 0u] = uint(int(gl_GlobalInvocationID.x)).x;
-}
-
-[numthreads(4, 1, 1)]
-void main(SPIRV_Cross_Input stage_input)
-{
-    gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
-    comp_main();
-}

+ 2 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-decrement.asm.comp

@@ -13,7 +13,8 @@ struct u0_counters
 };
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 2 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/atomic-increment.asm.comp

@@ -13,7 +13,8 @@ struct u0_counters
 };
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 2 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write-relative-addr.asm.comp

@@ -11,7 +11,8 @@ struct cb5_struct
 };
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 2 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/comp/buffer-write.asm.comp

@@ -11,7 +11,8 @@ struct cb
 };
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 42 - 57
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag

@@ -1,82 +1,67 @@
 #pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
 
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
-constant float _46[16] = { 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 };
-constant float4 _76[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
-constant float4 _90[4] = { float4(20.0), float4(30.0), float4(50.0), float4(60.0) };
-
-struct main0_out
-{
-    float FragColor [[color(0)]];
-};
-
-struct main0_in
-{
-    int index [[user(locn0)]];
-};
-
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
+template<typename T, size_t Num>
+struct spvUnsafeArray
 {
-    for (uint i = 0; i < A; i++)
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    constexpr const thread T& operator [] (size_t pos) const thread
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    
+    device T& operator [] (size_t pos) device
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    constexpr const device T& operator [] (size_t pos) const device
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+constant spvUnsafeArray<float, 16> _46 = spvUnsafeArray<float, 16>({ 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 });
+constant spvUnsafeArray<float4, 4> _76 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
+constant spvUnsafeArray<float4, 4> _90 = spvUnsafeArray<float4, 4>({ float4(20.0), float4(30.0), float4(50.0), float4(60.0) });
+
+struct main0_out
+{
+    float FragColor [[color(0)]];
+};
+
+struct main0_in
+{
+    int index [[user(locn0)]];
+};
 
 fragment main0_out main0(main0_in in [[stage_in]])
 {
-    float4 foobar[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
-    float4 baz[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
+    spvUnsafeArray<float4, 4> foobar = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
+    spvUnsafeArray<float4, 4> baz = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
     main0_out out = {};
     out.FragColor = _46[in.index];
     if (in.index < 10)
@@ -102,7 +87,7 @@ fragment main0_out main0(main0_in in [[stage_in]])
     }
     int _37 = in.index & 3;
     out.FragColor += foobar[_37].z;
-    spvArrayCopyFromConstantToStack1(baz, _90);
+    baz = _90;
     out.FragColor += baz[_37].z;
     return out;
 }

+ 41 - 2
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/single-function-private-lut.asm.frag

@@ -1,17 +1,54 @@
 #pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
 
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct myType
 {
     float data;
 };
 
-constant myType _21[5] = { myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 } };
-
 struct main0_out
 {
     float4 o_color [[color(0)]];
@@ -26,6 +63,8 @@ inline Tx mod(Tx x, Ty y)
 
 fragment main0_out main0(float4 gl_FragCoord [[position]])
 {
+    spvUnsafeArray<myType, 5> _21 = spvUnsafeArray<myType, 5>({ myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 } });
+    
     main0_out out = {};
     if (_21[int(mod(gl_FragCoord.x, 4.0))].data > 0.0)
     {

+ 43 - 2
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/storage-class-output-initializer.asm.frag

@@ -1,9 +1,50 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
-constant float4 _20[2] = { float4(1.0, 2.0, 3.0, 4.0), float4(10.0) };
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+constant spvUnsafeArray<float4, 2> _20 = spvUnsafeArray<float4, 2>({ float4(1.0, 2.0, 3.0, 4.0), float4(10.0) });
 
 struct main0_out
 {
@@ -15,7 +56,7 @@ struct main0_out
 fragment main0_out main0()
 {
     main0_out out = {};
-    float4 FragColors[2] = { float4(1.0, 2.0, 3.0, 4.0), float4(10.0) };
+    spvUnsafeArray<float4, 2> FragColors = spvUnsafeArray<float4, 2>({ float4(1.0, 2.0, 3.0, 4.0), float4(10.0) });
     out.FragColor = float4(5.0);
     out.FragColors_0 = FragColors[0];
     out.FragColors_1 = FragColors[1];

+ 121 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.frag

@@ -0,0 +1,121 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+#pragma clang diagnostic ignored "-Wunused-variable"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+#include <metal_atomic>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_StructuredBuffer_v4float
+{
+    spvUnsafeArray<float4, 1> _m0;
+};
+
+struct type_Globals
+{
+    uint2 ShadowTileListGroupSize;
+};
+
+constant float3 _70 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+};
+
+struct main0_in
+{
+    uint in_var_TEXCOORD0 [[user(locn0)]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<uint> RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]])
+{
+    main0_out out = {};
+    uint2 _77 = uint2(gl_FragCoord.xy);
+    uint _78 = _77.y;
+    uint _83 = _77.x;
+    float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78));
+    float2 _93 = float2(_Globals.ShadowTileListGroupSize);
+    float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0);
+    float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0);
+    float3 _102 = float3(_100.x, _100.y, _70.z);
+    _102.z = 1.0;
+    uint _103 = in.in_var_TEXCOORD0 * 5u;
+    uint _107 = _103 + 1u;
+    if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _102))
+    {
+        float _122 = _96.x;
+        float _123 = _96.y;
+        spvUnsafeArray<float3, 8> _73;
+        _73[0] = float3(_122, _123, -1000.0);
+        float _126 = _100.x;
+        _73[1] = float3(_126, _123, -1000.0);
+        float _129 = _100.y;
+        _73[2] = float3(_122, _129, -1000.0);
+        _73[3] = float3(_126, _129, -1000.0);
+        _73[4] = float3(_122, _123, 1.0);
+        _73[5] = float3(_126, _123, 1.0);
+        _73[6] = float3(_122, _129, 1.0);
+        _73[7] = float3(_126, _129, 1.0);
+        float3 _155;
+        float3 _158;
+        _155 = float3(-500000.0);
+        _158 = float3(500000.0);
+        for (int _160 = 0; _160 < 8; )
+        {
+            float3 _166 = _73[_160] - (float3(0.5) * (CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz));
+            float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz));
+            _155 = fast::max(_155, _170);
+            _158 = fast::min(_158, _170);
+            _160++;
+            continue;
+        }
+        if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0)))
+        {
+            uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed);
+        }
+    }
+    out.out_var_SV_Target0 = float4(0.0);
+    return out;
+}
+

+ 122 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/frag/texture-atomics.asm.graphics-robust-access.frag

@@ -0,0 +1,122 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+#pragma clang diagnostic ignored "-Wunused-variable"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+#include <metal_atomic>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_StructuredBuffer_v4float
+{
+    spvUnsafeArray<float4, 1> _m0;
+};
+
+struct type_Globals
+{
+    uint2 ShadowTileListGroupSize;
+};
+
+constant float3 _70 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+};
+
+struct main0_in
+{
+    uint in_var_TEXCOORD0 [[user(locn0)]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvBufferSizeConstants [[buffer(25)]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<uint> RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]])
+{
+    main0_out out = {};
+    constant uint& CulledObjectBoxBoundsBufferSize = spvBufferSizeConstants[0];
+    uint2 _77 = uint2(gl_FragCoord.xy);
+    uint _78 = _77.y;
+    uint _83 = _77.x;
+    float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78));
+    float2 _93 = float2(_Globals.ShadowTileListGroupSize);
+    float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0);
+    float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0);
+    float3 _102 = float3(_100.x, _100.y, _70.z);
+    _102.z = 1.0;
+    uint _103 = in.in_var_TEXCOORD0 * 5u;
+    uint _186 = clamp(_103 + 1u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u);
+    if (all(CulledObjectBoxBounds._m0[_186].xy > _96.xy) && all(CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz < _102))
+    {
+        float _122 = _96.x;
+        float _123 = _96.y;
+        spvUnsafeArray<float3, 8> _73;
+        _73[0] = float3(_122, _123, -1000.0);
+        float _126 = _100.x;
+        _73[1] = float3(_126, _123, -1000.0);
+        float _129 = _100.y;
+        _73[2] = float3(_122, _129, -1000.0);
+        _73[3] = float3(_126, _129, -1000.0);
+        _73[4] = float3(_122, _123, 1.0);
+        _73[5] = float3(_126, _123, 1.0);
+        _73[6] = float3(_122, _129, 1.0);
+        _73[7] = float3(_126, _129, 1.0);
+        float3 _155;
+        float3 _158;
+        _155 = float3(-500000.0);
+        _158 = float3(500000.0);
+        for (int _160 = 0; _160 < 8; )
+        {
+            float3 _166 = _73[int(clamp(uint(_160), uint(0), uint(7)))] - (float3(0.5) * (CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz + CulledObjectBoxBounds._m0[_186].xyz));
+            float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 2u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 3u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 4u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz));
+            _155 = fast::max(_155, _170);
+            _158 = fast::min(_158, _170);
+            _160++;
+            continue;
+        }
+        if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0)))
+        {
+            uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed);
+        }
+    }
+    out.out_var_SV_Target0 = float4(0.0);
+    return out;
+}
+

+ 43 - 58
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc

@@ -1,10 +1,49 @@
 #pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
 
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct VertexOutput
 {
     float4 pos;
@@ -33,60 +72,6 @@ struct main0_in
     float4 gl_Position [[attribute(1)]];
 };
 
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-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)]])
 {
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
@@ -95,12 +80,12 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_
     threadgroup_barrier(mem_flags::mem_threadgroup);
     if (gl_InvocationID >= 3)
         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];
-    spvArrayCopyFromStackToStack1(param, _223);
+    spvUnsafeArray<VertexOutput, 3> _223 = spvUnsafeArray<VertexOutput, 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 } });
+    spvUnsafeArray<VertexOutput, 3> param;
+    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);
+    threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
     if (int(gl_InvocationID) == 0)
     {
         float2 _174 = float2(1.0) + gl_in[0].VertexOutput_uv;

+ 59 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/comp/complex-composite-constant-array.comp

@@ -0,0 +1,59 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct SSBO
+{
+    float4x4 a;
+    uint index;
+};
+
+kernel void main0(device SSBO& _14 [[buffer(0)]])
+{
+    spvUnsafeArray<float4x4, 2> _32 = spvUnsafeArray<float4x4, 2>({ float4x4(float4(1.0, 0.0, 0.0, 0.0), float4(0.0, 1.0, 0.0, 0.0), float4(0.0, 0.0, 1.0, 0.0), float4(0.0, 0.0, 0.0, 1.0)), float4x4(float4(2.0, 0.0, 0.0, 0.0), float4(0.0, 2.0, 0.0, 0.0), float4(0.0, 0.0, 2.0, 0.0), float4(0.0, 0.0, 0.0, 2.0)) });
+    
+    _14.a = _32[_14.index];
+}
+

+ 44 - 59
3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-array-initialization.comp

@@ -1,10 +1,49 @@
 #pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
 
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct Data
 {
     float a;
@@ -27,67 +66,13 @@ struct SSBO
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u);
 
-constant Data _25[2] = { Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } };
-
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
-    {
-        dst[i] = src[i];
-    }
-}
-
-template<typename T, uint A>
-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];
-    spvArrayCopyFromStackToStack1(data2, _31);
+    spvUnsafeArray<Data, 2> _25 = spvUnsafeArray<Data, 2>({ Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } });
+    
+    spvUnsafeArray<Data, 2> _31 = spvUnsafeArray<Data, 2>({ Data{ X, 2.0 }, Data{ 3.0, 5.0 } });
+    spvUnsafeArray<Data, 2> data2;
+    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;
 }

+ 40 - 55
3rdparty/spirv-cross/reference/opt/shaders-msl/comp/composite-construct.comp

@@ -1,81 +1,66 @@
 #pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
 
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
-struct SSBO0
-{
-    float4 as[1];
-};
-
-struct SSBO1
-{
-    float4 bs[1];
-};
-
-constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
-
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
+template<typename T, size_t Num>
+struct spvUnsafeArray
 {
-    for (uint i = 0; i < A; i++)
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    constexpr const thread T& operator [] (size_t pos) const thread
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    
+    device T& operator [] (size_t pos) device
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    constexpr const device T& operator [] (size_t pos) const device
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct SSBO0
+{
+    float4 as[1];
+};
+
+struct SSBO1
+{
+    float4 bs[1];
+};
+
+constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
 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];
-    spvArrayCopyFromStackToStack1(values, _37);
+    spvUnsafeArray<float4, 2> _37 = spvUnsafeArray<float4, 2>({ _16.as[gl_GlobalInvocationID.x], _32.bs[gl_GlobalInvocationID.x] });
+    spvUnsafeArray<float4, 2> values;
+    values = _37;
     _16.as[0] = values[gl_LocalInvocationIndex];
     _32.bs[1] = float4(40.0);
 }

+ 10 - 5
3rdparty/spirv-cross/reference/opt/shaders-msl/comp/inverse.comp

@@ -22,20 +22,23 @@ struct MatrixIn
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
 // Returns the determinant of a 2x2 matrix.
-inline float spvDet2x2(float a1, float a2, float b1, float b2)
+static inline __attribute__((always_inline))
+float spvDet2x2(float a1, float a2, float b1, float b2)
 {
     return a1 * b2 - b1 * a2;
 }
 
 // Returns the determinant of a 3x3 matrix.
-inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
+static inline __attribute__((always_inline))
+float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
 {
     return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3);
 }
 
 // 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.
-inline float4x4 spvInverse4x4(float4x4 m)
+static inline __attribute__((always_inline))
+float4x4 spvInverse4x4(float4x4 m)
 {
     float4x4 adj;	// The adjoint matrix (inverse after dividing by determinant)
 
@@ -70,7 +73,8 @@ inline 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.
-inline float3x3 spvInverse3x3(float3x3 m)
+static inline __attribute__((always_inline))
+float3x3 spvInverse3x3(float3x3 m)
 {
     float3x3 adj;	// The adjoint matrix (inverse after dividing by determinant)
 
@@ -97,7 +101,8 @@ inline 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.
-inline float2x2 spvInverse2x2(float2x2 m)
+static inline __attribute__((always_inline))
+float2x2 spvInverse2x2(float2x2 m)
 {
     float2x2 adj;	// The adjoint matrix (inverse after dividing by determinant)
 

+ 42 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/comp/spec-constant-work-group-size.comp

@@ -1,8 +1,49 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 #ifndef SPIRV_CROSS_CONSTANT_ID_1
 #define SPIRV_CROSS_CONSTANT_ID_1 2
 #endif
@@ -27,7 +68,7 @@ constant int _32 = (1 - a);
 
 kernel void main0(device SSBO& _17 [[buffer(0)]])
 {
-    int spec_const_array_size[b];
+    spvUnsafeArray<int, b> spec_const_array_size;
     spec_const_array_size[a] = a;
     _17.v[_30] = b + spec_const_array_size[_32];
 }

+ 45 - 4
3rdparty/spirv-cross/reference/opt/shaders-msl/comp/storage-buffer-std140-vector-array.comp

@@ -1,8 +1,49 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct Sub
 {
     float4 f[2];
@@ -20,16 +61,16 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
 kernel void main0(device SSBO& _27 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
 {
-    float _155[2];
+    spvUnsafeArray<float, 2> _155;
     _155[0] = _27.sub[gl_WorkGroupID.x].f[0].x;
     _155[1] = _27.sub[gl_WorkGroupID.x].f[1].x;
-    float2 _156[2];
+    spvUnsafeArray<float2, 2> _156;
     _156[0] = _27.sub[gl_WorkGroupID.x].f2[0].xy;
     _156[1] = _27.sub[gl_WorkGroupID.x].f2[1].xy;
-    float3 _157[2];
+    spvUnsafeArray<float3, 2> _157;
     _157[0] = _27.sub[gl_WorkGroupID.x].f3[0];
     _157[1] = _27.sub[gl_WorkGroupID.x].f3[1];
-    float4 _158[2];
+    spvUnsafeArray<float4, 2> _158;
     _158[0] = _27.sub[gl_WorkGroupID.x].f4[0];
     _158[1] = _27.sub[gl_WorkGroupID.x].f4[1];
     _155[gl_GlobalInvocationID.x] += 1.0;

+ 43 - 2
3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc

@@ -1,8 +1,49 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct main0_out
 {
     float3 vVertex;
@@ -10,7 +51,7 @@ struct main0_out
 
 struct main0_patchOut
 {
-    float3 vPatch[2];
+    spvUnsafeArray<float3, 2> vPatch;
 };
 
 struct main0_in
@@ -28,7 +69,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_
     if (gl_InvocationID >= 4)
         return;
     gl_out[gl_InvocationID].vVertex = gl_in[gl_InvocationID].vInput + gl_in[gl_InvocationID ^ 1].vInput;
-    threadgroup_barrier(mem_flags::mem_device);
+    threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
     if (gl_InvocationID == 0)
     {
         patchOut.vPatch[0] = float3(10.0);

+ 2 - 4
3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc

@@ -28,10 +28,8 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_
     threadgroup_barrier(mem_flags::mem_threadgroup);
     if (gl_InvocationID >= 4)
         return;
-    Boo vInput_24;
-    vInput_24.a = gl_in[gl_InvocationID].Boo_a;
-    vInput_24.b = gl_in[gl_InvocationID].Boo_b;
-    gl_out[gl_InvocationID].vVertex = vInput_24;
+    Boo _25 = Boo{ gl_in[gl_InvocationID].Boo_a, gl_in[gl_InvocationID].Boo_b };
+    gl_out[gl_InvocationID].vVertex = _25;
     spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0);
     spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(2.0);
     spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.0);

+ 42 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/array-lut-no-loop-variable.frag

@@ -1,9 +1,50 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
-constant float _17[5] = { 1.0, 2.0, 3.0, 4.0, 5.0 };
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+constant spvUnsafeArray<float, 5> _17 = spvUnsafeArray<float, 5>({ 1.0, 2.0, 3.0, 4.0, 5.0 });
 
 struct main0_out
 {

+ 68 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/array-of-array-lut.frag

@@ -0,0 +1,68 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+constant spvUnsafeArray<float, 3> _17 = spvUnsafeArray<float, 3>({ 1.0, 2.0, 3.0 });
+constant spvUnsafeArray<float, 3> _21 = spvUnsafeArray<float, 3>({ 4.0, 5.0, 6.0 });
+constant spvUnsafeArray<spvUnsafeArray<float, 3>, 2> _22 = spvUnsafeArray<spvUnsafeArray<float, 3>, 2>({ spvUnsafeArray<float, 3>({ 1.0, 2.0, 3.0 }), spvUnsafeArray<float, 3>({ 4.0, 5.0, 6.0 }) });
+
+struct main0_out
+{
+    float vOutput [[color(0)]];
+};
+
+struct main0_in
+{
+    int vIndex1 [[user(locn0)]];
+    int vIndex2 [[user(locn1)]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]])
+{
+    main0_out out = {};
+    out.vOutput = _22[in.vIndex1][in.vIndex2];
+    return out;
+}
+

+ 2 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/buffer-read-write.frag

@@ -11,7 +11,8 @@ struct main0_out
 };
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 47 - 5
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/constant-array.frag

@@ -1,19 +1,59 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct Foobar
 {
     float a;
     float b;
 };
 
-constant float4 _37[3] = { float4(1.0), float4(2.0), float4(3.0) };
-constant float4 _49[2] = { float4(1.0), float4(2.0) };
-constant float4 _54[2] = { float4(8.0), float4(10.0) };
-constant float4 _55[2][2] = { { float4(1.0), float4(2.0) }, { float4(8.0), float4(10.0) } };
-constant Foobar _75[2] = { Foobar{ 10.0, 40.0 }, Foobar{ 90.0, 70.0 } };
+constant spvUnsafeArray<float4, 3> _37 = spvUnsafeArray<float4, 3>({ float4(1.0), float4(2.0), float4(3.0) });
+constant spvUnsafeArray<float4, 2> _49 = spvUnsafeArray<float4, 2>({ float4(1.0), float4(2.0) });
+constant spvUnsafeArray<float4, 2> _54 = spvUnsafeArray<float4, 2>({ float4(8.0), float4(10.0) });
+constant spvUnsafeArray<spvUnsafeArray<float4, 2>, 2> _55 = spvUnsafeArray<spvUnsafeArray<float4, 2>, 2>({ spvUnsafeArray<float4, 2>({ float4(1.0), float4(2.0) }), spvUnsafeArray<float4, 2>({ float4(8.0), float4(10.0) }) });
 
 struct main0_out
 {
@@ -27,6 +67,8 @@ struct main0_in
 
 fragment main0_out main0(main0_in in [[stage_in]])
 {
+    spvUnsafeArray<Foobar, 2> _75 = spvUnsafeArray<Foobar, 2>({ Foobar{ 10.0, 40.0 }, Foobar{ 90.0, 70.0 } });
+    
     main0_out out = {};
     out.FragColor = ((_37[in.index] + _55[in.index][in.index + 1]) + float4(30.0)) + float4(_75[in.index].a + _75[in.index].b);
     return out;

+ 44 - 2
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/constant-composites.frag

@@ -1,16 +1,56 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct Foo
 {
     float a;
     float b;
 };
 
-constant float _16[4] = { 1.0, 4.0, 3.0, 2.0 };
-constant Foo _28[2] = { Foo{ 10.0, 20.0 }, Foo{ 30.0, 40.0 } };
+constant spvUnsafeArray<float, 4> _16 = spvUnsafeArray<float, 4>({ 1.0, 4.0, 3.0, 2.0 });
 
 struct main0_out
 {
@@ -24,6 +64,8 @@ struct main0_in
 
 fragment main0_out main0(main0_in in [[stage_in]])
 {
+    spvUnsafeArray<Foo, 2> _28 = spvUnsafeArray<Foo, 2>({ Foo{ 10.0, 20.0 }, Foo{ 30.0, 40.0 } });
+    
     main0_out out = {};
     out.FragColor = float4(_16[in.line]);
     out.FragColor += float4(_28[in.line].a * _28[1 - in.line].a);

+ 42 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/fragment-component-padding.pad-fragment.frag

@@ -1,8 +1,49 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct main0_out
 {
     float4 FragColors_0 [[color(0)]];
@@ -19,7 +60,7 @@ struct main0_in
 fragment main0_out main0(main0_in in [[stage_in]])
 {
     main0_out out = {};
-    float FragColors[2] = {};
+    spvUnsafeArray<float, 2> FragColors = {};
     float2 FragColor2 = {};
     float3 FragColor3 = {};
     FragColors[0] = in.vColor.x;

+ 40 - 55
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/lut-promotion.frag

@@ -1,77 +1,62 @@
 #pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
 
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
-constant float _16[16] = { 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 };
-constant float4 _60[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
-constant float4 _104[4] = { float4(20.0), float4(30.0), float4(50.0), float4(60.0) };
-
-struct main0_out
-{
-    float FragColor [[color(0)]];
-};
-
-struct main0_in
-{
-    int index [[user(locn0)]];
-};
-
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
+template<typename T, size_t Num>
+struct spvUnsafeArray
 {
-    for (uint i = 0; i < A; i++)
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    constexpr const thread T& operator [] (size_t pos) const thread
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    
+    device T& operator [] (size_t pos) device
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    constexpr const device T& operator [] (size_t pos) const device
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
-
-template<typename T, uint A>
-inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
-{
-    for (uint i = 0; i < A; i++)
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
     {
-        dst[i] = src[i];
+        return elements[pos];
     }
-}
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+constant spvUnsafeArray<float, 16> _16 = spvUnsafeArray<float, 16>({ 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 });
+constant spvUnsafeArray<float4, 4> _60 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
+constant spvUnsafeArray<float4, 4> _104 = spvUnsafeArray<float4, 4>({ float4(20.0), float4(30.0), float4(50.0), float4(60.0) });
+
+struct main0_out
+{
+    float FragColor [[color(0)]];
+};
+
+struct main0_in
+{
+    int index [[user(locn0)]];
+};
 
 fragment main0_out main0(main0_in in [[stage_in]])
 {
@@ -94,7 +79,7 @@ fragment main0_out main0(main0_in in [[stage_in]])
     {
         out.FragColor += _60[in.index & 1].x;
     }
-    float4 foobar[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
+    spvUnsafeArray<float4, 4> foobar = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
     if (_63)
     {
         foobar[1].z = 20.0;

+ 40 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/mrt-array.frag

@@ -1,10 +1,49 @@
 #pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
 
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct main0_out
 {
     float4 FragColor_0 [[color(0)]];
@@ -29,7 +68,7 @@ inline Tx mod(Tx x, Ty y)
 fragment main0_out main0(main0_in in [[stage_in]])
 {
     main0_out out = {};
-    float4 FragColor[4] = {};
+    spvUnsafeArray<float4, 4> FragColor = {};
     FragColor[0] = mod(in.vA, in.vB);
     FragColor[1] = in.vA + in.vB;
     FragColor[2] = in.vA - in.vB;

+ 23 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag

@@ -0,0 +1,23 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct main0_out
+{
+    float FragColor [[color(0)]];
+};
+
+struct main0_in
+{
+    float3 vUV [[user(locn0)]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> uTexture [[texture(0)]], sampler uSampler [[sampler(0)]], sampler uSamplerShadow [[sampler(1)]])
+{
+    main0_out out = {};
+    out.FragColor = float4(uTexture.sample(uSampler, in.vUV.xy)).x;
+    out.FragColor += uTexture.sample_compare(uSamplerShadow, in.vUV.xy, in.vUV.z);
+    return out;
+}
+

+ 22 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.frag

@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct main0_out
+{
+    float4 FragColor [[color(0)]];
+};
+
+struct main0_in
+{
+    float4 vUV [[user(locn0)]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], texturecube<float> cubeSampler [[texture(0)]], texturecube_array<float> cubeArraySampler [[texture(1)]], texture2d_array<float> texArraySampler [[texture(2)]], sampler cubeSamplerSmplr [[sampler(0)]], sampler cubeArraySamplerSmplr [[sampler(1)]], sampler texArraySamplerSmplr [[sampler(2)]])
+{
+    main0_out out = {};
+    out.FragColor = (cubeSampler.sample(cubeSamplerSmplr, in.vUV.xyz) + cubeArraySampler.sample(cubeArraySamplerSmplr, in.vUV.xyz, uint(round(in.vUV.w)))) + texArraySampler.sample(texArraySamplerSmplr, in.vUV.xyz.xy, uint(round(in.vUV.xyz.z)));
+    return out;
+}
+

+ 58 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/frag/texture-cube-array.ios.emulate-cube-array.frag

@@ -0,0 +1,58 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct main0_out
+{
+    float4 FragColor [[color(0)]];
+};
+
+struct main0_in
+{
+    float4 vUV [[user(locn0)]];
+};
+
+static inline __attribute__((always_inline))
+float3 spvCubemapTo2DArrayFace(float3 P)
+{
+    float3 Coords = abs(P.xyz);
+    float CubeFace = 0;
+    float ProjectionAxis = 0;
+    float u = 0;
+    float v = 0;
+    if (Coords.x >= Coords.y && Coords.x >= Coords.z)
+    {
+        CubeFace = P.x >= 0 ? 0 : 1;
+        ProjectionAxis = Coords.x;
+        u = P.x >= 0 ? -P.z : P.z;
+        v = -P.y;
+    }
+    else if (Coords.y >= Coords.x && Coords.y >= Coords.z)
+    {
+        CubeFace = P.y >= 0 ? 2 : 3;
+        ProjectionAxis = Coords.y;
+        u = P.x;
+        v = P.y >= 0 ? P.z : -P.z;
+    }
+    else
+    {
+        CubeFace = P.z >= 0 ? 4 : 5;
+        ProjectionAxis = Coords.z;
+        u = P.z >= 0 ? P.x : -P.x;
+        v = -P.y;
+    }
+    u = 0.5 * (u/ProjectionAxis + 1);
+    v = 0.5 * (v/ProjectionAxis + 1);
+    return float3(u, v, CubeFace);
+}
+
+fragment main0_out main0(main0_in in [[stage_in]], texturecube<float> cubeSampler [[texture(0)]], texture2d_array<float> cubeArraySampler [[texture(1)]], texture2d_array<float> texArraySampler [[texture(2)]], sampler cubeSamplerSmplr [[sampler(0)]], sampler cubeArraySamplerSmplr [[sampler(1)]], sampler texArraySamplerSmplr [[sampler(2)]])
+{
+    main0_out out = {};
+    out.FragColor = (cubeSampler.sample(cubeSamplerSmplr, in.vUV.xyz) + cubeArraySampler.sample(cubeArraySamplerSmplr, spvCubemapTo2DArrayFace(in.vUV.xyz).xy, uint(spvCubemapTo2DArrayFace(in.vUV.xyz).z) + (uint(round(in.vUV.w)) * 6u))) + texArraySampler.sample(texArraySamplerSmplr, in.vUV.xyz.xy, uint(round(in.vUV.xyz.z)));
+    return out;
+}
+

File diff ditekan karena terlalu besar
+ 67 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-matrix.tesc


File diff ditekan karena terlalu besar
+ 77 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array-of-struct.tesc


+ 70 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/tesc/load-control-point-array.tesc

@@ -0,0 +1,70 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct main0_out
+{
+    float4 vOutputs;
+};
+
+struct main0_in
+{
+    float4 vInputs [[attribute(0)]];
+};
+
+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 MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+{
+    device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
+    if (gl_InvocationID < spvIndirectParams[0])
+        gl_in[gl_InvocationID] = in;
+    threadgroup_barrier(mem_flags::mem_threadgroup);
+    if (gl_InvocationID >= 4)
+        return;
+    spvUnsafeArray<float4, 32> _15 = spvUnsafeArray<float4, 32>({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs });
+    spvUnsafeArray<float4, 32> tmp;
+    tmp = _15;
+    gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID];
+}
+

+ 6 - 10
3rdparty/spirv-cross/reference/opt/shaders-msl/tese/input-types.tese

@@ -65,16 +65,12 @@ struct main0_patchIn
     out.gl_Position += patchIn.vColors;
     out.gl_Position += vFoo.a;
     out.gl_Position += vFoo.b;
-    Foo vFoos_202;
-    vFoos_202.a = patchIn.gl_in[0].Foo_a;
-    vFoos_202.b = patchIn.gl_in[0].Foo_b;
-    out.gl_Position += vFoos_202.a;
-    out.gl_Position += vFoos_202.b;
-    Foo vFoos_216;
-    vFoos_216.a = patchIn.gl_in[1].Foo_a;
-    vFoos_216.b = patchIn.gl_in[1].Foo_b;
-    out.gl_Position += vFoos_216.a;
-    out.gl_Position += vFoos_216.b;
+    Foo _203 = Foo{ patchIn.gl_in[0].Foo_a, patchIn.gl_in[0].Foo_b };
+    out.gl_Position += _203.a;
+    out.gl_Position += _203.b;
+    Foo _217 = Foo{ patchIn.gl_in[1].Foo_a, patchIn.gl_in[1].Foo_b };
+    out.gl_Position += _217.a;
+    out.gl_Position += _217.b;
     return out;
 }
 

+ 85 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array-of-matrix.tese

@@ -0,0 +1,85 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct main0_out
+{
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float4 vInputs_0 [[attribute(0)]];
+    float4 vInputs_1 [[attribute(1)]];
+    float4 vInputs_2 [[attribute(2)]];
+    float4 vInputs_3 [[attribute(3)]];
+};
+
+struct main0_patchIn
+{
+    float4 vBoo_0 [[attribute(4)]];
+    float4 vBoo_1 [[attribute(5)]];
+    float4 vBoo_2 [[attribute(6)]];
+    float4 vBoo_3 [[attribute(7)]];
+    int vIndex [[attribute(8)]];
+    patch_control_point<main0_in> gl_in;
+};
+
+[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 4> vBoo = {};
+    vBoo[0] = patchIn.vBoo_0;
+    vBoo[1] = patchIn.vBoo_1;
+    vBoo[2] = patchIn.vBoo_2;
+    vBoo[3] = patchIn.vBoo_3;
+    float4x4 _57 = float4x4(patchIn.gl_in[0u].vInputs_0, patchIn.gl_in[0u].vInputs_1, patchIn.gl_in[0u].vInputs_2, patchIn.gl_in[0u].vInputs_3);
+    float4x4 _59 = float4x4(patchIn.gl_in[1u].vInputs_0, patchIn.gl_in[1u].vInputs_1, patchIn.gl_in[1u].vInputs_2, patchIn.gl_in[1u].vInputs_3);
+    float4x4 _47 = _57;
+    float4x4 _48 = _59;
+    out.gl_Position = (_47[patchIn.vIndex] + _48[patchIn.vIndex]) + vBoo[patchIn.vIndex];
+    return out;
+}
+

+ 78 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/tese/load-control-point-array.tese

@@ -0,0 +1,78 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct main0_out
+{
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float4 vInputs [[attribute(0)]];
+};
+
+struct main0_patchIn
+{
+    float4 vBoo_0 [[attribute(1)]];
+    float4 vBoo_1 [[attribute(2)]];
+    float4 vBoo_2 [[attribute(3)]];
+    float4 vBoo_3 [[attribute(4)]];
+    int vIndex [[attribute(5)]];
+    patch_control_point<main0_in> gl_in;
+};
+
+[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 4> vBoo = {};
+    vBoo[0] = patchIn.vBoo_0;
+    vBoo[1] = patchIn.vBoo_1;
+    vBoo[2] = patchIn.vBoo_2;
+    vBoo[3] = patchIn.vBoo_3;
+    out.gl_Position = (patchIn.gl_in[0u].vInputs + patchIn.gl_in[1u].vInputs) + vBoo[patchIn.vIndex];
+    return out;
+}
+

+ 43 - 2
3rdparty/spirv-cross/reference/opt/shaders-msl/tese/triangle-tess-level.tese

@@ -1,8 +1,49 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct main0_out
 {
     float4 gl_Position [[position]];
@@ -16,8 +57,8 @@ struct main0_patchIn
 [[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float3 gl_TessCoord [[position_in_patch]])
 {
     main0_out out = {};
-    float gl_TessLevelInner[2] = {};
-    float gl_TessLevelOuter[4] = {};
+    spvUnsafeArray<float, 2> gl_TessLevelInner = {};
+    spvUnsafeArray<float, 4> gl_TessLevelOuter = {};
     gl_TessLevelInner[0] = patchIn.gl_TessLevel.w;
     gl_TessLevelOuter[0] = patchIn.gl_TessLevel.x;
     gl_TessLevelOuter[1] = patchIn.gl_TessLevel.y;

+ 137 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/vert/float-math.invariant-float-math.vert

@@ -0,0 +1,137 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct Matrices
+{
+    float4x4 vpMatrix;
+    float4x4 wMatrix;
+    float4x3 wMatrix4x3;
+    float3x4 wMatrix3x4;
+};
+
+struct main0_out
+{
+    float3 OutNormal [[user(locn0)]];
+    float4 OutWorldPos_0 [[user(locn1)]];
+    float4 OutWorldPos_1 [[user(locn2)]];
+    float4 OutWorldPos_2 [[user(locn3)]];
+    float4 OutWorldPos_3 [[user(locn4)]];
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float3 InPos [[attribute(0)]];
+    float3 InNormal [[attribute(1)]];
+};
+
+template<typename T>
+T spvFMul(T l, T r)
+{
+    return fma(l, r, T(0));
+}
+
+template<typename T, int Cols, int Rows>
+vec<T, Cols> spvFMulVectorMatrix(vec<T, Rows> v, matrix<T, Cols, Rows> m)
+{
+    vec<T, Cols> res = vec<T, Cols>(0);
+    for (uint i = Rows; i > 0; --i)
+    {
+        vec<T, Cols> tmp(0);
+        for (uint j = 0; j < Cols; ++j)
+        {
+            tmp[j] = m[j][i - 1];
+        }
+        res = fma(tmp, vec<T, Cols>(v[i - 1]), res);
+    }
+    return res;
+}
+
+template<typename T, int Cols, int Rows>
+vec<T, Rows> spvFMulMatrixVector(matrix<T, Cols, Rows> m, vec<T, Cols> v)
+{
+    vec<T, Rows> res = vec<T, Rows>(0);
+    for (uint i = Cols; i > 0; --i)
+    {
+        res = fma(m[i - 1], vec<T, Rows>(v[i - 1]), res);
+    }
+    return res;
+}
+
+template<typename T, int LCols, int LRows, int RCols, int RRows>
+matrix<T, RCols, LRows> spvFMulMatrixMatrix(matrix<T, LCols, LRows> l, matrix<T, RCols, RRows> r)
+{
+    matrix<T, RCols, LRows> res;
+    for (uint i = 0; i < RCols; i++)
+    {
+        vec<T, RCols> tmp(0);
+        for (uint j = 0; j < LCols; j++)
+        {
+            tmp = fma(vec<T, RCols>(r[i][j]), l[j], tmp);
+        }
+        res[i] = tmp;
+    }
+    return res;
+}
+
+vertex main0_out main0(main0_in in [[stage_in]], constant Matrices& _22 [[buffer(0)]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 4> OutWorldPos = {};
+    float4 _37 = float4(in.InPos, 1.0);
+    out.gl_Position = spvFMulMatrixVector(spvFMulMatrixMatrix(_22.vpMatrix, _22.wMatrix), _37);
+    OutWorldPos[0] = spvFMulMatrixVector(_22.wMatrix, _37);
+    OutWorldPos[1] = spvFMulVectorMatrix(_37, _22.wMatrix);
+    OutWorldPos[2] = spvFMulMatrixVector(_22.wMatrix3x4, in.InPos);
+    OutWorldPos[3] = spvFMulVectorMatrix(in.InPos, _22.wMatrix4x3);
+    out.OutNormal = spvFMulMatrixVector(_22.wMatrix, float4(in.InNormal, 0.0)).xyz;
+    out.OutWorldPos_0 = OutWorldPos[0];
+    out.OutWorldPos_1 = OutWorldPos[1];
+    out.OutWorldPos_2 = OutWorldPos[2];
+    out.OutWorldPos_3 = OutWorldPos[3];
+    return out;
+}
+

+ 88 - 0
3rdparty/spirv-cross/reference/opt/shaders-msl/vert/float-math.vert

@@ -0,0 +1,88 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct Matrices
+{
+    float4x4 vpMatrix;
+    float4x4 wMatrix;
+    float4x3 wMatrix4x3;
+    float3x4 wMatrix3x4;
+};
+
+struct main0_out
+{
+    float3 OutNormal [[user(locn0)]];
+    float4 OutWorldPos_0 [[user(locn1)]];
+    float4 OutWorldPos_1 [[user(locn2)]];
+    float4 OutWorldPos_2 [[user(locn3)]];
+    float4 OutWorldPos_3 [[user(locn4)]];
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float3 InPos [[attribute(0)]];
+    float3 InNormal [[attribute(1)]];
+};
+
+vertex main0_out main0(main0_in in [[stage_in]], constant Matrices& _22 [[buffer(0)]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 4> OutWorldPos = {};
+    float4 _37 = float4(in.InPos, 1.0);
+    out.gl_Position = (_22.vpMatrix * _22.wMatrix) * _37;
+    OutWorldPos[0] = _22.wMatrix * _37;
+    OutWorldPos[1] = _37 * _22.wMatrix;
+    OutWorldPos[2] = _22.wMatrix3x4 * in.InPos;
+    OutWorldPos[3] = in.InPos * _22.wMatrix4x3;
+    out.OutNormal = (_22.wMatrix * float4(in.InNormal, 0.0)).xyz;
+    out.OutWorldPos_0 = OutWorldPos[0];
+    out.OutWorldPos_1 = OutWorldPos[1];
+    out.OutWorldPos_2 = OutWorldPos[2];
+    out.OutWorldPos_3 = OutWorldPos[3];
+    return out;
+}
+

+ 6 - 3
3rdparty/spirv-cross/reference/opt/shaders-msl/vert/functions.vert

@@ -59,20 +59,23 @@ inline T spvFindSMSB(T x)
 }
 
 // Returns the determinant of a 2x2 matrix.
-inline float spvDet2x2(float a1, float a2, float b1, float b2)
+static inline __attribute__((always_inline))
+float spvDet2x2(float a1, float a2, float b1, float b2)
 {
     return a1 * b2 - b1 * a2;
 }
 
 // Returns the determinant of a 3x3 matrix.
-inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
+static inline __attribute__((always_inline))
+float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
 {
     return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3);
 }
 
 // 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.
-inline float4x4 spvInverse4x4(float4x4 m)
+static inline __attribute__((always_inline))
+float4x4 spvInverse4x4(float4x4 m)
 {
     float4x4 adj;	// The adjoint matrix (inverse after dividing by determinant)
 

+ 42 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/vert/in_out_array_mat.vert

@@ -1,8 +1,49 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct UBO
 {
     float4x4 projection;
@@ -40,7 +81,7 @@ vertex main0_out main0(main0_in in [[stage_in]], constant UBO& ubo [[buffer(0)]]
 {
     main0_out out = {};
     float4x4 outTransModel = {};
-    float4 colors[3] = {};
+    spvUnsafeArray<float4, 3> colors = {};
     float4x4 inViewMat = {};
     colors[0] = in.colors_0;
     colors[1] = in.colors_1;

+ 42 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.frag

@@ -1,13 +1,54 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct Vert
 {
     float3x3 wMatrix;
     float4 wTmp;
-    float arr[4];
+    spvUnsafeArray<float, 4> arr;
 };
 
 struct main0_out

+ 42 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.vert

@@ -1,11 +1,52 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct Vert
 {
-    float arr[3];
+    spvUnsafeArray<float, 3> arr;
     float3x3 wMatrix;
     float4 wTmp;
 };

+ 2 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert

@@ -11,7 +11,8 @@ struct main0_out
 };
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 42 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/vulkan/frag/basic.multiview.nocompat.vk.frag

@@ -1,8 +1,49 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 struct main0_out
 {
     float4 FragColor [[color(0)]];
@@ -20,7 +61,7 @@ struct main0_in
 fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], texture2d<float> uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]], uint gl_ViewIndex [[render_target_array_index]])
 {
     main0_out out = {};
-    float2 vTex[4] = {};
+    spvUnsafeArray<float2, 4> vTex = {};
     vTex[0] = in.vTex_0;
     vTex[1] = in.vTex_1;
     vTex[2] = in.vTex_2;

+ 356 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/array-copy-error.asm.frag

@@ -0,0 +1,356 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_ClipToWorld;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_908;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_924;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_940;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_956;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_972;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_1020;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_1036;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_1052;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1068;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1724;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1740;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1756;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2076;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2148;
+    float PrePadding_View_2152;
+    float PrePadding_View_2156;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2228;
+    float PrePadding_View_2232;
+    float PrePadding_View_2236;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2268;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2412;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    float View_AtmosphericFogSunDiscHalfApexAngleRadian;
+    float PrePadding_View_2492;
+    float4 View_AtmosphericFogSunDiscLuminance;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    uint PrePadding_View_2520;
+    uint PrePadding_View_2524;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2584;
+    float PrePadding_View_2588;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2744;
+    float PrePadding_View_2748;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float PrePadding_View_2908;
+    int2 View_CursorPosition;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    float PrePadding_View_2924;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2940;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2956;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2972;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2988;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_3004;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_PrimitiveDither
+{
+    float PrimitiveDither_LODFactor;
+};
+
+struct type_PrimitiveFade
+{
+    float2 PrimitiveFade_FadeTimeScaleBias;
+};
+
+struct type_Material
+{
+    float4 Material_VectorExpressions[9];
+    float4 Material_ScalarExpressions[3];
+};
+
+constant float _98 = {};
+constant float _103 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+    float gl_FragDepth [[depth(less)]];
+};
+
+struct main0_in
+{
+    float4 in_var_TEXCOORD6 [[user(locn0)]];
+    float4 in_var_TEXCOORD7 [[user(locn1)]];
+    float4 in_var_TEXCOORD10_centroid [[user(locn2)]];
+    float4 in_var_TEXCOORD11_centroid [[user(locn3)]];
+    float4 in_var_TEXCOORD0_0 [[user(locn4)]];
+};
+
+static inline __attribute__((always_inline))
+void _353()
+{
+    discard_fragment();
+}
+
+fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_PrimitiveDither& PrimitiveDither [[buffer(1)]], constant type_PrimitiveFade& PrimitiveFade [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture2d<float> Material_Texture2D_0 [[texture(0)]], texture2d<float> Material_Texture2D_3 [[texture(1)]], sampler Material_Texture2D_0Sampler [[sampler(0)]], sampler Material_Texture2D_3Sampler [[sampler(1)]], float4 gl_FragCoord [[position]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 1> in_var_TEXCOORD0 = {};
+    in_var_TEXCOORD0[0] = in.in_var_TEXCOORD0_0;
+    float2 _135 = gl_FragCoord.xy - View.View_ViewRectMin.xy;
+    float4 _140 = float4(_103, _103, gl_FragCoord.z, 1.0) * float4(gl_FragCoord.w);
+    float4 _144 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0);
+    float3 _148 = _144.xyz / float3(_144.w);
+    float3 _149 = _148 - float3(View.View_PreViewTranslation);
+    float3 _151 = normalize(-_148);
+    float3 _152 = _151 * float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz);
+    float _170 = mix(Material.Material_ScalarExpressions[0].y, Material.Material_ScalarExpressions[0].z, fast::min(fast::max(abs(dot(_151, in.in_var_TEXCOORD11_centroid.xyz)), 0.0), 1.0));
+    float _172 = 1.0 / _170;
+    float2 _174 = (float2(Material.Material_ScalarExpressions[0].x) * ((_152.xy * float2(-1.0)) / float2(_152.z))) * float2(_172);
+    float _180_copy;
+    float2 _183;
+    _183 = float2(0.0);
+    float _188;
+    float _211;
+    float2 _212;
+    float _180 = 1.0;
+    int _185 = 0;
+    float _187 = 1.0;
+    float _189 = 1.0;
+    for (;;)
+    {
+        if (float(_185) < (floor(_170) + 2.0))
+        {
+            _188 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _183), gradient2d(dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)), dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)))).y;
+            if (_180 < _188)
+            {
+                float _201 = _188 - _180;
+                float _203 = _201 / ((_189 - _187) + _201);
+                _211 = (_189 * _203) + (_180 * (1.0 - _203));
+                _212 = _183 - (float2(_203) * _174);
+                break;
+            }
+            _180_copy = _180;
+            _180 -= _172;
+            _183 += _174;
+            _185++;
+            _187 = _188;
+            _189 = _180_copy;
+            continue;
+        }
+        else
+        {
+            _211 = _98;
+            _212 = _183;
+            break;
+        }
+    }
+    float4 _218 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _212.xy), bias(View.View_MaterialTextureMipBias));
+    float2 _229 = _135 + float2(View.View_TemporalAAParams.x);
+    float _237 = float((uint(_229.x) + (2u * uint(_229.y))) % 5u);
+    float2 _238 = _135 * float2(0.015625);
+    float4 _242 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias));
+    float4 _254 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias));
+    float3 _272 = float3(_212, (1.0 - _211) * Material.Material_ScalarExpressions[0].x);
+    float2 _275 = dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y));
+    float2 _276 = abs(_275);
+    float3 _279 = dfdx(_149);
+    float2 _283 = dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y));
+    float2 _284 = abs(_283);
+    float3 _287 = dfdy(_149);
+    if (PrimitiveDither.PrimitiveDither_LODFactor != 0.0)
+    {
+        if (abs(PrimitiveDither.PrimitiveDither_LODFactor) > 0.001000000047497451305389404296875)
+        {
+            float _317 = fract(cos(dot(floor(gl_FragCoord.xy), float2(347.834503173828125, 3343.28369140625))) * 1000.0);
+            if ((float((PrimitiveDither.PrimitiveDither_LODFactor < 0.0) ? ((PrimitiveDither.PrimitiveDither_LODFactor + 1.0) > _317) : (PrimitiveDither.PrimitiveDither_LODFactor < _317)) - 0.001000000047497451305389404296875) < 0.0)
+            {
+                _353();
+            }
+        }
+    }
+    if ((((_218.z + ((fast::min(fast::max(1.0 - (_218.x * Material.Material_ScalarExpressions[2].y), 0.0), 1.0) + ((_237 + (_242.x * Material.Material_ScalarExpressions[2].z)) * 0.16666667163372039794921875)) + (-0.5))) * ((fast::clamp((View.View_RealTime * PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.x) + PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.y, 0.0, 1.0) + ((_237 + _254.x) * 0.16666667163372039794921875)) + (-0.5))) - 0.33329999446868896484375) < 0.0)
+    {
+        _353();
+    }
+    float2 _351 = ((((in.in_var_TEXCOORD6.xy / float2(in.in_var_TEXCOORD6.w)) - View.View_TemporalAAJitter.xy) - ((in.in_var_TEXCOORD7.xy / float2(in.in_var_TEXCOORD7.w)) - View.View_TemporalAAJitter.zw)) * float2(0.2495000064373016357421875)) + float2(0.49999237060546875);
+    out.gl_FragDepth = fast::min(_140.z / (_140.w + (sqrt(dot(_272, _272)) / (fast::max(sqrt(dot(_276, _276)) / sqrt(dot(_279, _279)), sqrt(dot(_284, _284)) / sqrt(dot(_287, _287))) / abs(dot(float3x3(View.View_ViewToTranslatedWorld[0].xyz, View.View_ViewToTranslatedWorld[1].xyz, View.View_ViewToTranslatedWorld[2].xyz) * float3(0.0, 0.0, 1.0), _151))))), gl_FragCoord.z);
+    out.out_var_SV_Target0 = float4(_351.x, _351.y, float2(0.0).x, float2(0.0).y);
+    return out;
+}
+

+ 314 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/depth-compare.asm.frag

@@ -0,0 +1,314 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_844;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_860;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_876;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_892;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_908;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_956;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_972;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_988;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1004;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1660;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1676;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1692;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2012;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2084;
+    float PrePadding_View_2088;
+    float PrePadding_View_2092;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2164;
+    float PrePadding_View_2168;
+    float PrePadding_View_2172;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2204;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2348;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2488;
+    float PrePadding_View_2492;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2648;
+    float PrePadding_View_2652;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2828;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2844;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2860;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2876;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_2892;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_Globals
+{
+    float3 SoftTransitionScale;
+    float4x4 ShadowViewProjectionMatrices[6];
+    float InvShadowmapResolution;
+    float ShadowFadeFraction;
+    float ShadowSharpen;
+    float4 LightPositionAndInvRadius;
+    float2 ProjectionDepthBiasParameters;
+    float4 PointLightDepthBiasAndProjParameters;
+};
+
+constant float4 _453 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+};
+
+fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<float> SceneTexturesStruct_SceneDepthTexture [[texture(0)]], texture2d<float> SceneTexturesStruct_GBufferATexture [[texture(1)]], texture2d<float> SceneTexturesStruct_GBufferBTexture [[texture(2)]], texture2d<float> SceneTexturesStruct_GBufferDTexture [[texture(3)]], depthcube<float> ShadowDepthCubeTexture [[texture(4)]], texture2d<float> SSProfilesTexture [[texture(5)]], sampler SceneTexturesStruct_SceneDepthTextureSampler [[sampler(0)]], sampler SceneTexturesStruct_GBufferATextureSampler [[sampler(1)]], sampler SceneTexturesStruct_GBufferBTextureSampler [[sampler(2)]], sampler SceneTexturesStruct_GBufferDTextureSampler [[sampler(3)]], sampler ShadowDepthTextureSampler [[sampler(4)]], sampler ShadowDepthCubeTextureSampler [[sampler(5)]], float4 gl_FragCoord [[position]])
+{
+    main0_out out = {};
+    float2 _114 = gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw;
+    float4 _118 = SceneTexturesStruct_SceneDepthTexture.sample(SceneTexturesStruct_SceneDepthTextureSampler, _114, level(0.0));
+    float _119 = _118.x;
+    float _133 = ((_119 * View.View_InvDeviceZToWorldZTransform.x) + View.View_InvDeviceZToWorldZTransform.y) + (1.0 / ((_119 * View.View_InvDeviceZToWorldZTransform.z) - View.View_InvDeviceZToWorldZTransform.w));
+    float4 _147 = View.View_ScreenToWorld * float4(((_114 - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_133), _133, 1.0);
+    float3 _148 = _147.xyz;
+    float3 _152 = _Globals.LightPositionAndInvRadius.xyz - _148;
+    float _158 = length(_152);
+    bool _160 = (_158 * _Globals.LightPositionAndInvRadius.w) < 1.0;
+    float _207;
+    if (_160)
+    {
+        float3 _165 = abs(_152);
+        float _166 = _165.x;
+        float _167 = _165.y;
+        float _168 = _165.z;
+        float _170 = fast::max(_166, fast::max(_167, _168));
+        int _189;
+        if (_170 == _166)
+        {
+            _189 = (_166 == _152.x) ? 0 : 1;
+        }
+        else
+        {
+            int _185;
+            if (_170 == _167)
+            {
+                _185 = (_167 == _152.y) ? 2 : 3;
+            }
+            else
+            {
+                _185 = (_168 == _152.z) ? 4 : 5;
+            }
+            _189 = _185;
+        }
+        float4 _196 = _Globals.ShadowViewProjectionMatrices[_189] * float4(_147.xyz, 1.0);
+        float _198 = _196.w;
+        _207 = ShadowDepthCubeTexture.sample_compare(ShadowDepthCubeTextureSampler, (_152 / float3(_158)), (_196.z / _198) + ((-_Globals.PointLightDepthBiasAndProjParameters.x) / _198), level(0.0));
+    }
+    else
+    {
+        _207 = 1.0;
+    }
+    float _213 = fast::clamp(((_207 - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0);
+    float _218 = sqrt(mix(1.0, _213 * _213, _Globals.ShadowFadeFraction));
+    float4 _219 = _453;
+    _219.z = _218;
+    float3 _236 = normalize((SceneTexturesStruct_GBufferATexture.sample(SceneTexturesStruct_GBufferATextureSampler, _114, level(0.0)).xyz * float3(2.0)) - float3(1.0));
+    uint _240 = uint(round(SceneTexturesStruct_GBufferBTexture.sample(SceneTexturesStruct_GBufferBTextureSampler, _114, level(0.0)).w * 255.0));
+    bool _248 = (_240 & 15u) == 5u;
+    float _448;
+    if (_248)
+    {
+        float4 _260 = SSProfilesTexture.read(uint2(int3(1, int(uint((select(float4(0.0), SceneTexturesStruct_GBufferDTexture.sample(SceneTexturesStruct_GBufferDTextureSampler, _114, level(0.0)), bool4(!(((_240 & 4294967280u) & 16u) != 0u))).x * 255.0) + 0.5)), 0).xy), 0);
+        float _263 = _260.y * 0.5;
+        float _274 = pow(fast::clamp(dot(-(_152 * float3(rsqrt(dot(_152, _152)))), _236), 0.0, 1.0), 1.0);
+        float _445;
+        if (_160)
+        {
+            float3 _278 = _152 / float3(_158);
+            float3 _280 = normalize(cross(_278, float3(0.0, 0.0, 1.0)));
+            float3 _284 = float3(_Globals.InvShadowmapResolution);
+            float3 _285 = _280 * _284;
+            float3 _286 = cross(_280, _278) * _284;
+            float3 _287 = abs(_278);
+            float _288 = _287.x;
+            float _289 = _287.y;
+            float _290 = _287.z;
+            float _292 = fast::max(_288, fast::max(_289, _290));
+            int _311;
+            if (_292 == _288)
+            {
+                _311 = (_288 == _278.x) ? 0 : 1;
+            }
+            else
+            {
+                int _307;
+                if (_292 == _289)
+                {
+                    _307 = (_289 == _278.y) ? 2 : 3;
+                }
+                else
+                {
+                    _307 = (_290 == _278.z) ? 4 : 5;
+                }
+                _311 = _307;
+            }
+            float4 _318 = _Globals.ShadowViewProjectionMatrices[_311] * float4(_148 - (_236 * float3(_263)), 1.0);
+            float _323 = _260.x * (10.0 / _Globals.LightPositionAndInvRadius.w);
+            float _329 = (1.0 / (((_318.z / _318.w) * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w;
+            float _342 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, (_278 + (_286 * float3(2.5))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+            float _364 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(2.3776409626007080078125))) + (_286 * float3(0.77254199981689453125))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+            float _387 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(1.46946299076080322265625))) + (_286 * float3(-2.0225429534912109375))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+            float _410 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(-1.46946299076080322265625))) + (_286 * float3(-2.02254199981689453125))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+            float _433 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(-2.3776409626007080078125))) + (_286 * float3(0.772543013095855712890625))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
+            _445 = (((((fast::clamp(abs((_342 > 0.0) ? (_342 + _263) : fast::max(0.0, (_342 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25) + (fast::clamp(abs((_364 > 0.0) ? (_364 + _263) : fast::max(0.0, (_364 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_387 > 0.0) ? (_387 + _263) : fast::max(0.0, (_387 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_410 > 0.0) ? (_410 + _263) : fast::max(0.0, (_410 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_433 > 0.0) ? (_433 + _263) : fast::max(0.0, (_433 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) * 0.20000000298023223876953125;
+        }
+        else
+        {
+            _445 = 1.0;
+        }
+        _448 = 1.0 - (_445 * 0.20000000298023223876953125);
+    }
+    else
+    {
+        _448 = 1.0;
+    }
+    float4 _451 = float4(float3(1.0).x, float3(1.0).y, _219.z, float3(1.0).z);
+    _451.w = _248 ? sqrt(_448) : _218;
+    out.out_var_SV_Target0 = _451;
+    return out;
+}
+

+ 1364 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/global-constant-arrays.asm.frag

@@ -0,0 +1,1364 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_Globals
+{
+    float4 MappingPolynomial;
+    float3 InverseGamma;
+    float4 ColorMatrixR_ColorCurveCd1;
+    float4 ColorMatrixG_ColorCurveCd3Cm3;
+    float4 ColorMatrixB_ColorCurveCm2;
+    float4 ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3;
+    float4 ColorCurve_Ch1_Ch2;
+    float4 ColorShadow_Luma;
+    float4 ColorShadow_Tint1;
+    float4 ColorShadow_Tint2;
+    float FilmSlope;
+    float FilmToe;
+    float FilmShoulder;
+    float FilmBlackClip;
+    float FilmWhiteClip;
+    packed_float3 ColorScale;
+    float4 OverlayColor;
+    float WhiteTemp;
+    float WhiteTint;
+    float4 ColorSaturation;
+    float4 ColorContrast;
+    float4 ColorGamma;
+    float4 ColorGain;
+    float4 ColorOffset;
+    float4 ColorSaturationShadows;
+    float4 ColorContrastShadows;
+    float4 ColorGammaShadows;
+    float4 ColorGainShadows;
+    float4 ColorOffsetShadows;
+    float4 ColorSaturationMidtones;
+    float4 ColorContrastMidtones;
+    float4 ColorGammaMidtones;
+    float4 ColorGainMidtones;
+    float4 ColorOffsetMidtones;
+    float4 ColorSaturationHighlights;
+    float4 ColorContrastHighlights;
+    float4 ColorGammaHighlights;
+    float4 ColorGainHighlights;
+    float4 ColorOffsetHighlights;
+    float ColorCorrectionShadowsMax;
+    float ColorCorrectionHighlightsMin;
+    uint OutputDevice;
+    uint OutputGamut;
+    float BlueCorrection;
+    float ExpandGamut;
+};
+
+constant spvUnsafeArray<float, 6> _475 = spvUnsafeArray<float, 6>({ -4.0, -4.0, -3.1573765277862548828125, -0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875 });
+constant spvUnsafeArray<float, 6> _476 = spvUnsafeArray<float, 6>({ -0.718548238277435302734375, 2.0810306072235107421875, 3.66812419891357421875, 4.0, 4.0, 4.0 });
+constant spvUnsafeArray<float, 10> _479 = spvUnsafeArray<float, 10>({ -4.97062206268310546875, -3.0293781757354736328125, -2.1261999607086181640625, -1.5104999542236328125, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 });
+constant spvUnsafeArray<float, 10> _480 = spvUnsafeArray<float, 10>({ 0.80891323089599609375, 1.19108676910400390625, 1.5683000087738037109375, 1.94830000400543212890625, 2.308300018310546875, 2.63840007781982421875, 2.85949993133544921875, 2.9872608184814453125, 3.0127391815185546875, 3.0127391815185546875 });
+constant spvUnsafeArray<float, 10> _482 = spvUnsafeArray<float, 10>({ -2.3010299205780029296875, -2.3010299205780029296875, -1.9312000274658203125, -1.5204999446868896484375, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 });
+constant spvUnsafeArray<float, 10> _483 = spvUnsafeArray<float, 10>({ 0.801995217800140380859375, 1.19800484180450439453125, 1.5943000316619873046875, 1.99730002880096435546875, 2.3782999515533447265625, 2.7683999538421630859375, 3.0515000820159912109375, 3.2746293544769287109375, 3.32743072509765625, 3.32743072509765625 });
+
+constant float3 _391 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+};
+
+struct main0_in
+{
+    float2 in_var_TEXCOORD0 [[user(locn0), center_no_perspective]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], constant type_Globals& _Globals [[buffer(0)]], uint gl_Layer [[render_target_array_index]])
+{
+    main0_out out = {};
+    float3x3 _546 = float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * float3x3(float3(1.01303005218505859375, 0.0061053098179399967193603515625, -0.014971000142395496368408203125), float3(0.0076982299797236919403076171875, 0.99816501140594482421875, -0.005032029934227466583251953125), float3(-0.0028413101099431514739990234375, 0.0046851597726345062255859375, 0.92450702190399169921875));
+    float3x3 _547 = _546 * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125));
+    float3x3 _548 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(0.98722398281097412109375, -0.0061132698319852352142333984375, 0.01595330052077770233154296875), float3(-0.007598360069096088409423828125, 1.00186002254486083984375, 0.0053300200961530208587646484375), float3(0.003072570078074932098388671875, -0.0050959498621523380279541015625, 1.0816800594329833984375));
+    float3x3 _549 = _548 * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875));
+    float3x3 _550 = float3x3(float3(0.952552378177642822265625, 0.0, 9.25), float3(0.3439664542675018310546875, 0.728166103363037109375, -0.07213254272937774658203125), float3(0.0, 0.0, 1.00882518291473388671875)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125));
+    float3x3 _551 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625));
+    float3x3 _576;
+    for (;;)
+    {
+        if (_Globals.OutputGamut == 1u)
+        {
+            _576 = _548 * float3x3(float3(2.493396282196044921875, -0.931345880031585693359375, -0.4026944935321807861328125), float3(-0.829486787319183349609375, 1.76265966892242431640625, 0.02362460084259510040283203125), float3(0.0358506999909877777099609375, -0.076182700693607330322265625, 0.957014024257659912109375));
+            break;
+        }
+        else
+        {
+            if (_Globals.OutputGamut == 2u)
+            {
+                _576 = _548 * float3x3(float3(1.71660840511322021484375, -0.3556621074676513671875, -0.253360092639923095703125), float3(-0.666682898998260498046875, 1.61647760868072509765625, 0.01576850004494190216064453125), float3(0.017642199993133544921875, -0.04277630150318145751953125, 0.94222867488861083984375));
+                break;
+            }
+            else
+            {
+                if (_Globals.OutputGamut == 3u)
+                {
+                    _576 = float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625));
+                    break;
+                }
+                else
+                {
+                    if (_Globals.OutputGamut == 4u)
+                    {
+                        _576 = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0));
+                        break;
+                    }
+                    else
+                    {
+                        _576 = _549;
+                        break;
+                    }
+                }
+            }
+        }
+    }
+    float3 _577 = float4((in.in_var_TEXCOORD0 - float2(0.015625)) * float2(1.03225803375244140625), float(gl_Layer) * 0.0322580635547637939453125, 0.0).xyz;
+    float3 _599;
+    if (_Globals.OutputDevice >= 3u)
+    {
+        float3 _591 = pow(_577, float3(0.0126833133399486541748046875));
+        _599 = pow(fast::max(float3(0.0), _591 - float3(0.8359375)) / (float3(18.8515625) - (float3(18.6875) * _591)), float3(6.277394771575927734375)) * float3(10000.0);
+    }
+    else
+    {
+        _599 = (exp2((_577 - float3(0.434017598628997802734375)) * float3(14.0)) * float3(0.180000007152557373046875)) - (exp2(float3(-6.0762462615966796875)) * float3(0.180000007152557373046875));
+    }
+    float _602 = _Globals.WhiteTemp * 1.00055634975433349609375;
+    float _616 = (_602 <= 7000.0) ? (0.24406300485134124755859375 + ((99.1100006103515625 + ((2967800.0 - (4604438528.0 / _Globals.WhiteTemp)) / _602)) / _602)) : (0.23703999817371368408203125 + ((247.4799957275390625 + ((1901800.0 - (2005284352.0 / _Globals.WhiteTemp)) / _602)) / _602));
+    float _633 = ((0.860117733478546142578125 + (0.00015411825734190642833709716796875 * _Globals.WhiteTemp)) + ((1.2864121856637211749330163002014e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 + (0.0008424202096648514270782470703125 * _Globals.WhiteTemp)) + ((7.0814513719597016461193561553955e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp));
+    float _644 = ((0.317398726940155029296875 + (4.25 * _Globals.WhiteTemp)) + ((4.2048167614439080352894961833954e-08 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 - (2.8974181986995972692966461181641e-05 * _Globals.WhiteTemp)) + ((1.6145605741257895715534687042236e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp));
+    float _649 = ((2.0 * _633) - (8.0 * _644)) + 4.0;
+    float2 _653 = float2((3.0 * _633) / _649, (2.0 * _644) / _649);
+    float2 _660 = normalize(float2(_633, _644));
+    float _665 = _633 + (((-_660.y) * _Globals.WhiteTint) * 0.0500000007450580596923828125);
+    float _669 = _644 + ((_660.x * _Globals.WhiteTint) * 0.0500000007450580596923828125);
+    float _674 = ((2.0 * _665) - (8.0 * _669)) + 4.0;
+    float2 _680 = select(float2(_616, ((((-3.0) * _616) * _616) + (2.86999988555908203125 * _616)) - 0.2750000059604644775390625), _653, bool2(_Globals.WhiteTemp < 4000.0)) + (float2((3.0 * _665) / _674, (2.0 * _669) / _674) - _653);
+    float _681 = _680.x;
+    float _682 = _680.y;
+    float _683 = fast::max(_682, 1.0000000133514319600180897396058e-10);
+    float3 _685 = _391;
+    _685.x = _681 / _683;
+    float3 _686 = _685;
+    _686.y = 1.0;
+    float3 _690 = _686;
+    _690.z = ((1.0 - _681) - _682) / _683;
+    float3 _693 = _391;
+    _693.x = 0.950455963611602783203125;
+    float3 _694 = _693;
+    _694.y = 1.0;
+    float3 _696 = _694;
+    _696.z = 1.0890576839447021484375;
+    float3 _697 = _690 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875));
+    float3 _698 = _696 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875));
+    float3 _717 = (_599 * ((float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * ((float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)) * float3x3(float3(_698.x / _697.x, 0.0, 0.0), float3(0.0, _698.y / _697.y, 0.0), float3(0.0, 0.0, _698.z / _697.z))) * float3x3(float3(0.986992895603179931640625, -0.14705429971218109130859375, 0.15996269881725311279296875), float3(0.4323053061962127685546875, 0.518360316753387451171875, 0.049291200935840606689453125), float3(-0.00852870009839534759521484375, 0.0400427989661693572998046875, 0.968486726284027099609375)))) * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)))) * _547;
+    float3 _745;
+    if (_Globals.ColorShadow_Tint2.w != 0.0)
+    {
+        float _724 = dot(_717, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625));
+        float3 _727 = (_717 / float3(_724)) - float3(1.0);
+        _745 = mix(_717, _717 * (_549 * (float3x3(float3(0.544169127941131591796875, 0.23959259688854217529296875, 0.16669429838657379150390625), float3(0.23946559429168701171875, 0.702153027057647705078125, 0.058381401002407073974609375), float3(-0.0023439000360667705535888671875, 0.0361833982169628143310546875, 1.05521833896636962890625)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)))), float3((1.0 - exp2((-4.0) * dot(_727, _727))) * (1.0 - exp2((((-4.0) * _Globals.ExpandGamut) * _724) * _724))));
+    }
+    else
+    {
+        _745 = _717;
+    }
+    float _746 = dot(_745, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625));
+    float4 _751 = _Globals.ColorSaturationShadows * _Globals.ColorSaturation;
+    float4 _756 = _Globals.ColorContrastShadows * _Globals.ColorContrast;
+    float4 _761 = _Globals.ColorGammaShadows * _Globals.ColorGamma;
+    float4 _766 = _Globals.ColorGainShadows * _Globals.ColorGain;
+    float4 _771 = _Globals.ColorOffsetShadows + _Globals.ColorOffset;
+    float3 _772 = float3(_746);
+    float _804 = smoothstep(0.0, _Globals.ColorCorrectionShadowsMax, _746);
+    float4 _808 = _Globals.ColorSaturationHighlights * _Globals.ColorSaturation;
+    float4 _811 = _Globals.ColorContrastHighlights * _Globals.ColorContrast;
+    float4 _814 = _Globals.ColorGammaHighlights * _Globals.ColorGamma;
+    float4 _817 = _Globals.ColorGainHighlights * _Globals.ColorGain;
+    float4 _820 = _Globals.ColorOffsetHighlights + _Globals.ColorOffset;
+    float _852 = smoothstep(_Globals.ColorCorrectionHighlightsMin, 1.0, _746);
+    float4 _855 = _Globals.ColorSaturationMidtones * _Globals.ColorSaturation;
+    float4 _858 = _Globals.ColorContrastMidtones * _Globals.ColorContrast;
+    float4 _861 = _Globals.ColorGammaMidtones * _Globals.ColorGamma;
+    float4 _864 = _Globals.ColorGainMidtones * _Globals.ColorGain;
+    float4 _867 = _Globals.ColorOffsetMidtones + _Globals.ColorOffset;
+    float3 _905 = ((((pow(pow(fast::max(float3(0.0), mix(_772, _745, _751.xyz * float3(_751.w))) * float3(5.5555553436279296875), _756.xyz * float3(_756.w)) * float3(0.180000007152557373046875), float3(1.0) / (_761.xyz * float3(_761.w))) * (_766.xyz * float3(_766.w))) + (_771.xyz + float3(_771.w))) * float3(1.0 - _804)) + (((pow(pow(fast::max(float3(0.0), mix(_772, _745, _855.xyz * float3(_855.w))) * float3(5.5555553436279296875), _858.xyz * float3(_858.w)) * float3(0.180000007152557373046875), float3(1.0) / (_861.xyz * float3(_861.w))) * (_864.xyz * float3(_864.w))) + (_867.xyz + float3(_867.w))) * float3(_804 - _852))) + (((pow(pow(fast::max(float3(0.0), mix(_772, _745, _808.xyz * float3(_808.w))) * float3(5.5555553436279296875), _811.xyz * float3(_811.w)) * float3(0.180000007152557373046875), float3(1.0) / (_814.xyz * float3(_814.w))) * (_817.xyz * float3(_817.w))) + (_820.xyz + float3(_820.w))) * float3(_852));
+    float3 _906 = _905 * _549;
+    float3 _914 = float3(_Globals.BlueCorrection);
+    float3 _916 = mix(_905, _905 * ((_551 * float3x3(float3(0.940437257289886474609375, -0.01830687932670116424560546875, 0.07786960899829864501953125), float3(0.008378696627914905548095703125, 0.82866001129150390625, 0.162961304187774658203125), float3(0.0005471261101774871349334716796875, -0.00088337459601461887359619140625, 1.00033628940582275390625))) * _550), _914) * _551;
+    float _917 = _916.x;
+    float _918 = _916.y;
+    float _920 = _916.z;
+    float _923 = fast::max(fast::max(_917, _918), _920);
+    float _928 = (fast::max(_923, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_917, _918), _920), 1.0000000133514319600180897396058e-10)) / fast::max(_923, 0.00999999977648258209228515625);
+    float _941 = ((_920 + _918) + _917) + (1.75 * sqrt(((_920 * (_920 - _918)) + (_918 * (_918 - _917))) + (_917 * (_917 - _920))));
+    float _942 = _941 * 0.3333333432674407958984375;
+    float _943 = _928 - 0.4000000059604644775390625;
+    float _948 = fast::max(1.0 - abs(_943 * 2.5), 0.0);
+    float _956 = (1.0 + (float(int(sign(_943 * 5.0))) * (1.0 - (_948 * _948)))) * 0.02500000037252902984619140625;
+    float _969;
+    if (_942 <= 0.053333334624767303466796875)
+    {
+        _969 = _956;
+    }
+    else
+    {
+        float _968;
+        if (_942 >= 0.1599999964237213134765625)
+        {
+            _968 = 0.0;
+        }
+        else
+        {
+            _968 = _956 * ((0.23999999463558197021484375 / _941) - 0.5);
+        }
+        _969 = _968;
+    }
+    float3 _972 = _916 * float3(1.0 + _969);
+    float _973 = _972.x;
+    float _974 = _972.y;
+    float _976 = _972.z;
+    float _990;
+    if ((_973 == _974) && (_974 == _976))
+    {
+        _990 = 0.0;
+    }
+    else
+    {
+        _990 = 57.2957763671875 * atan2(sqrt(3.0) * (_974 - _976), ((2.0 * _973) - _974) - _976);
+    }
+    float _995;
+    if (_990 < 0.0)
+    {
+        _995 = _990 + 360.0;
+    }
+    else
+    {
+        _995 = _990;
+    }
+    float _996 = fast::clamp(_995, 0.0, 360.0);
+    float _1001;
+    if (_996 > 180.0)
+    {
+        _1001 = _996 - 360.0;
+    }
+    else
+    {
+        _1001 = _996;
+    }
+    float _1005 = smoothstep(0.0, 1.0, 1.0 - abs(_1001 * 0.01481481455266475677490234375));
+    float3 _1012 = _972;
+    _1012.x = _973 + ((((_1005 * _1005) * _928) * (0.02999999932944774627685546875 - _973)) * 0.180000007152557373046875);
+    float3 _1014 = fast::max(float3(0.0), _1012 * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)));
+    float _1023 = (1.0 + _Globals.FilmBlackClip) - _Globals.FilmToe;
+    float _1026 = 1.0 + _Globals.FilmWhiteClip;
+    float _1029 = _1026 - _Globals.FilmShoulder;
+    float _1056;
+    if (_Globals.FilmToe > 0.800000011920928955078125)
+    {
+        _1056 = ((0.819999992847442626953125 - _Globals.FilmToe) / _Globals.FilmSlope) + (log(0.180000007152557373046875) / log(10.0));
+    }
+    else
+    {
+        float _1035 = (0.180000007152557373046875 + _Globals.FilmBlackClip) / _1023;
+        _1056 = (log(0.180000007152557373046875) / log(10.0)) - ((0.5 * log(_1035 / (2.0 - _1035))) * (_1023 / _Globals.FilmSlope));
+    }
+    float _1061 = ((1.0 - _Globals.FilmToe) / _Globals.FilmSlope) - _1056;
+    float _1063 = (_Globals.FilmShoulder / _Globals.FilmSlope) - _1061;
+    float _1065 = log(10.0);
+    float3 _1067 = log(mix(float3(dot(_1014, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1014, float3(0.959999978542327880859375))) / float3(_1065);
+    float3 _1071 = float3(_Globals.FilmSlope) * (_1067 + float3(_1061));
+    float3 _1079 = float3(_1056);
+    float3 _1080 = _1067 - _1079;
+    float3 _1092 = float3(_1063);
+    float3 _1106 = fast::clamp(_1080 / float3(_1063 - _1056), float3(0.0), float3(1.0));
+    float3 _1110 = select(_1106, float3(1.0) - _1106, bool3(_1063 < _1056));
+    float3 _1115 = mix(select(_1071, float3(-_Globals.FilmBlackClip) + (float3(2.0 * _1023) / (float3(1.0) + exp(float3(((-2.0) * _Globals.FilmSlope) / _1023) * _1080))), _1067 < _1079), select(_1071, float3(_1026) - (float3(2.0 * _1029) / (float3(1.0) + exp(float3((2.0 * _Globals.FilmSlope) / _1029) * (_1067 - _1092)))), _1067 > _1092), ((float3(3.0) - (float3(2.0) * _1110)) * _1110) * _1110);
+    float3 _1119 = fast::max(float3(0.0), mix(float3(dot(_1115, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1115, float3(0.930000007152557373046875)));
+    float3 _1189;
+    if (_Globals.ColorShadow_Tint2.w == 0.0)
+    {
+        float3 _1131 = _391;
+        _1131.x = dot(_906, _Globals.ColorMatrixR_ColorCurveCd1.xyz);
+        float3 _1136 = _1131;
+        _1136.y = dot(_906, _Globals.ColorMatrixG_ColorCurveCd3Cm3.xyz);
+        float3 _1141 = _1136;
+        _1141.z = dot(_906, _Globals.ColorMatrixB_ColorCurveCm2.xyz);
+        float3 _1157 = fast::max(float3(0.0), _1141 * (_Globals.ColorShadow_Tint1.xyz + (_Globals.ColorShadow_Tint2.xyz * float3(1.0 / (dot(_906, _Globals.ColorShadow_Luma.xyz) + 1.0)))));
+        float3 _1162 = fast::max(float3(0.0), _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx - _1157);
+        float3 _1164 = fast::max(_1157, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz);
+        _1189 = ((((_1164 * _Globals.ColorCurve_Ch1_Ch2.xxx) + _Globals.ColorCurve_Ch1_Ch2.yyy) * (float3(1.0) / (_1164 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.www))) + ((fast::clamp(_1157, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz) * _Globals.ColorMatrixB_ColorCurveCm2.www) + (((_1162 * _Globals.ColorMatrixR_ColorCurveCd1.www) * (float3(1.0) / (_1162 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.yyy))) + _Globals.ColorMatrixG_ColorCurveCd3Cm3.www))) - float3(0.00200000009499490261077880859375);
+    }
+    else
+    {
+        _1189 = fast::max(float3(0.0), mix(_1119, _1119 * ((_551 * float3x3(float3(1.06317996978759765625, 0.02339559979736804962158203125, -0.08657260239124298095703125), float3(-0.010633699595928192138671875, 1.2063200473785400390625, -0.1956900060176849365234375), float3(-0.0005908869788981974124908447265625, 0.00105247995816171169281005859375, 0.999538004398345947265625))) * _550), _914) * _549);
+    }
+    float3 _1218 = pow(fast::max(float3(0.0), mix((((float3(_Globals.MappingPolynomial.x) * (_1189 * _1189)) + (float3(_Globals.MappingPolynomial.y) * _1189)) + float3(_Globals.MappingPolynomial.z)) * float3(_Globals.ColorScale), _Globals.OverlayColor.xyz, float3(_Globals.OverlayColor.w))), float3(_Globals.InverseGamma.y));
+    float3 _3001;
+    if (_Globals.OutputDevice == 0u)
+    {
+        float _2961 = _1218.x;
+        float _2973;
+        for (;;)
+        {
+            if (_2961 < 0.00313066993840038776397705078125)
+            {
+                _2973 = _2961 * 12.9200000762939453125;
+                break;
+            }
+            _2973 = (pow(_2961, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+            break;
+        }
+        float _2974 = _1218.y;
+        float _2986;
+        for (;;)
+        {
+            if (_2974 < 0.00313066993840038776397705078125)
+            {
+                _2986 = _2974 * 12.9200000762939453125;
+                break;
+            }
+            _2986 = (pow(_2974, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+            break;
+        }
+        float _2987 = _1218.z;
+        float _2999;
+        for (;;)
+        {
+            if (_2987 < 0.00313066993840038776397705078125)
+            {
+                _2999 = _2987 * 12.9200000762939453125;
+                break;
+            }
+            _2999 = (pow(_2987, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+            break;
+        }
+        _3001 = float3(_2973, _2986, _2999);
+    }
+    else
+    {
+        float3 _2960;
+        if (_Globals.OutputDevice == 1u)
+        {
+            float3 _2953 = fast::max(float3(6.1035199905745685100555419921875e-05), (_1218 * _547) * _576);
+            _2960 = fast::min(_2953 * float3(4.5), (pow(fast::max(_2953, float3(0.017999999225139617919921875)), float3(0.449999988079071044921875)) * float3(1.09899997711181640625)) - float3(0.098999999463558197021484375));
+        }
+        else
+        {
+            float3 _2950;
+            if ((_Globals.OutputDevice == 3u) || (_Globals.OutputDevice == 5u))
+            {
+                float3 _2100 = (_906 * float3(1.5)) * (_546 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)));
+                float _2101 = _2100.x;
+                float _2102 = _2100.y;
+                float _2104 = _2100.z;
+                float _2107 = fast::max(fast::max(_2101, _2102), _2104);
+                float _2112 = (fast::max(_2107, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_2101, _2102), _2104), 1.0000000133514319600180897396058e-10)) / fast::max(_2107, 0.00999999977648258209228515625);
+                float _2125 = ((_2104 + _2102) + _2101) + (1.75 * sqrt(((_2104 * (_2104 - _2102)) + (_2102 * (_2102 - _2101))) + (_2101 * (_2101 - _2104))));
+                float _2126 = _2125 * 0.3333333432674407958984375;
+                float _2127 = _2112 - 0.4000000059604644775390625;
+                float _2132 = fast::max(1.0 - abs(_2127 * 2.5), 0.0);
+                float _2140 = (1.0 + (float(int(sign(_2127 * 5.0))) * (1.0 - (_2132 * _2132)))) * 0.02500000037252902984619140625;
+                float _2153;
+                if (_2126 <= 0.053333334624767303466796875)
+                {
+                    _2153 = _2140;
+                }
+                else
+                {
+                    float _2152;
+                    if (_2126 >= 0.1599999964237213134765625)
+                    {
+                        _2152 = 0.0;
+                    }
+                    else
+                    {
+                        _2152 = _2140 * ((0.23999999463558197021484375 / _2125) - 0.5);
+                    }
+                    _2153 = _2152;
+                }
+                float3 _2156 = _2100 * float3(1.0 + _2153);
+                float _2157 = _2156.x;
+                float _2158 = _2156.y;
+                float _2160 = _2156.z;
+                float _2174;
+                if ((_2157 == _2158) && (_2158 == _2160))
+                {
+                    _2174 = 0.0;
+                }
+                else
+                {
+                    _2174 = 57.2957763671875 * atan2(sqrt(3.0) * (_2158 - _2160), ((2.0 * _2157) - _2158) - _2160);
+                }
+                float _2179;
+                if (_2174 < 0.0)
+                {
+                    _2179 = _2174 + 360.0;
+                }
+                else
+                {
+                    _2179 = _2174;
+                }
+                float _2180 = fast::clamp(_2179, 0.0, 360.0);
+                float _2185;
+                if (_2180 > 180.0)
+                {
+                    _2185 = _2180 - 360.0;
+                }
+                else
+                {
+                    _2185 = _2180;
+                }
+                float _2235;
+                if ((_2185 > (-67.5)) && (_2185 < 67.5))
+                {
+                    float _2192 = (_2185 - (-67.5)) * 0.0296296291053295135498046875;
+                    int _2193 = int(_2192);
+                    float _2195 = _2192 - float(_2193);
+                    float _2196 = _2195 * _2195;
+                    float _2197 = _2196 * _2195;
+                    float _2234;
+                    if (_2193 == 3)
+                    {
+                        _2234 = (((_2197 * (-0.16666667163372039794921875)) + (_2196 * 0.5)) + (_2195 * (-0.5))) + 0.16666667163372039794921875;
+                    }
+                    else
+                    {
+                        float _2227;
+                        if (_2193 == 2)
+                        {
+                            _2227 = ((_2197 * 0.5) + (_2196 * (-1.0))) + 0.666666686534881591796875;
+                        }
+                        else
+                        {
+                            float _2222;
+                            if (_2193 == 1)
+                            {
+                                _2222 = (((_2197 * (-0.5)) + (_2196 * 0.5)) + (_2195 * 0.5)) + 0.16666667163372039794921875;
+                            }
+                            else
+                            {
+                                float _2215;
+                                if (_2193 == 0)
+                                {
+                                    _2215 = _2197 * 0.16666667163372039794921875;
+                                }
+                                else
+                                {
+                                    _2215 = 0.0;
+                                }
+                                _2222 = _2215;
+                            }
+                            _2227 = _2222;
+                        }
+                        _2234 = _2227;
+                    }
+                    _2235 = _2234;
+                }
+                else
+                {
+                    _2235 = 0.0;
+                }
+                float3 _2242 = _2156;
+                _2242.x = _2157 + ((((_2235 * 1.5) * _2112) * (0.02999999932944774627685546875 - _2157)) * 0.180000007152557373046875);
+                float3 _2245 = fast::clamp(fast::clamp(_2242, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0));
+                float3 _2248 = mix(float3(dot(_2245, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _2245, float3(0.959999978542327880859375));
+                float _2249 = _2248.x;
+                float _2253 = 0.17999999225139617919921875 * exp2(18.0);
+                float _2255 = exp2(-14.0);
+                float _2258 = log((_2249 <= 0.0) ? _2255 : _2249) / _1065;
+                float _2260 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1065;
+                float _2327;
+                if (_2258 <= _2260)
+                {
+                    _2327 = log(9.9999997473787516355514526367188e-05) / _1065;
+                }
+                else
+                {
+                    float _2267 = log(0.180000007152557373046875) / _1065;
+                    float _2324;
+                    if ((_2258 > _2260) && (_2258 < _2267))
+                    {
+                        float _2307 = (3.0 * (_2258 - _2260)) / (_2267 - _2260);
+                        int _2308 = int(_2307);
+                        float _2310 = _2307 - float(_2308);
+                        _2324 = dot(float3(_2310 * _2310, _2310, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2308], _475[_2308 + 1], _475[_2308 + 2]));
+                    }
+                    else
+                    {
+                        float _2275 = log(_2253) / _1065;
+                        float _2303;
+                        if ((_2258 >= _2267) && (_2258 < _2275))
+                        {
+                            float _2286 = (3.0 * (_2258 - _2267)) / (_2275 - _2267);
+                            int _2287 = int(_2286);
+                            float _2289 = _2286 - float(_2287);
+                            _2303 = dot(float3(_2289 * _2289, _2289, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2287], _476[_2287 + 1], _476[_2287 + 2]));
+                        }
+                        else
+                        {
+                            _2303 = log(10000.0) / _1065;
+                        }
+                        _2324 = _2303;
+                    }
+                    _2327 = _2324;
+                }
+                float3 _2329 = _391;
+                _2329.x = pow(10.0, _2327);
+                float _2330 = _2248.y;
+                float _2334 = log((_2330 <= 0.0) ? _2255 : _2330) / _1065;
+                float _2401;
+                if (_2334 <= _2260)
+                {
+                    _2401 = log(9.9999997473787516355514526367188e-05) / _1065;
+                }
+                else
+                {
+                    float _2341 = log(0.180000007152557373046875) / _1065;
+                    float _2398;
+                    if ((_2334 > _2260) && (_2334 < _2341))
+                    {
+                        float _2381 = (3.0 * (_2334 - _2260)) / (_2341 - _2260);
+                        int _2382 = int(_2381);
+                        float _2384 = _2381 - float(_2382);
+                        _2398 = dot(float3(_2384 * _2384, _2384, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2382], _475[_2382 + 1], _475[_2382 + 2]));
+                    }
+                    else
+                    {
+                        float _2349 = log(_2253) / _1065;
+                        float _2377;
+                        if ((_2334 >= _2341) && (_2334 < _2349))
+                        {
+                            float _2360 = (3.0 * (_2334 - _2341)) / (_2349 - _2341);
+                            int _2361 = int(_2360);
+                            float _2363 = _2360 - float(_2361);
+                            _2377 = dot(float3(_2363 * _2363, _2363, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2361], _476[_2361 + 1], _476[_2361 + 2]));
+                        }
+                        else
+                        {
+                            _2377 = log(10000.0) / _1065;
+                        }
+                        _2398 = _2377;
+                    }
+                    _2401 = _2398;
+                }
+                float3 _2403 = _2329;
+                _2403.y = pow(10.0, _2401);
+                float _2404 = _2248.z;
+                float _2408 = log((_2404 <= 0.0) ? _2255 : _2404) / _1065;
+                float _2475;
+                if (_2408 <= _2260)
+                {
+                    _2475 = log(9.9999997473787516355514526367188e-05) / _1065;
+                }
+                else
+                {
+                    float _2415 = log(0.180000007152557373046875) / _1065;
+                    float _2472;
+                    if ((_2408 > _2260) && (_2408 < _2415))
+                    {
+                        float _2455 = (3.0 * (_2408 - _2260)) / (_2415 - _2260);
+                        int _2456 = int(_2455);
+                        float _2458 = _2455 - float(_2456);
+                        _2472 = dot(float3(_2458 * _2458, _2458, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2456], _475[_2456 + 1], _475[_2456 + 2]));
+                    }
+                    else
+                    {
+                        float _2423 = log(_2253) / _1065;
+                        float _2451;
+                        if ((_2408 >= _2415) && (_2408 < _2423))
+                        {
+                            float _2434 = (3.0 * (_2408 - _2415)) / (_2423 - _2415);
+                            int _2435 = int(_2434);
+                            float _2437 = _2434 - float(_2435);
+                            _2451 = dot(float3(_2437 * _2437, _2437, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2435], _476[_2435 + 1], _476[_2435 + 2]));
+                        }
+                        else
+                        {
+                            _2451 = log(10000.0) / _1065;
+                        }
+                        _2472 = _2451;
+                    }
+                    _2475 = _2472;
+                }
+                float3 _2477 = _2403;
+                _2477.z = pow(10.0, _2475);
+                float3 _2479 = (_2477 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375));
+                float _2481 = 0.17999999225139617919921875 * pow(2.0, -12.0);
+                float _2485 = log((_2481 <= 0.0) ? _2255 : _2481) / _1065;
+                float _2552;
+                if (_2485 <= _2260)
+                {
+                    _2552 = log(9.9999997473787516355514526367188e-05) / _1065;
+                }
+                else
+                {
+                    float _2492 = log(0.180000007152557373046875) / _1065;
+                    float _2549;
+                    if ((_2485 > _2260) && (_2485 < _2492))
+                    {
+                        float _2532 = (3.0 * (_2485 - _2260)) / (_2492 - _2260);
+                        int _2533 = int(_2532);
+                        float _2535 = _2532 - float(_2533);
+                        _2549 = dot(float3(_2535 * _2535, _2535, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2533], _475[_2533 + 1], _475[_2533 + 2]));
+                    }
+                    else
+                    {
+                        float _2500 = log(_2253) / _1065;
+                        float _2528;
+                        if ((_2485 >= _2492) && (_2485 < _2500))
+                        {
+                            float _2511 = (3.0 * (_2485 - _2492)) / (_2500 - _2492);
+                            int _2512 = int(_2511);
+                            float _2514 = _2511 - float(_2512);
+                            _2528 = dot(float3(_2514 * _2514, _2514, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2512], _476[_2512 + 1], _476[_2512 + 2]));
+                        }
+                        else
+                        {
+                            _2528 = log(10000.0) / _1065;
+                        }
+                        _2549 = _2528;
+                    }
+                    _2552 = _2549;
+                }
+                float _2555 = log(0.180000007152557373046875) / _1065;
+                float _2611;
+                if (_2555 <= _2260)
+                {
+                    _2611 = log(9.9999997473787516355514526367188e-05) / _1065;
+                }
+                else
+                {
+                    float _2608;
+                    if ((_2555 > _2260) && (_2555 < _2555))
+                    {
+                        _2608 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(-0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875)).z;
+                    }
+                    else
+                    {
+                        float _2568 = log(_2253) / _1065;
+                        float _2596;
+                        if ((_2555 >= _2555) && (_2555 < _2568))
+                        {
+                            float _2579 = (3.0 * (_2555 - _2555)) / (_2568 - _2555);
+                            int _2580 = int(_2579);
+                            float _2582 = _2579 - float(_2580);
+                            _2596 = dot(float3(_2582 * _2582, _2582, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2580], _476[_2580 + 1], _476[_2580 + 2]));
+                        }
+                        else
+                        {
+                            _2596 = log(10000.0) / _1065;
+                        }
+                        _2608 = _2596;
+                    }
+                    _2611 = _2608;
+                }
+                float _2612 = pow(10.0, _2611);
+                float _2614 = 0.17999999225139617919921875 * pow(2.0, 10.0);
+                float _2618 = log((_2614 <= 0.0) ? _2255 : _2614) / _1065;
+                float _2683;
+                if (_2618 <= _2260)
+                {
+                    _2683 = log(9.9999997473787516355514526367188e-05) / _1065;
+                }
+                else
+                {
+                    float _2680;
+                    if ((_2618 > _2260) && (_2618 < _2555))
+                    {
+                        float _2663 = (3.0 * (_2618 - _2260)) / (_2555 - _2260);
+                        int _2664 = int(_2663);
+                        float _2666 = _2663 - float(_2664);
+                        _2680 = dot(float3(_2666 * _2666, _2666, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_2664], _475[_2664 + 1], _475[_2664 + 2]));
+                    }
+                    else
+                    {
+                        float _2631 = log(_2253) / _1065;
+                        float _2659;
+                        if ((_2618 >= _2555) && (_2618 < _2631))
+                        {
+                            float _2642 = (3.0 * (_2618 - _2555)) / (_2631 - _2555);
+                            int _2643 = int(_2642);
+                            float _2645 = _2642 - float(_2643);
+                            _2659 = dot(float3(_2645 * _2645, _2645, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_2643], _476[_2643 + 1], _476[_2643 + 2]));
+                        }
+                        else
+                        {
+                            _2659 = log(10000.0) / _1065;
+                        }
+                        _2680 = _2659;
+                    }
+                    _2683 = _2680;
+                }
+                float _2684 = pow(10.0, _2683);
+                float _2685 = _2479.x;
+                float _2689 = log((_2685 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2685) / _1065;
+                float _2690 = log(pow(10.0, _2552));
+                float _2691 = _2690 / _1065;
+                float _2768;
+                if (_2689 <= _2691)
+                {
+                    _2768 = (_2689 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1065) - ((3.0 * _2690) / _1065));
+                }
+                else
+                {
+                    float _2698 = log(_2612) / _1065;
+                    float _2760;
+                    if ((_2689 > _2691) && (_2689 < _2698))
+                    {
+                        float _2743 = (7.0 * (_2689 - _2691)) / (_2698 - _2691);
+                        int _2744 = int(_2743);
+                        float _2746 = _2743 - float(_2744);
+                        _2760 = dot(float3(_2746 * _2746, _2746, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2744], _479[_2744 + 1], _479[_2744 + 2]));
+                    }
+                    else
+                    {
+                        float _2705 = log(_2684);
+                        float _2706 = _2705 / _1065;
+                        float _2739;
+                        if ((_2689 >= _2698) && (_2689 < _2706))
+                        {
+                            float _2722 = (7.0 * (_2689 - _2698)) / (_2706 - _2698);
+                            int _2723 = int(_2722);
+                            float _2725 = _2722 - float(_2723);
+                            _2739 = dot(float3(_2725 * _2725, _2725, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2723], _480[_2723 + 1], _480[_2723 + 2]));
+                        }
+                        else
+                        {
+                            _2739 = (_2689 * 0.0599999986588954925537109375) + ((log(1000.0) / _1065) - ((0.0599999986588954925537109375 * _2705) / _1065));
+                        }
+                        _2760 = _2739;
+                    }
+                    _2768 = _2760;
+                }
+                float3 _2770 = _391;
+                _2770.x = pow(10.0, _2768);
+                float _2771 = _2479.y;
+                float _2775 = log((_2771 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2771) / _1065;
+                float _2852;
+                if (_2775 <= _2691)
+                {
+                    _2852 = (_2775 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1065) - ((3.0 * _2690) / _1065));
+                }
+                else
+                {
+                    float _2782 = log(_2612) / _1065;
+                    float _2844;
+                    if ((_2775 > _2691) && (_2775 < _2782))
+                    {
+                        float _2827 = (7.0 * (_2775 - _2691)) / (_2782 - _2691);
+                        int _2828 = int(_2827);
+                        float _2830 = _2827 - float(_2828);
+                        _2844 = dot(float3(_2830 * _2830, _2830, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2828], _479[_2828 + 1], _479[_2828 + 2]));
+                    }
+                    else
+                    {
+                        float _2789 = log(_2684);
+                        float _2790 = _2789 / _1065;
+                        float _2823;
+                        if ((_2775 >= _2782) && (_2775 < _2790))
+                        {
+                            float _2806 = (7.0 * (_2775 - _2782)) / (_2790 - _2782);
+                            int _2807 = int(_2806);
+                            float _2809 = _2806 - float(_2807);
+                            _2823 = dot(float3(_2809 * _2809, _2809, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2807], _480[_2807 + 1], _480[_2807 + 2]));
+                        }
+                        else
+                        {
+                            _2823 = (_2775 * 0.0599999986588954925537109375) + ((log(1000.0) / _1065) - ((0.0599999986588954925537109375 * _2789) / _1065));
+                        }
+                        _2844 = _2823;
+                    }
+                    _2852 = _2844;
+                }
+                float3 _2854 = _2770;
+                _2854.y = pow(10.0, _2852);
+                float _2855 = _2479.z;
+                float _2859 = log((_2855 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2855) / _1065;
+                float _2936;
+                if (_2859 <= _2691)
+                {
+                    _2936 = (_2859 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1065) - ((3.0 * _2690) / _1065));
+                }
+                else
+                {
+                    float _2866 = log(_2612) / _1065;
+                    float _2928;
+                    if ((_2859 > _2691) && (_2859 < _2866))
+                    {
+                        float _2911 = (7.0 * (_2859 - _2691)) / (_2866 - _2691);
+                        int _2912 = int(_2911);
+                        float _2914 = _2911 - float(_2912);
+                        _2928 = dot(float3(_2914 * _2914, _2914, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_479[_2912], _479[_2912 + 1], _479[_2912 + 2]));
+                    }
+                    else
+                    {
+                        float _2873 = log(_2684);
+                        float _2874 = _2873 / _1065;
+                        float _2907;
+                        if ((_2859 >= _2866) && (_2859 < _2874))
+                        {
+                            float _2890 = (7.0 * (_2859 - _2866)) / (_2874 - _2866);
+                            int _2891 = int(_2890);
+                            float _2893 = _2890 - float(_2891);
+                            _2907 = dot(float3(_2893 * _2893, _2893, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_480[_2891], _480[_2891 + 1], _480[_2891 + 2]));
+                        }
+                        else
+                        {
+                            _2907 = (_2859 * 0.0599999986588954925537109375) + ((log(1000.0) / _1065) - ((0.0599999986588954925537109375 * _2873) / _1065));
+                        }
+                        _2928 = _2907;
+                    }
+                    _2936 = _2928;
+                }
+                float3 _2938 = _2854;
+                _2938.z = pow(10.0, _2936);
+                float3 _2942 = pow(((_2938 - float3(3.5073844628641381859779357910156e-05)) * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+                _2950 = pow((float3(0.8359375) + (float3(18.8515625) * _2942)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _2942))), float3(78.84375));
+            }
+            else
+            {
+                float3 _2097;
+                if ((_Globals.OutputDevice == 4u) || (_Globals.OutputDevice == 6u))
+                {
+                    float3 _1263 = (_906 * float3(1.5)) * (_546 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)));
+                    float _1264 = _1263.x;
+                    float _1265 = _1263.y;
+                    float _1267 = _1263.z;
+                    float _1270 = fast::max(fast::max(_1264, _1265), _1267);
+                    float _1275 = (fast::max(_1270, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_1264, _1265), _1267), 1.0000000133514319600180897396058e-10)) / fast::max(_1270, 0.00999999977648258209228515625);
+                    float _1288 = ((_1267 + _1265) + _1264) + (1.75 * sqrt(((_1267 * (_1267 - _1265)) + (_1265 * (_1265 - _1264))) + (_1264 * (_1264 - _1267))));
+                    float _1289 = _1288 * 0.3333333432674407958984375;
+                    float _1290 = _1275 - 0.4000000059604644775390625;
+                    float _1295 = fast::max(1.0 - abs(_1290 * 2.5), 0.0);
+                    float _1303 = (1.0 + (float(int(sign(_1290 * 5.0))) * (1.0 - (_1295 * _1295)))) * 0.02500000037252902984619140625;
+                    float _1316;
+                    if (_1289 <= 0.053333334624767303466796875)
+                    {
+                        _1316 = _1303;
+                    }
+                    else
+                    {
+                        float _1315;
+                        if (_1289 >= 0.1599999964237213134765625)
+                        {
+                            _1315 = 0.0;
+                        }
+                        else
+                        {
+                            _1315 = _1303 * ((0.23999999463558197021484375 / _1288) - 0.5);
+                        }
+                        _1316 = _1315;
+                    }
+                    float3 _1319 = _1263 * float3(1.0 + _1316);
+                    float _1320 = _1319.x;
+                    float _1321 = _1319.y;
+                    float _1323 = _1319.z;
+                    float _1337;
+                    if ((_1320 == _1321) && (_1321 == _1323))
+                    {
+                        _1337 = 0.0;
+                    }
+                    else
+                    {
+                        _1337 = 57.2957763671875 * atan2(sqrt(3.0) * (_1321 - _1323), ((2.0 * _1320) - _1321) - _1323);
+                    }
+                    float _1342;
+                    if (_1337 < 0.0)
+                    {
+                        _1342 = _1337 + 360.0;
+                    }
+                    else
+                    {
+                        _1342 = _1337;
+                    }
+                    float _1343 = fast::clamp(_1342, 0.0, 360.0);
+                    float _1348;
+                    if (_1343 > 180.0)
+                    {
+                        _1348 = _1343 - 360.0;
+                    }
+                    else
+                    {
+                        _1348 = _1343;
+                    }
+                    float _1398;
+                    if ((_1348 > (-67.5)) && (_1348 < 67.5))
+                    {
+                        float _1355 = (_1348 - (-67.5)) * 0.0296296291053295135498046875;
+                        int _1356 = int(_1355);
+                        float _1358 = _1355 - float(_1356);
+                        float _1359 = _1358 * _1358;
+                        float _1360 = _1359 * _1358;
+                        float _1397;
+                        if (_1356 == 3)
+                        {
+                            _1397 = (((_1360 * (-0.16666667163372039794921875)) + (_1359 * 0.5)) + (_1358 * (-0.5))) + 0.16666667163372039794921875;
+                        }
+                        else
+                        {
+                            float _1390;
+                            if (_1356 == 2)
+                            {
+                                _1390 = ((_1360 * 0.5) + (_1359 * (-1.0))) + 0.666666686534881591796875;
+                            }
+                            else
+                            {
+                                float _1385;
+                                if (_1356 == 1)
+                                {
+                                    _1385 = (((_1360 * (-0.5)) + (_1359 * 0.5)) + (_1358 * 0.5)) + 0.16666667163372039794921875;
+                                }
+                                else
+                                {
+                                    float _1378;
+                                    if (_1356 == 0)
+                                    {
+                                        _1378 = _1360 * 0.16666667163372039794921875;
+                                    }
+                                    else
+                                    {
+                                        _1378 = 0.0;
+                                    }
+                                    _1385 = _1378;
+                                }
+                                _1390 = _1385;
+                            }
+                            _1397 = _1390;
+                        }
+                        _1398 = _1397;
+                    }
+                    else
+                    {
+                        _1398 = 0.0;
+                    }
+                    float3 _1405 = _1319;
+                    _1405.x = _1320 + ((((_1398 * 1.5) * _1275) * (0.02999999932944774627685546875 - _1320)) * 0.180000007152557373046875);
+                    float3 _1408 = fast::clamp(fast::clamp(_1405, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0));
+                    float3 _1411 = mix(float3(dot(_1408, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1408, float3(0.959999978542327880859375));
+                    float _1412 = _1411.x;
+                    float _1416 = 0.17999999225139617919921875 * exp2(18.0);
+                    float _1418 = exp2(-14.0);
+                    float _1421 = log((_1412 <= 0.0) ? _1418 : _1412) / _1065;
+                    float _1423 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1065;
+                    float _1490;
+                    if (_1421 <= _1423)
+                    {
+                        _1490 = log(9.9999997473787516355514526367188e-05) / _1065;
+                    }
+                    else
+                    {
+                        float _1430 = log(0.180000007152557373046875) / _1065;
+                        float _1487;
+                        if ((_1421 > _1423) && (_1421 < _1430))
+                        {
+                            float _1470 = (3.0 * (_1421 - _1423)) / (_1430 - _1423);
+                            int _1471 = int(_1470);
+                            float _1473 = _1470 - float(_1471);
+                            _1487 = dot(float3(_1473 * _1473, _1473, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1471], _475[_1471 + 1], _475[_1471 + 2]));
+                        }
+                        else
+                        {
+                            float _1438 = log(_1416) / _1065;
+                            float _1466;
+                            if ((_1421 >= _1430) && (_1421 < _1438))
+                            {
+                                float _1449 = (3.0 * (_1421 - _1430)) / (_1438 - _1430);
+                                int _1450 = int(_1449);
+                                float _1452 = _1449 - float(_1450);
+                                _1466 = dot(float3(_1452 * _1452, _1452, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1450], _476[_1450 + 1], _476[_1450 + 2]));
+                            }
+                            else
+                            {
+                                _1466 = log(10000.0) / _1065;
+                            }
+                            _1487 = _1466;
+                        }
+                        _1490 = _1487;
+                    }
+                    float3 _1492 = _391;
+                    _1492.x = pow(10.0, _1490);
+                    float _1493 = _1411.y;
+                    float _1497 = log((_1493 <= 0.0) ? _1418 : _1493) / _1065;
+                    float _1564;
+                    if (_1497 <= _1423)
+                    {
+                        _1564 = log(9.9999997473787516355514526367188e-05) / _1065;
+                    }
+                    else
+                    {
+                        float _1504 = log(0.180000007152557373046875) / _1065;
+                        float _1561;
+                        if ((_1497 > _1423) && (_1497 < _1504))
+                        {
+                            float _1544 = (3.0 * (_1497 - _1423)) / (_1504 - _1423);
+                            int _1545 = int(_1544);
+                            float _1547 = _1544 - float(_1545);
+                            _1561 = dot(float3(_1547 * _1547, _1547, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1545], _475[_1545 + 1], _475[_1545 + 2]));
+                        }
+                        else
+                        {
+                            float _1512 = log(_1416) / _1065;
+                            float _1540;
+                            if ((_1497 >= _1504) && (_1497 < _1512))
+                            {
+                                float _1523 = (3.0 * (_1497 - _1504)) / (_1512 - _1504);
+                                int _1524 = int(_1523);
+                                float _1526 = _1523 - float(_1524);
+                                _1540 = dot(float3(_1526 * _1526, _1526, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1524], _476[_1524 + 1], _476[_1524 + 2]));
+                            }
+                            else
+                            {
+                                _1540 = log(10000.0) / _1065;
+                            }
+                            _1561 = _1540;
+                        }
+                        _1564 = _1561;
+                    }
+                    float3 _1566 = _1492;
+                    _1566.y = pow(10.0, _1564);
+                    float _1567 = _1411.z;
+                    float _1571 = log((_1567 <= 0.0) ? _1418 : _1567) / _1065;
+                    float _1638;
+                    if (_1571 <= _1423)
+                    {
+                        _1638 = log(9.9999997473787516355514526367188e-05) / _1065;
+                    }
+                    else
+                    {
+                        float _1578 = log(0.180000007152557373046875) / _1065;
+                        float _1635;
+                        if ((_1571 > _1423) && (_1571 < _1578))
+                        {
+                            float _1618 = (3.0 * (_1571 - _1423)) / (_1578 - _1423);
+                            int _1619 = int(_1618);
+                            float _1621 = _1618 - float(_1619);
+                            _1635 = dot(float3(_1621 * _1621, _1621, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1619], _475[_1619 + 1], _475[_1619 + 2]));
+                        }
+                        else
+                        {
+                            float _1586 = log(_1416) / _1065;
+                            float _1614;
+                            if ((_1571 >= _1578) && (_1571 < _1586))
+                            {
+                                float _1597 = (3.0 * (_1571 - _1578)) / (_1586 - _1578);
+                                int _1598 = int(_1597);
+                                float _1600 = _1597 - float(_1598);
+                                _1614 = dot(float3(_1600 * _1600, _1600, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1598], _476[_1598 + 1], _476[_1598 + 2]));
+                            }
+                            else
+                            {
+                                _1614 = log(10000.0) / _1065;
+                            }
+                            _1635 = _1614;
+                        }
+                        _1638 = _1635;
+                    }
+                    float3 _1640 = _1566;
+                    _1640.z = pow(10.0, _1638);
+                    float3 _1642 = (_1640 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375));
+                    float _1644 = 0.17999999225139617919921875 * pow(2.0, -12.0);
+                    float _1648 = log((_1644 <= 0.0) ? _1418 : _1644) / _1065;
+                    float _1715;
+                    if (_1648 <= _1423)
+                    {
+                        _1715 = log(9.9999997473787516355514526367188e-05) / _1065;
+                    }
+                    else
+                    {
+                        float _1655 = log(0.180000007152557373046875) / _1065;
+                        float _1712;
+                        if ((_1648 > _1423) && (_1648 < _1655))
+                        {
+                            float _1695 = (3.0 * (_1648 - _1423)) / (_1655 - _1423);
+                            int _1696 = int(_1695);
+                            float _1698 = _1695 - float(_1696);
+                            _1712 = dot(float3(_1698 * _1698, _1698, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1696], _475[_1696 + 1], _475[_1696 + 2]));
+                        }
+                        else
+                        {
+                            float _1663 = log(_1416) / _1065;
+                            float _1691;
+                            if ((_1648 >= _1655) && (_1648 < _1663))
+                            {
+                                float _1674 = (3.0 * (_1648 - _1655)) / (_1663 - _1655);
+                                int _1675 = int(_1674);
+                                float _1677 = _1674 - float(_1675);
+                                _1691 = dot(float3(_1677 * _1677, _1677, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1675], _476[_1675 + 1], _476[_1675 + 2]));
+                            }
+                            else
+                            {
+                                _1691 = log(10000.0) / _1065;
+                            }
+                            _1712 = _1691;
+                        }
+                        _1715 = _1712;
+                    }
+                    float _1718 = log(0.180000007152557373046875) / _1065;
+                    float _1774;
+                    if (_1718 <= _1423)
+                    {
+                        _1774 = log(9.9999997473787516355514526367188e-05) / _1065;
+                    }
+                    else
+                    {
+                        float _1771;
+                        if ((_1718 > _1423) && (_1718 < _1718))
+                        {
+                            _1771 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(-0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875)).z;
+                        }
+                        else
+                        {
+                            float _1731 = log(_1416) / _1065;
+                            float _1759;
+                            if ((_1718 >= _1718) && (_1718 < _1731))
+                            {
+                                float _1742 = (3.0 * (_1718 - _1718)) / (_1731 - _1718);
+                                int _1743 = int(_1742);
+                                float _1745 = _1742 - float(_1743);
+                                _1759 = dot(float3(_1745 * _1745, _1745, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1743], _476[_1743 + 1], _476[_1743 + 2]));
+                            }
+                            else
+                            {
+                                _1759 = log(10000.0) / _1065;
+                            }
+                            _1771 = _1759;
+                        }
+                        _1774 = _1771;
+                    }
+                    float _1775 = pow(10.0, _1774);
+                    float _1777 = 0.17999999225139617919921875 * pow(2.0, 11.0);
+                    float _1781 = log((_1777 <= 0.0) ? _1418 : _1777) / _1065;
+                    float _1846;
+                    if (_1781 <= _1423)
+                    {
+                        _1846 = log(9.9999997473787516355514526367188e-05) / _1065;
+                    }
+                    else
+                    {
+                        float _1843;
+                        if ((_1781 > _1423) && (_1781 < _1718))
+                        {
+                            float _1826 = (3.0 * (_1781 - _1423)) / (_1718 - _1423);
+                            int _1827 = int(_1826);
+                            float _1829 = _1826 - float(_1827);
+                            _1843 = dot(float3(_1829 * _1829, _1829, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_475[_1827], _475[_1827 + 1], _475[_1827 + 2]));
+                        }
+                        else
+                        {
+                            float _1794 = log(_1416) / _1065;
+                            float _1822;
+                            if ((_1781 >= _1718) && (_1781 < _1794))
+                            {
+                                float _1805 = (3.0 * (_1781 - _1718)) / (_1794 - _1718);
+                                int _1806 = int(_1805);
+                                float _1808 = _1805 - float(_1806);
+                                _1822 = dot(float3(_1808 * _1808, _1808, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_476[_1806], _476[_1806 + 1], _476[_1806 + 2]));
+                            }
+                            else
+                            {
+                                _1822 = log(10000.0) / _1065;
+                            }
+                            _1843 = _1822;
+                        }
+                        _1846 = _1843;
+                    }
+                    float _1847 = pow(10.0, _1846);
+                    float _1848 = _1642.x;
+                    float _1852 = log((_1848 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1848) / _1065;
+                    float _1854 = log(pow(10.0, _1715)) / _1065;
+                    float _1926;
+                    if (_1852 <= _1854)
+                    {
+                        _1926 = log(0.004999999888241291046142578125) / _1065;
+                    }
+                    else
+                    {
+                        float _1861 = log(_1775) / _1065;
+                        float _1923;
+                        if ((_1852 > _1854) && (_1852 < _1861))
+                        {
+                            float _1906 = (7.0 * (_1852 - _1854)) / (_1861 - _1854);
+                            int _1907 = int(_1906);
+                            float _1909 = _1906 - float(_1907);
+                            _1923 = dot(float3(_1909 * _1909, _1909, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_1907], _482[_1907 + 1], _482[_1907 + 2]));
+                        }
+                        else
+                        {
+                            float _1868 = log(_1847);
+                            float _1869 = _1868 / _1065;
+                            float _1902;
+                            if ((_1852 >= _1861) && (_1852 < _1869))
+                            {
+                                float _1885 = (7.0 * (_1852 - _1861)) / (_1869 - _1861);
+                                int _1886 = int(_1885);
+                                float _1888 = _1885 - float(_1886);
+                                _1902 = dot(float3(_1888 * _1888, _1888, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_1886], _483[_1886 + 1], _483[_1886 + 2]));
+                            }
+                            else
+                            {
+                                _1902 = (_1852 * 0.119999997317790985107421875) + ((log(2000.0) / _1065) - ((0.119999997317790985107421875 * _1868) / _1065));
+                            }
+                            _1923 = _1902;
+                        }
+                        _1926 = _1923;
+                    }
+                    float3 _1928 = _391;
+                    _1928.x = pow(10.0, _1926);
+                    float _1929 = _1642.y;
+                    float _1933 = log((_1929 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1929) / _1065;
+                    float _2005;
+                    if (_1933 <= _1854)
+                    {
+                        _2005 = log(0.004999999888241291046142578125) / _1065;
+                    }
+                    else
+                    {
+                        float _1940 = log(_1775) / _1065;
+                        float _2002;
+                        if ((_1933 > _1854) && (_1933 < _1940))
+                        {
+                            float _1985 = (7.0 * (_1933 - _1854)) / (_1940 - _1854);
+                            int _1986 = int(_1985);
+                            float _1988 = _1985 - float(_1986);
+                            _2002 = dot(float3(_1988 * _1988, _1988, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_1986], _482[_1986 + 1], _482[_1986 + 2]));
+                        }
+                        else
+                        {
+                            float _1947 = log(_1847);
+                            float _1948 = _1947 / _1065;
+                            float _1981;
+                            if ((_1933 >= _1940) && (_1933 < _1948))
+                            {
+                                float _1964 = (7.0 * (_1933 - _1940)) / (_1948 - _1940);
+                                int _1965 = int(_1964);
+                                float _1967 = _1964 - float(_1965);
+                                _1981 = dot(float3(_1967 * _1967, _1967, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_1965], _483[_1965 + 1], _483[_1965 + 2]));
+                            }
+                            else
+                            {
+                                _1981 = (_1933 * 0.119999997317790985107421875) + ((log(2000.0) / _1065) - ((0.119999997317790985107421875 * _1947) / _1065));
+                            }
+                            _2002 = _1981;
+                        }
+                        _2005 = _2002;
+                    }
+                    float3 _2007 = _1928;
+                    _2007.y = pow(10.0, _2005);
+                    float _2008 = _1642.z;
+                    float _2012 = log((_2008 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2008) / _1065;
+                    float _2084;
+                    if (_2012 <= _1854)
+                    {
+                        _2084 = log(0.004999999888241291046142578125) / _1065;
+                    }
+                    else
+                    {
+                        float _2019 = log(_1775) / _1065;
+                        float _2081;
+                        if ((_2012 > _1854) && (_2012 < _2019))
+                        {
+                            float _2064 = (7.0 * (_2012 - _1854)) / (_2019 - _1854);
+                            int _2065 = int(_2064);
+                            float _2067 = _2064 - float(_2065);
+                            _2081 = dot(float3(_2067 * _2067, _2067, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_482[_2065], _482[_2065 + 1], _482[_2065 + 2]));
+                        }
+                        else
+                        {
+                            float _2026 = log(_1847);
+                            float _2027 = _2026 / _1065;
+                            float _2060;
+                            if ((_2012 >= _2019) && (_2012 < _2027))
+                            {
+                                float _2043 = (7.0 * (_2012 - _2019)) / (_2027 - _2019);
+                                int _2044 = int(_2043);
+                                float _2046 = _2043 - float(_2044);
+                                _2060 = dot(float3(_2046 * _2046, _2046, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_483[_2044], _483[_2044 + 1], _483[_2044 + 2]));
+                            }
+                            else
+                            {
+                                _2060 = (_2012 * 0.119999997317790985107421875) + ((log(2000.0) / _1065) - ((0.119999997317790985107421875 * _2026) / _1065));
+                            }
+                            _2081 = _2060;
+                        }
+                        _2084 = _2081;
+                    }
+                    float3 _2086 = _2007;
+                    _2086.z = pow(10.0, _2084);
+                    float3 _2089 = pow((_2086 * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+                    _2097 = pow((float3(0.8359375) + (float3(18.8515625) * _2089)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _2089))), float3(78.84375));
+                }
+                else
+                {
+                    float3 _1260;
+                    if (_Globals.OutputDevice == 7u)
+                    {
+                        float3 _1252 = pow(((_906 * _547) * _576) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+                        _1260 = pow((float3(0.8359375) + (float3(18.8515625) * _1252)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _1252))), float3(78.84375));
+                    }
+                    else
+                    {
+                        _1260 = pow((_1218 * _547) * _576, float3(_Globals.InverseGamma.z));
+                    }
+                    _2097 = _1260;
+                }
+                _2950 = _2097;
+            }
+            _2960 = _2950;
+        }
+        _3001 = _2960;
+    }
+    float3 _3002 = _3001 * float3(0.95238101482391357421875);
+    float4 _3004 = float4(_3002.x, _3002.y, _3002.z, float4(0.0).w);
+    _3004.w = 0.0;
+    out.out_var_SV_Target0 = _3004;
+    return out;
+}
+

+ 1413 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/padded-float-array-member-defef.asm.frag

@@ -0,0 +1,1413 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_Globals
+{
+    float4 MappingPolynomial;
+    float3 InverseGamma;
+    float4 ColorMatrixR_ColorCurveCd1;
+    float4 ColorMatrixG_ColorCurveCd3Cm3;
+    float4 ColorMatrixB_ColorCurveCm2;
+    float4 ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3;
+    float4 ColorCurve_Ch1_Ch2;
+    float4 ColorShadow_Luma;
+    float4 ColorShadow_Tint1;
+    float4 ColorShadow_Tint2;
+    float FilmSlope;
+    float FilmToe;
+    float FilmShoulder;
+    float FilmBlackClip;
+    float FilmWhiteClip;
+    float4 LUTWeights[5];
+    float3 ColorScale;
+    float4 OverlayColor;
+    float WhiteTemp;
+    float WhiteTint;
+    float4 ColorSaturation;
+    float4 ColorContrast;
+    float4 ColorGamma;
+    float4 ColorGain;
+    float4 ColorOffset;
+    float4 ColorSaturationShadows;
+    float4 ColorContrastShadows;
+    float4 ColorGammaShadows;
+    float4 ColorGainShadows;
+    float4 ColorOffsetShadows;
+    float4 ColorSaturationMidtones;
+    float4 ColorContrastMidtones;
+    float4 ColorGammaMidtones;
+    float4 ColorGainMidtones;
+    float4 ColorOffsetMidtones;
+    float4 ColorSaturationHighlights;
+    float4 ColorContrastHighlights;
+    float4 ColorGammaHighlights;
+    float4 ColorGainHighlights;
+    float4 ColorOffsetHighlights;
+    float ColorCorrectionShadowsMax;
+    float ColorCorrectionHighlightsMin;
+    uint OutputDevice;
+    uint OutputGamut;
+    float BlueCorrection;
+    float ExpandGamut;
+};
+
+constant spvUnsafeArray<float, 6> _499 = spvUnsafeArray<float, 6>({ -4.0, -4.0, -3.1573765277862548828125, -0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875 });
+constant spvUnsafeArray<float, 6> _500 = spvUnsafeArray<float, 6>({ -0.718548238277435302734375, 2.0810306072235107421875, 3.66812419891357421875, 4.0, 4.0, 4.0 });
+constant spvUnsafeArray<float, 10> _503 = spvUnsafeArray<float, 10>({ -4.97062206268310546875, -3.0293781757354736328125, -2.1261999607086181640625, -1.5104999542236328125, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 });
+constant spvUnsafeArray<float, 10> _504 = spvUnsafeArray<float, 10>({ 0.80891323089599609375, 1.19108676910400390625, 1.5683000087738037109375, 1.94830000400543212890625, 2.308300018310546875, 2.63840007781982421875, 2.85949993133544921875, 2.9872608184814453125, 3.0127391815185546875, 3.0127391815185546875 });
+constant spvUnsafeArray<float, 10> _506 = spvUnsafeArray<float, 10>({ -2.3010299205780029296875, -2.3010299205780029296875, -1.9312000274658203125, -1.5204999446868896484375, -1.0578000545501708984375, -0.4668000042438507080078125, 0.11937999725341796875, 0.7088134288787841796875, 1.2911865711212158203125, 1.2911865711212158203125 });
+constant spvUnsafeArray<float, 10> _507 = spvUnsafeArray<float, 10>({ 0.801995217800140380859375, 1.19800484180450439453125, 1.5943000316619873046875, 1.99730002880096435546875, 2.3782999515533447265625, 2.7683999538421630859375, 3.0515000820159912109375, 3.2746293544769287109375, 3.32743072509765625, 3.32743072509765625 });
+
+constant float3 _523 = {};
+constant float3 _3123 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+};
+
+struct main0_in
+{
+    float2 in_var_TEXCOORD0 [[user(locn0), center_no_perspective]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], constant type_Globals& _Globals [[buffer(0)]], texture2d<float> Texture1 [[texture(0)]], sampler Texture1Sampler [[sampler(0)]], uint gl_Layer [[render_target_array_index]])
+{
+    main0_out out = {};
+    float3x3 _572 = float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * float3x3(float3(1.01303005218505859375, 0.0061053098179399967193603515625, -0.014971000142395496368408203125), float3(0.0076982299797236919403076171875, 0.99816501140594482421875, -0.005032029934227466583251953125), float3(-0.0028413101099431514739990234375, 0.0046851597726345062255859375, 0.92450702190399169921875));
+    float3x3 _573 = _572 * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125));
+    float3x3 _574 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(0.98722398281097412109375, -0.0061132698319852352142333984375, 0.01595330052077770233154296875), float3(-0.007598360069096088409423828125, 1.00186002254486083984375, 0.0053300200961530208587646484375), float3(0.003072570078074932098388671875, -0.0050959498621523380279541015625, 1.0816800594329833984375));
+    float3x3 _575 = _574 * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875));
+    float3x3 _576 = float3x3(float3(0.952552378177642822265625, 0.0, 9.25), float3(0.3439664542675018310546875, 0.728166103363037109375, -0.07213254272937774658203125), float3(0.0, 0.0, 1.00882518291473388671875)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125));
+    float3x3 _577 = float3x3(float3(0.662454187870025634765625, 0.1340042054653167724609375, 0.1561876833438873291015625), float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625), float3(-0.0055746496655046939849853515625, 0.0040607335977256298065185546875, 1.01033914089202880859375)) * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625));
+    float3x3 _602;
+    for (;;)
+    {
+        if (_Globals.OutputGamut == 1u)
+        {
+            _602 = _574 * float3x3(float3(2.493396282196044921875, -0.931345880031585693359375, -0.4026944935321807861328125), float3(-0.829486787319183349609375, 1.76265966892242431640625, 0.02362460084259510040283203125), float3(0.0358506999909877777099609375, -0.076182700693607330322265625, 0.957014024257659912109375));
+            break;
+        }
+        else
+        {
+            if (_Globals.OutputGamut == 2u)
+            {
+                _602 = _574 * float3x3(float3(1.71660840511322021484375, -0.3556621074676513671875, -0.253360092639923095703125), float3(-0.666682898998260498046875, 1.61647760868072509765625, 0.01576850004494190216064453125), float3(0.017642199993133544921875, -0.04277630150318145751953125, 0.94222867488861083984375));
+                break;
+            }
+            else
+            {
+                if (_Globals.OutputGamut == 3u)
+                {
+                    _602 = float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625));
+                    break;
+                }
+                else
+                {
+                    if (_Globals.OutputGamut == 4u)
+                    {
+                        _602 = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0));
+                        break;
+                    }
+                    else
+                    {
+                        _602 = _575;
+                        break;
+                    }
+                }
+            }
+        }
+    }
+    float3 _603 = float4((in.in_var_TEXCOORD0 - float2(0.015625)) * float2(1.03225803375244140625), float(gl_Layer) * 0.0322580635547637939453125, 0.0).xyz;
+    float3 _625;
+    if (_Globals.OutputDevice >= 3u)
+    {
+        float3 _617 = pow(_603, float3(0.0126833133399486541748046875));
+        _625 = pow(fast::max(float3(0.0), _617 - float3(0.8359375)) / (float3(18.8515625) - (float3(18.6875) * _617)), float3(6.277394771575927734375)) * float3(10000.0);
+    }
+    else
+    {
+        _625 = (exp2((_603 - float3(0.434017598628997802734375)) * float3(14.0)) * float3(0.180000007152557373046875)) - (exp2(float3(-6.0762462615966796875)) * float3(0.180000007152557373046875));
+    }
+    float _628 = _Globals.WhiteTemp * 1.00055634975433349609375;
+    float _642 = (_628 <= 7000.0) ? (0.24406300485134124755859375 + ((99.1100006103515625 + ((2967800.0 - (4604438528.0 / _Globals.WhiteTemp)) / _628)) / _628)) : (0.23703999817371368408203125 + ((247.4799957275390625 + ((1901800.0 - (2005284352.0 / _Globals.WhiteTemp)) / _628)) / _628));
+    float _659 = ((0.860117733478546142578125 + (0.00015411825734190642833709716796875 * _Globals.WhiteTemp)) + ((1.2864121856637211749330163002014e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 + (0.0008424202096648514270782470703125 * _Globals.WhiteTemp)) + ((7.0814513719597016461193561553955e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp));
+    float _670 = ((0.317398726940155029296875 + (4.25 * _Globals.WhiteTemp)) + ((4.2048167614439080352894961833954e-08 * _Globals.WhiteTemp) * _Globals.WhiteTemp)) / ((1.0 - (2.8974181986995972692966461181641e-05 * _Globals.WhiteTemp)) + ((1.6145605741257895715534687042236e-07 * _Globals.WhiteTemp) * _Globals.WhiteTemp));
+    float _675 = ((2.0 * _659) - (8.0 * _670)) + 4.0;
+    float2 _679 = float2((3.0 * _659) / _675, (2.0 * _670) / _675);
+    float2 _686 = normalize(float2(_659, _670));
+    float _691 = _659 + (((-_686.y) * _Globals.WhiteTint) * 0.0500000007450580596923828125);
+    float _695 = _670 + ((_686.x * _Globals.WhiteTint) * 0.0500000007450580596923828125);
+    float _700 = ((2.0 * _691) - (8.0 * _695)) + 4.0;
+    float2 _706 = select(float2(_642, ((((-3.0) * _642) * _642) + (2.86999988555908203125 * _642)) - 0.2750000059604644775390625), _679, bool2(_Globals.WhiteTemp < 4000.0)) + (float2((3.0 * _691) / _700, (2.0 * _695) / _700) - _679);
+    float _707 = _706.x;
+    float _708 = _706.y;
+    float _709 = fast::max(_708, 1.0000000133514319600180897396058e-10);
+    float3 _711 = _523;
+    _711.x = _707 / _709;
+    float3 _712 = _711;
+    _712.y = 1.0;
+    float3 _716 = _712;
+    _716.z = ((1.0 - _707) - _708) / _709;
+    float3 _719 = _523;
+    _719.x = 0.950455963611602783203125;
+    float3 _720 = _719;
+    _720.y = 1.0;
+    float3 _722 = _720;
+    _722.z = 1.0890576839447021484375;
+    float3 _723 = _716 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875));
+    float3 _724 = _722 * float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875));
+    float3 _743 = (_625 * ((float3x3(float3(0.41245639324188232421875, 0.3575761020183563232421875, 0.180437505245208740234375), float3(0.21267290413379669189453125, 0.715152204036712646484375, 0.072175003588199615478515625), float3(0.01933390088379383087158203125, 0.119191996753215789794921875, 0.950304090976715087890625)) * ((float3x3(float3(0.89509999752044677734375, 0.2664000093936920166015625, -0.16140000522136688232421875), float3(-0.750199973583221435546875, 1.71350002288818359375, 0.0366999991238117218017578125), float3(0.0388999991118907928466796875, -0.06849999725818634033203125, 1.02960002422332763671875)) * float3x3(float3(_724.x / _723.x, 0.0, 0.0), float3(0.0, _724.y / _723.y, 0.0), float3(0.0, 0.0, _724.z / _723.z))) * float3x3(float3(0.986992895603179931640625, -0.14705429971218109130859375, 0.15996269881725311279296875), float3(0.4323053061962127685546875, 0.518360316753387451171875, 0.049291200935840606689453125), float3(-0.00852870009839534759521484375, 0.0400427989661693572998046875, 0.968486726284027099609375)))) * float3x3(float3(3.2409698963165283203125, -1.53738319873809814453125, -0.4986107647418975830078125), float3(-0.96924364566802978515625, 1.875967502593994140625, 0.0415550582110881805419921875), float3(0.055630080401897430419921875, -0.2039769589900970458984375, 1.05697154998779296875)))) * _573;
+    float3 _771;
+    if (_Globals.ColorShadow_Tint2.w != 0.0)
+    {
+        float _750 = dot(_743, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625));
+        float3 _753 = (_743 / float3(_750)) - float3(1.0);
+        _771 = mix(_743, _743 * (_575 * (float3x3(float3(0.544169127941131591796875, 0.23959259688854217529296875, 0.16669429838657379150390625), float3(0.23946559429168701171875, 0.702153027057647705078125, 0.058381401002407073974609375), float3(-0.0023439000360667705535888671875, 0.0361833982169628143310546875, 1.05521833896636962890625)) * float3x3(float3(1.6410233974456787109375, -0.324803292751312255859375, -0.23642469942569732666015625), float3(-0.663662850856781005859375, 1.6153316497802734375, 0.016756348311901092529296875), float3(0.01172189414501190185546875, -0.008284442126750946044921875, 0.98839485645294189453125)))), float3((1.0 - exp2((-4.0) * dot(_753, _753))) * (1.0 - exp2((((-4.0) * _Globals.ExpandGamut) * _750) * _750))));
+    }
+    else
+    {
+        _771 = _743;
+    }
+    float _772 = dot(_771, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625));
+    float4 _777 = _Globals.ColorSaturationShadows * _Globals.ColorSaturation;
+    float4 _782 = _Globals.ColorContrastShadows * _Globals.ColorContrast;
+    float4 _787 = _Globals.ColorGammaShadows * _Globals.ColorGamma;
+    float4 _792 = _Globals.ColorGainShadows * _Globals.ColorGain;
+    float4 _797 = _Globals.ColorOffsetShadows + _Globals.ColorOffset;
+    float3 _798 = float3(_772);
+    float _830 = smoothstep(0.0, _Globals.ColorCorrectionShadowsMax, _772);
+    float4 _834 = _Globals.ColorSaturationHighlights * _Globals.ColorSaturation;
+    float4 _837 = _Globals.ColorContrastHighlights * _Globals.ColorContrast;
+    float4 _840 = _Globals.ColorGammaHighlights * _Globals.ColorGamma;
+    float4 _843 = _Globals.ColorGainHighlights * _Globals.ColorGain;
+    float4 _846 = _Globals.ColorOffsetHighlights + _Globals.ColorOffset;
+    float _878 = smoothstep(_Globals.ColorCorrectionHighlightsMin, 1.0, _772);
+    float4 _881 = _Globals.ColorSaturationMidtones * _Globals.ColorSaturation;
+    float4 _884 = _Globals.ColorContrastMidtones * _Globals.ColorContrast;
+    float4 _887 = _Globals.ColorGammaMidtones * _Globals.ColorGamma;
+    float4 _890 = _Globals.ColorGainMidtones * _Globals.ColorGain;
+    float4 _893 = _Globals.ColorOffsetMidtones + _Globals.ColorOffset;
+    float3 _931 = ((((pow(pow(fast::max(float3(0.0), mix(_798, _771, _777.xyz * float3(_777.w))) * float3(5.5555553436279296875), _782.xyz * float3(_782.w)) * float3(0.180000007152557373046875), float3(1.0) / (_787.xyz * float3(_787.w))) * (_792.xyz * float3(_792.w))) + (_797.xyz + float3(_797.w))) * float3(1.0 - _830)) + (((pow(pow(fast::max(float3(0.0), mix(_798, _771, _881.xyz * float3(_881.w))) * float3(5.5555553436279296875), _884.xyz * float3(_884.w)) * float3(0.180000007152557373046875), float3(1.0) / (_887.xyz * float3(_887.w))) * (_890.xyz * float3(_890.w))) + (_893.xyz + float3(_893.w))) * float3(_830 - _878))) + (((pow(pow(fast::max(float3(0.0), mix(_798, _771, _834.xyz * float3(_834.w))) * float3(5.5555553436279296875), _837.xyz * float3(_837.w)) * float3(0.180000007152557373046875), float3(1.0) / (_840.xyz * float3(_840.w))) * (_843.xyz * float3(_843.w))) + (_846.xyz + float3(_846.w))) * float3(_878));
+    float3 _932 = _931 * _575;
+    float3 _940 = float3(_Globals.BlueCorrection);
+    float3 _942 = mix(_931, _931 * ((_577 * float3x3(float3(0.940437257289886474609375, -0.01830687932670116424560546875, 0.07786960899829864501953125), float3(0.008378696627914905548095703125, 0.82866001129150390625, 0.162961304187774658203125), float3(0.0005471261101774871349334716796875, -0.00088337459601461887359619140625, 1.00033628940582275390625))) * _576), _940) * _577;
+    float _943 = _942.x;
+    float _944 = _942.y;
+    float _946 = _942.z;
+    float _949 = fast::max(fast::max(_943, _944), _946);
+    float _954 = (fast::max(_949, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_943, _944), _946), 1.0000000133514319600180897396058e-10)) / fast::max(_949, 0.00999999977648258209228515625);
+    float _967 = ((_946 + _944) + _943) + (1.75 * sqrt(((_946 * (_946 - _944)) + (_944 * (_944 - _943))) + (_943 * (_943 - _946))));
+    float _968 = _967 * 0.3333333432674407958984375;
+    float _969 = _954 - 0.4000000059604644775390625;
+    float _974 = fast::max(1.0 - abs(_969 * 2.5), 0.0);
+    float _982 = (1.0 + (float(int(sign(_969 * 5.0))) * (1.0 - (_974 * _974)))) * 0.02500000037252902984619140625;
+    float _995;
+    if (_968 <= 0.053333334624767303466796875)
+    {
+        _995 = _982;
+    }
+    else
+    {
+        float _994;
+        if (_968 >= 0.1599999964237213134765625)
+        {
+            _994 = 0.0;
+        }
+        else
+        {
+            _994 = _982 * ((0.23999999463558197021484375 / _967) - 0.5);
+        }
+        _995 = _994;
+    }
+    float3 _998 = _942 * float3(1.0 + _995);
+    float _999 = _998.x;
+    float _1000 = _998.y;
+    float _1002 = _998.z;
+    float _1016;
+    if ((_999 == _1000) && (_1000 == _1002))
+    {
+        _1016 = 0.0;
+    }
+    else
+    {
+        _1016 = 57.2957763671875 * atan2(sqrt(3.0) * (_1000 - _1002), ((2.0 * _999) - _1000) - _1002);
+    }
+    float _1021;
+    if (_1016 < 0.0)
+    {
+        _1021 = _1016 + 360.0;
+    }
+    else
+    {
+        _1021 = _1016;
+    }
+    float _1022 = fast::clamp(_1021, 0.0, 360.0);
+    float _1027;
+    if (_1022 > 180.0)
+    {
+        _1027 = _1022 - 360.0;
+    }
+    else
+    {
+        _1027 = _1022;
+    }
+    float _1031 = smoothstep(0.0, 1.0, 1.0 - abs(_1027 * 0.01481481455266475677490234375));
+    float3 _1038 = _998;
+    _1038.x = _999 + ((((_1031 * _1031) * _954) * (0.02999999932944774627685546875 - _999)) * 0.180000007152557373046875);
+    float3 _1040 = fast::max(float3(0.0), _1038 * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)));
+    float _1049 = (1.0 + _Globals.FilmBlackClip) - _Globals.FilmToe;
+    float _1052 = 1.0 + _Globals.FilmWhiteClip;
+    float _1055 = _1052 - _Globals.FilmShoulder;
+    float _1082;
+    if (_Globals.FilmToe > 0.800000011920928955078125)
+    {
+        _1082 = ((0.819999992847442626953125 - _Globals.FilmToe) / _Globals.FilmSlope) + (log(0.180000007152557373046875) / log(10.0));
+    }
+    else
+    {
+        float _1061 = (0.180000007152557373046875 + _Globals.FilmBlackClip) / _1049;
+        _1082 = (log(0.180000007152557373046875) / log(10.0)) - ((0.5 * log(_1061 / (2.0 - _1061))) * (_1049 / _Globals.FilmSlope));
+    }
+    float _1087 = ((1.0 - _Globals.FilmToe) / _Globals.FilmSlope) - _1082;
+    float _1089 = (_Globals.FilmShoulder / _Globals.FilmSlope) - _1087;
+    float _1091 = log(10.0);
+    float3 _1093 = log(mix(float3(dot(_1040, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1040, float3(0.959999978542327880859375))) / float3(_1091);
+    float3 _1097 = float3(_Globals.FilmSlope) * (_1093 + float3(_1087));
+    float3 _1105 = float3(_1082);
+    float3 _1106 = _1093 - _1105;
+    float3 _1118 = float3(_1089);
+    float3 _1132 = fast::clamp(_1106 / float3(_1089 - _1082), float3(0.0), float3(1.0));
+    float3 _1136 = select(_1132, float3(1.0) - _1132, bool3(_1089 < _1082));
+    float3 _1141 = mix(select(_1097, float3(-_Globals.FilmBlackClip) + (float3(2.0 * _1049) / (float3(1.0) + exp(float3(((-2.0) * _Globals.FilmSlope) / _1049) * _1106))), _1093 < _1105), select(_1097, float3(_1052) - (float3(2.0 * _1055) / (float3(1.0) + exp(float3((2.0 * _Globals.FilmSlope) / _1055) * (_1093 - _1118)))), _1093 > _1118), ((float3(3.0) - (float3(2.0) * _1136)) * _1136) * _1136);
+    float3 _1145 = fast::max(float3(0.0), mix(float3(dot(_1141, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1141, float3(0.930000007152557373046875)));
+    float3 _1215;
+    if (_Globals.ColorShadow_Tint2.w == 0.0)
+    {
+        float3 _1157 = _3123;
+        _1157.x = dot(_932, _Globals.ColorMatrixR_ColorCurveCd1.xyz);
+        float3 _1162 = _1157;
+        _1162.y = dot(_932, _Globals.ColorMatrixG_ColorCurveCd3Cm3.xyz);
+        float3 _1167 = _1162;
+        _1167.z = dot(_932, _Globals.ColorMatrixB_ColorCurveCm2.xyz);
+        float3 _1183 = fast::max(float3(0.0), _1167 * (_Globals.ColorShadow_Tint1.xyz + (_Globals.ColorShadow_Tint2.xyz * float3(1.0 / (dot(_932, _Globals.ColorShadow_Luma.xyz) + 1.0)))));
+        float3 _1188 = fast::max(float3(0.0), _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx - _1183);
+        float3 _1190 = fast::max(_1183, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz);
+        _1215 = ((((_1190 * _Globals.ColorCurve_Ch1_Ch2.xxx) + _Globals.ColorCurve_Ch1_Ch2.yyy) * (float3(1.0) / (_1190 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.www))) + ((fast::clamp(_1183, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.xxx, _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.zzz) * _Globals.ColorMatrixB_ColorCurveCm2.www) + (((_1188 * _Globals.ColorMatrixR_ColorCurveCd1.www) * (float3(1.0) / (_1188 + _Globals.ColorCurve_Cm0Cd0_Cd2_Ch0Cm1_Ch3.yyy))) + _Globals.ColorMatrixG_ColorCurveCd3Cm3.www))) - float3(0.00200000009499490261077880859375);
+    }
+    else
+    {
+        _1215 = fast::max(float3(0.0), mix(_1145, _1145 * ((_577 * float3x3(float3(1.06317996978759765625, 0.02339559979736804962158203125, -0.08657260239124298095703125), float3(-0.010633699595928192138671875, 1.2063200473785400390625, -0.1956900060176849365234375), float3(-0.0005908869788981974124908447265625, 0.00105247995816171169281005859375, 0.999538004398345947265625))) * _576), _940) * _575);
+    }
+    float3 _1216 = fast::clamp(_1215, float3(0.0), float3(1.0));
+    float _1217 = _1216.x;
+    float _1229;
+    for (;;)
+    {
+        if (_1217 < 0.00313066993840038776397705078125)
+        {
+            _1229 = _1217 * 12.9200000762939453125;
+            break;
+        }
+        _1229 = (pow(_1217, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+        break;
+    }
+    float _1230 = _1216.y;
+    float _1242;
+    for (;;)
+    {
+        if (_1230 < 0.00313066993840038776397705078125)
+        {
+            _1242 = _1230 * 12.9200000762939453125;
+            break;
+        }
+        _1242 = (pow(_1230, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+        break;
+    }
+    float _1243 = _1216.z;
+    float _1255;
+    for (;;)
+    {
+        if (_1243 < 0.00313066993840038776397705078125)
+        {
+            _1255 = _1243 * 12.9200000762939453125;
+            break;
+        }
+        _1255 = (pow(_1243, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+        break;
+    }
+    float3 _1256 = float3(_1229, _1242, _1255);
+    float3 _1258 = (_1256 * float3(0.9375)) + float3(0.03125);
+    float _1270 = (_1258.z * 16.0) - 0.5;
+    float _1271 = floor(_1270);
+    float _1275 = (_1258.x + _1271) * 0.0625;
+    float _1276 = _1258.y;
+    float4 _1279 = Texture1.sample(Texture1Sampler, float2(_1275, _1276));
+    float4 _1283 = Texture1.sample(Texture1Sampler, float2(_1275 + 0.0625, _1276));
+    float3 _1289 = fast::max(float3(6.1035199905745685100555419921875e-05), (float3(_Globals.LUTWeights[0].x) * _1256) + (float3(_Globals.LUTWeights[1].x) * mix(_1279, _1283, float4(_1270 - _1271)).xyz));
+    float3 _1295 = select(_1289 * float3(0.077399380505084991455078125), pow((_1289 * float3(0.94786727428436279296875)) + float3(0.0521326996386051177978515625), float3(2.400000095367431640625)), _1289 > float3(0.040449999272823333740234375));
+    float3 _1324 = pow(fast::max(float3(0.0), mix((((float3(_Globals.MappingPolynomial.x) * (_1295 * _1295)) + (float3(_Globals.MappingPolynomial.y) * _1295)) + float3(_Globals.MappingPolynomial.z)) * _Globals.ColorScale, _Globals.OverlayColor.xyz, float3(_Globals.OverlayColor.w))), float3(_Globals.InverseGamma.y));
+    float3 _3103;
+    if (_Globals.OutputDevice == 0u)
+    {
+        float _3063 = _1324.x;
+        float _3075;
+        for (;;)
+        {
+            if (_3063 < 0.00313066993840038776397705078125)
+            {
+                _3075 = _3063 * 12.9200000762939453125;
+                break;
+            }
+            _3075 = (pow(_3063, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+            break;
+        }
+        float _3076 = _1324.y;
+        float _3088;
+        for (;;)
+        {
+            if (_3076 < 0.00313066993840038776397705078125)
+            {
+                _3088 = _3076 * 12.9200000762939453125;
+                break;
+            }
+            _3088 = (pow(_3076, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+            break;
+        }
+        float _3089 = _1324.z;
+        float _3101;
+        for (;;)
+        {
+            if (_3089 < 0.00313066993840038776397705078125)
+            {
+                _3101 = _3089 * 12.9200000762939453125;
+                break;
+            }
+            _3101 = (pow(_3089, 0.4166666567325592041015625) * 1.05499994754791259765625) - 0.054999999701976776123046875;
+            break;
+        }
+        _3103 = float3(_3075, _3088, _3101);
+    }
+    else
+    {
+        float3 _3062;
+        if (_Globals.OutputDevice == 1u)
+        {
+            float3 _3055 = fast::max(float3(6.1035199905745685100555419921875e-05), (_1324 * _573) * _602);
+            _3062 = fast::min(_3055 * float3(4.5), (pow(fast::max(_3055, float3(0.017999999225139617919921875)), float3(0.449999988079071044921875)) * float3(1.09899997711181640625)) - float3(0.098999999463558197021484375));
+        }
+        else
+        {
+            float3 _3052;
+            if ((_Globals.OutputDevice == 3u) || (_Globals.OutputDevice == 5u))
+            {
+                float3 _2204 = (_932 * float3(1.5)) * (_572 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)));
+                float _2205 = _2204.x;
+                float _2206 = _2204.y;
+                float _2208 = _2204.z;
+                float _2211 = fast::max(fast::max(_2205, _2206), _2208);
+                float _2216 = (fast::max(_2211, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_2205, _2206), _2208), 1.0000000133514319600180897396058e-10)) / fast::max(_2211, 0.00999999977648258209228515625);
+                float _2229 = ((_2208 + _2206) + _2205) + (1.75 * sqrt(((_2208 * (_2208 - _2206)) + (_2206 * (_2206 - _2205))) + (_2205 * (_2205 - _2208))));
+                float _2230 = _2229 * 0.3333333432674407958984375;
+                float _2231 = _2216 - 0.4000000059604644775390625;
+                float _2236 = fast::max(1.0 - abs(_2231 * 2.5), 0.0);
+                float _2244 = (1.0 + (float(int(sign(_2231 * 5.0))) * (1.0 - (_2236 * _2236)))) * 0.02500000037252902984619140625;
+                float _2257;
+                if (_2230 <= 0.053333334624767303466796875)
+                {
+                    _2257 = _2244;
+                }
+                else
+                {
+                    float _2256;
+                    if (_2230 >= 0.1599999964237213134765625)
+                    {
+                        _2256 = 0.0;
+                    }
+                    else
+                    {
+                        _2256 = _2244 * ((0.23999999463558197021484375 / _2229) - 0.5);
+                    }
+                    _2257 = _2256;
+                }
+                float3 _2260 = _2204 * float3(1.0 + _2257);
+                float _2261 = _2260.x;
+                float _2262 = _2260.y;
+                float _2264 = _2260.z;
+                float _2278;
+                if ((_2261 == _2262) && (_2262 == _2264))
+                {
+                    _2278 = 0.0;
+                }
+                else
+                {
+                    _2278 = 57.2957763671875 * atan2(sqrt(3.0) * (_2262 - _2264), ((2.0 * _2261) - _2262) - _2264);
+                }
+                float _2283;
+                if (_2278 < 0.0)
+                {
+                    _2283 = _2278 + 360.0;
+                }
+                else
+                {
+                    _2283 = _2278;
+                }
+                float _2284 = fast::clamp(_2283, 0.0, 360.0);
+                float _2289;
+                if (_2284 > 180.0)
+                {
+                    _2289 = _2284 - 360.0;
+                }
+                else
+                {
+                    _2289 = _2284;
+                }
+                float _2339;
+                if ((_2289 > (-67.5)) && (_2289 < 67.5))
+                {
+                    float _2296 = (_2289 - (-67.5)) * 0.0296296291053295135498046875;
+                    int _2297 = int(_2296);
+                    float _2299 = _2296 - float(_2297);
+                    float _2300 = _2299 * _2299;
+                    float _2301 = _2300 * _2299;
+                    float _2338;
+                    if (_2297 == 3)
+                    {
+                        _2338 = (((_2301 * (-0.16666667163372039794921875)) + (_2300 * 0.5)) + (_2299 * (-0.5))) + 0.16666667163372039794921875;
+                    }
+                    else
+                    {
+                        float _2331;
+                        if (_2297 == 2)
+                        {
+                            _2331 = ((_2301 * 0.5) + (_2300 * (-1.0))) + 0.666666686534881591796875;
+                        }
+                        else
+                        {
+                            float _2326;
+                            if (_2297 == 1)
+                            {
+                                _2326 = (((_2301 * (-0.5)) + (_2300 * 0.5)) + (_2299 * 0.5)) + 0.16666667163372039794921875;
+                            }
+                            else
+                            {
+                                float _2319;
+                                if (_2297 == 0)
+                                {
+                                    _2319 = _2301 * 0.16666667163372039794921875;
+                                }
+                                else
+                                {
+                                    _2319 = 0.0;
+                                }
+                                _2326 = _2319;
+                            }
+                            _2331 = _2326;
+                        }
+                        _2338 = _2331;
+                    }
+                    _2339 = _2338;
+                }
+                else
+                {
+                    _2339 = 0.0;
+                }
+                float3 _2346 = _2260;
+                _2346.x = _2261 + ((((_2339 * 1.5) * _2216) * (0.02999999932944774627685546875 - _2261)) * 0.180000007152557373046875);
+                float3 _2349 = fast::clamp(fast::clamp(_2346, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0));
+                float3 _2352 = mix(float3(dot(_2349, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _2349, float3(0.959999978542327880859375));
+                float _2353 = _2352.x;
+                float _2357 = 0.17999999225139617919921875 * exp2(18.0);
+                float _2359 = exp2(-14.0);
+                float _2362 = log((_2353 <= 0.0) ? _2359 : _2353) / _1091;
+                float _2364 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1091;
+                float _2431;
+                if (_2362 <= _2364)
+                {
+                    _2431 = log(9.9999997473787516355514526367188e-05) / _1091;
+                }
+                else
+                {
+                    float _2371 = log(0.180000007152557373046875) / _1091;
+                    float _2428;
+                    if ((_2362 > _2364) && (_2362 < _2371))
+                    {
+                        float _2411 = (3.0 * (_2362 - _2364)) / (_2371 - _2364);
+                        int _2412 = int(_2411);
+                        float _2414 = _2411 - float(_2412);
+                        _2428 = dot(float3(_2414 * _2414, _2414, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2412], _499[_2412 + 1], _499[_2412 + 2]));
+                    }
+                    else
+                    {
+                        float _2379 = log(_2357) / _1091;
+                        float _2407;
+                        if ((_2362 >= _2371) && (_2362 < _2379))
+                        {
+                            float _2390 = (3.0 * (_2362 - _2371)) / (_2379 - _2371);
+                            int _2391 = int(_2390);
+                            float _2393 = _2390 - float(_2391);
+                            _2407 = dot(float3(_2393 * _2393, _2393, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2391], _500[_2391 + 1], _500[_2391 + 2]));
+                        }
+                        else
+                        {
+                            _2407 = log(10000.0) / _1091;
+                        }
+                        _2428 = _2407;
+                    }
+                    _2431 = _2428;
+                }
+                float3 _2433 = _523;
+                _2433.x = pow(10.0, _2431);
+                float _2434 = _2352.y;
+                float _2438 = log((_2434 <= 0.0) ? _2359 : _2434) / _1091;
+                float _2505;
+                if (_2438 <= _2364)
+                {
+                    _2505 = log(9.9999997473787516355514526367188e-05) / _1091;
+                }
+                else
+                {
+                    float _2445 = log(0.180000007152557373046875) / _1091;
+                    float _2502;
+                    if ((_2438 > _2364) && (_2438 < _2445))
+                    {
+                        float _2485 = (3.0 * (_2438 - _2364)) / (_2445 - _2364);
+                        int _2486 = int(_2485);
+                        float _2488 = _2485 - float(_2486);
+                        _2502 = dot(float3(_2488 * _2488, _2488, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2486], _499[_2486 + 1], _499[_2486 + 2]));
+                    }
+                    else
+                    {
+                        float _2453 = log(_2357) / _1091;
+                        float _2481;
+                        if ((_2438 >= _2445) && (_2438 < _2453))
+                        {
+                            float _2464 = (3.0 * (_2438 - _2445)) / (_2453 - _2445);
+                            int _2465 = int(_2464);
+                            float _2467 = _2464 - float(_2465);
+                            _2481 = dot(float3(_2467 * _2467, _2467, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2465], _500[_2465 + 1], _500[_2465 + 2]));
+                        }
+                        else
+                        {
+                            _2481 = log(10000.0) / _1091;
+                        }
+                        _2502 = _2481;
+                    }
+                    _2505 = _2502;
+                }
+                float3 _2507 = _2433;
+                _2507.y = pow(10.0, _2505);
+                float _2508 = _2352.z;
+                float _2512 = log((_2508 <= 0.0) ? _2359 : _2508) / _1091;
+                float _2579;
+                if (_2512 <= _2364)
+                {
+                    _2579 = log(9.9999997473787516355514526367188e-05) / _1091;
+                }
+                else
+                {
+                    float _2519 = log(0.180000007152557373046875) / _1091;
+                    float _2576;
+                    if ((_2512 > _2364) && (_2512 < _2519))
+                    {
+                        float _2559 = (3.0 * (_2512 - _2364)) / (_2519 - _2364);
+                        int _2560 = int(_2559);
+                        float _2562 = _2559 - float(_2560);
+                        _2576 = dot(float3(_2562 * _2562, _2562, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2560], _499[_2560 + 1], _499[_2560 + 2]));
+                    }
+                    else
+                    {
+                        float _2527 = log(_2357) / _1091;
+                        float _2555;
+                        if ((_2512 >= _2519) && (_2512 < _2527))
+                        {
+                            float _2538 = (3.0 * (_2512 - _2519)) / (_2527 - _2519);
+                            int _2539 = int(_2538);
+                            float _2541 = _2538 - float(_2539);
+                            _2555 = dot(float3(_2541 * _2541, _2541, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2539], _500[_2539 + 1], _500[_2539 + 2]));
+                        }
+                        else
+                        {
+                            _2555 = log(10000.0) / _1091;
+                        }
+                        _2576 = _2555;
+                    }
+                    _2579 = _2576;
+                }
+                float3 _2581 = _2507;
+                _2581.z = pow(10.0, _2579);
+                float3 _2583 = (_2581 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375));
+                float _2585 = 0.17999999225139617919921875 * pow(2.0, -12.0);
+                float _2589 = log((_2585 <= 0.0) ? _2359 : _2585) / _1091;
+                float _2656;
+                if (_2589 <= _2364)
+                {
+                    _2656 = log(9.9999997473787516355514526367188e-05) / _1091;
+                }
+                else
+                {
+                    float _2596 = log(0.180000007152557373046875) / _1091;
+                    float _2653;
+                    if ((_2589 > _2364) && (_2589 < _2596))
+                    {
+                        float _2636 = (3.0 * (_2589 - _2364)) / (_2596 - _2364);
+                        int _2637 = int(_2636);
+                        float _2639 = _2636 - float(_2637);
+                        _2653 = dot(float3(_2639 * _2639, _2639, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2637], _499[_2637 + 1], _499[_2637 + 2]));
+                    }
+                    else
+                    {
+                        float _2604 = log(_2357) / _1091;
+                        float _2632;
+                        if ((_2589 >= _2596) && (_2589 < _2604))
+                        {
+                            float _2615 = (3.0 * (_2589 - _2596)) / (_2604 - _2596);
+                            int _2616 = int(_2615);
+                            float _2618 = _2615 - float(_2616);
+                            _2632 = dot(float3(_2618 * _2618, _2618, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2616], _500[_2616 + 1], _500[_2616 + 2]));
+                        }
+                        else
+                        {
+                            _2632 = log(10000.0) / _1091;
+                        }
+                        _2653 = _2632;
+                    }
+                    _2656 = _2653;
+                }
+                float _2659 = log(0.180000007152557373046875) / _1091;
+                float _2713;
+                if (_2659 <= _2364)
+                {
+                    _2713 = log(9.9999997473787516355514526367188e-05) / _1091;
+                }
+                else
+                {
+                    float _2710;
+                    if ((_2659 > _2364) && (_2659 < _2659))
+                    {
+                        _2710 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(-0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875)).z;
+                    }
+                    else
+                    {
+                        float _2672 = log(_2357) / _1091;
+                        float _2700;
+                        if ((_2659 >= _2659) && (_2659 < _2672))
+                        {
+                            float _2683 = (3.0 * (_2659 - _2659)) / (_2672 - _2659);
+                            int _2684 = int(_2683);
+                            float _2686 = _2683 - float(_2684);
+                            _2700 = dot(float3(_2686 * _2686, _2686, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2684], _500[_2684 + 1], _500[_2684 + 2]));
+                        }
+                        else
+                        {
+                            _2700 = log(10000.0) / _1091;
+                        }
+                        _2710 = _2700;
+                    }
+                    _2713 = _2710;
+                }
+                float _2714 = pow(10.0, _2713);
+                float _2716 = 0.17999999225139617919921875 * pow(2.0, 10.0);
+                float _2720 = log((_2716 <= 0.0) ? _2359 : _2716) / _1091;
+                float _2785;
+                if (_2720 <= _2364)
+                {
+                    _2785 = log(9.9999997473787516355514526367188e-05) / _1091;
+                }
+                else
+                {
+                    float _2782;
+                    if ((_2720 > _2364) && (_2720 < _2659))
+                    {
+                        float _2765 = (3.0 * (_2720 - _2364)) / (_2659 - _2364);
+                        int _2766 = int(_2765);
+                        float _2768 = _2765 - float(_2766);
+                        _2782 = dot(float3(_2768 * _2768, _2768, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_2766], _499[_2766 + 1], _499[_2766 + 2]));
+                    }
+                    else
+                    {
+                        float _2733 = log(_2357) / _1091;
+                        float _2761;
+                        if ((_2720 >= _2659) && (_2720 < _2733))
+                        {
+                            float _2744 = (3.0 * (_2720 - _2659)) / (_2733 - _2659);
+                            int _2745 = int(_2744);
+                            float _2747 = _2744 - float(_2745);
+                            _2761 = dot(float3(_2747 * _2747, _2747, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_2745], _500[_2745 + 1], _500[_2745 + 2]));
+                        }
+                        else
+                        {
+                            _2761 = log(10000.0) / _1091;
+                        }
+                        _2782 = _2761;
+                    }
+                    _2785 = _2782;
+                }
+                float _2786 = pow(10.0, _2785);
+                float _2787 = _2583.x;
+                float _2791 = log((_2787 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2787) / _1091;
+                float _2792 = log(pow(10.0, _2656));
+                float _2793 = _2792 / _1091;
+                float _2870;
+                if (_2791 <= _2793)
+                {
+                    _2870 = (_2791 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1091) - ((3.0 * _2792) / _1091));
+                }
+                else
+                {
+                    float _2800 = log(_2714) / _1091;
+                    float _2862;
+                    if ((_2791 > _2793) && (_2791 < _2800))
+                    {
+                        float _2845 = (7.0 * (_2791 - _2793)) / (_2800 - _2793);
+                        int _2846 = int(_2845);
+                        float _2848 = _2845 - float(_2846);
+                        _2862 = dot(float3(_2848 * _2848, _2848, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_2846], _503[_2846 + 1], _503[_2846 + 2]));
+                    }
+                    else
+                    {
+                        float _2807 = log(_2786);
+                        float _2808 = _2807 / _1091;
+                        float _2841;
+                        if ((_2791 >= _2800) && (_2791 < _2808))
+                        {
+                            float _2824 = (7.0 * (_2791 - _2800)) / (_2808 - _2800);
+                            int _2825 = int(_2824);
+                            float _2827 = _2824 - float(_2825);
+                            _2841 = dot(float3(_2827 * _2827, _2827, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2825], _504[_2825 + 1], _504[_2825 + 2]));
+                        }
+                        else
+                        {
+                            _2841 = (_2791 * 0.0599999986588954925537109375) + ((log(1000.0) / _1091) - ((0.0599999986588954925537109375 * _2807) / _1091));
+                        }
+                        _2862 = _2841;
+                    }
+                    _2870 = _2862;
+                }
+                float3 _2872 = _523;
+                _2872.x = pow(10.0, _2870);
+                float _2873 = _2583.y;
+                float _2877 = log((_2873 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2873) / _1091;
+                float _2954;
+                if (_2877 <= _2793)
+                {
+                    _2954 = (_2877 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1091) - ((3.0 * _2792) / _1091));
+                }
+                else
+                {
+                    float _2884 = log(_2714) / _1091;
+                    float _2946;
+                    if ((_2877 > _2793) && (_2877 < _2884))
+                    {
+                        float _2929 = (7.0 * (_2877 - _2793)) / (_2884 - _2793);
+                        int _2930 = int(_2929);
+                        float _2932 = _2929 - float(_2930);
+                        _2946 = dot(float3(_2932 * _2932, _2932, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_2930], _503[_2930 + 1], _503[_2930 + 2]));
+                    }
+                    else
+                    {
+                        float _2891 = log(_2786);
+                        float _2892 = _2891 / _1091;
+                        float _2925;
+                        if ((_2877 >= _2884) && (_2877 < _2892))
+                        {
+                            float _2908 = (7.0 * (_2877 - _2884)) / (_2892 - _2884);
+                            int _2909 = int(_2908);
+                            float _2911 = _2908 - float(_2909);
+                            _2925 = dot(float3(_2911 * _2911, _2911, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2909], _504[_2909 + 1], _504[_2909 + 2]));
+                        }
+                        else
+                        {
+                            _2925 = (_2877 * 0.0599999986588954925537109375) + ((log(1000.0) / _1091) - ((0.0599999986588954925537109375 * _2891) / _1091));
+                        }
+                        _2946 = _2925;
+                    }
+                    _2954 = _2946;
+                }
+                float3 _2956 = _2872;
+                _2956.y = pow(10.0, _2954);
+                float _2957 = _2583.z;
+                float _2961 = log((_2957 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2957) / _1091;
+                float _3038;
+                if (_2961 <= _2793)
+                {
+                    _3038 = (_2961 * 3.0) + ((log(9.9999997473787516355514526367188e-05) / _1091) - ((3.0 * _2792) / _1091));
+                }
+                else
+                {
+                    float _2968 = log(_2714) / _1091;
+                    float _3030;
+                    if ((_2961 > _2793) && (_2961 < _2968))
+                    {
+                        float _3013 = (7.0 * (_2961 - _2793)) / (_2968 - _2793);
+                        int _3014 = int(_3013);
+                        float _3016 = _3013 - float(_3014);
+                        _3030 = dot(float3(_3016 * _3016, _3016, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_503[_3014], _503[_3014 + 1], _503[_3014 + 2]));
+                    }
+                    else
+                    {
+                        float _2975 = log(_2786);
+                        float _2976 = _2975 / _1091;
+                        float _3009;
+                        if ((_2961 >= _2968) && (_2961 < _2976))
+                        {
+                            float _2992 = (7.0 * (_2961 - _2968)) / (_2976 - _2968);
+                            int _2993 = int(_2992);
+                            float _2995 = _2992 - float(_2993);
+                            _3009 = dot(float3(_2995 * _2995, _2995, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_504[_2993], _504[_2993 + 1], _504[_2993 + 2]));
+                        }
+                        else
+                        {
+                            _3009 = (_2961 * 0.0599999986588954925537109375) + ((log(1000.0) / _1091) - ((0.0599999986588954925537109375 * _2975) / _1091));
+                        }
+                        _3030 = _3009;
+                    }
+                    _3038 = _3030;
+                }
+                float3 _3040 = _2956;
+                _3040.z = pow(10.0, _3038);
+                float3 _3044 = pow(((_3040 - float3(3.5073844628641381859779357910156e-05)) * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+                _3052 = pow((float3(0.8359375) + (float3(18.8515625) * _3044)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _3044))), float3(78.84375));
+            }
+            else
+            {
+                float3 _2201;
+                if ((_Globals.OutputDevice == 4u) || (_Globals.OutputDevice == 6u))
+                {
+                    float3 _1369 = (_932 * float3(1.5)) * (_572 * float3x3(float3(1.04981100559234619140625, 0.0, -9.74845024757087230682373046875e-05), float3(-0.49590301513671875, 1.37331306934356689453125, 0.09824003279209136962890625), float3(0.0, 0.0, 0.991252005100250244140625)));
+                    float _1370 = _1369.x;
+                    float _1371 = _1369.y;
+                    float _1373 = _1369.z;
+                    float _1376 = fast::max(fast::max(_1370, _1371), _1373);
+                    float _1381 = (fast::max(_1376, 1.0000000133514319600180897396058e-10) - fast::max(fast::min(fast::min(_1370, _1371), _1373), 1.0000000133514319600180897396058e-10)) / fast::max(_1376, 0.00999999977648258209228515625);
+                    float _1394 = ((_1373 + _1371) + _1370) + (1.75 * sqrt(((_1373 * (_1373 - _1371)) + (_1371 * (_1371 - _1370))) + (_1370 * (_1370 - _1373))));
+                    float _1395 = _1394 * 0.3333333432674407958984375;
+                    float _1396 = _1381 - 0.4000000059604644775390625;
+                    float _1401 = fast::max(1.0 - abs(_1396 * 2.5), 0.0);
+                    float _1409 = (1.0 + (float(int(sign(_1396 * 5.0))) * (1.0 - (_1401 * _1401)))) * 0.02500000037252902984619140625;
+                    float _1422;
+                    if (_1395 <= 0.053333334624767303466796875)
+                    {
+                        _1422 = _1409;
+                    }
+                    else
+                    {
+                        float _1421;
+                        if (_1395 >= 0.1599999964237213134765625)
+                        {
+                            _1421 = 0.0;
+                        }
+                        else
+                        {
+                            _1421 = _1409 * ((0.23999999463558197021484375 / _1394) - 0.5);
+                        }
+                        _1422 = _1421;
+                    }
+                    float3 _1425 = _1369 * float3(1.0 + _1422);
+                    float _1426 = _1425.x;
+                    float _1427 = _1425.y;
+                    float _1429 = _1425.z;
+                    float _1443;
+                    if ((_1426 == _1427) && (_1427 == _1429))
+                    {
+                        _1443 = 0.0;
+                    }
+                    else
+                    {
+                        _1443 = 57.2957763671875 * atan2(sqrt(3.0) * (_1427 - _1429), ((2.0 * _1426) - _1427) - _1429);
+                    }
+                    float _1448;
+                    if (_1443 < 0.0)
+                    {
+                        _1448 = _1443 + 360.0;
+                    }
+                    else
+                    {
+                        _1448 = _1443;
+                    }
+                    float _1449 = fast::clamp(_1448, 0.0, 360.0);
+                    float _1454;
+                    if (_1449 > 180.0)
+                    {
+                        _1454 = _1449 - 360.0;
+                    }
+                    else
+                    {
+                        _1454 = _1449;
+                    }
+                    float _1504;
+                    if ((_1454 > (-67.5)) && (_1454 < 67.5))
+                    {
+                        float _1461 = (_1454 - (-67.5)) * 0.0296296291053295135498046875;
+                        int _1462 = int(_1461);
+                        float _1464 = _1461 - float(_1462);
+                        float _1465 = _1464 * _1464;
+                        float _1466 = _1465 * _1464;
+                        float _1503;
+                        if (_1462 == 3)
+                        {
+                            _1503 = (((_1466 * (-0.16666667163372039794921875)) + (_1465 * 0.5)) + (_1464 * (-0.5))) + 0.16666667163372039794921875;
+                        }
+                        else
+                        {
+                            float _1496;
+                            if (_1462 == 2)
+                            {
+                                _1496 = ((_1466 * 0.5) + (_1465 * (-1.0))) + 0.666666686534881591796875;
+                            }
+                            else
+                            {
+                                float _1491;
+                                if (_1462 == 1)
+                                {
+                                    _1491 = (((_1466 * (-0.5)) + (_1465 * 0.5)) + (_1464 * 0.5)) + 0.16666667163372039794921875;
+                                }
+                                else
+                                {
+                                    float _1484;
+                                    if (_1462 == 0)
+                                    {
+                                        _1484 = _1466 * 0.16666667163372039794921875;
+                                    }
+                                    else
+                                    {
+                                        _1484 = 0.0;
+                                    }
+                                    _1491 = _1484;
+                                }
+                                _1496 = _1491;
+                            }
+                            _1503 = _1496;
+                        }
+                        _1504 = _1503;
+                    }
+                    else
+                    {
+                        _1504 = 0.0;
+                    }
+                    float3 _1511 = _1425;
+                    _1511.x = _1426 + ((((_1504 * 1.5) * _1381) * (0.02999999932944774627685546875 - _1426)) * 0.180000007152557373046875);
+                    float3 _1514 = fast::clamp(fast::clamp(_1511, float3(0.0), float3(65535.0)) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375)), float3(0.0), float3(65535.0));
+                    float3 _1517 = mix(float3(dot(_1514, float3(0.272228717803955078125, 0.674081742763519287109375, 0.053689517080783843994140625))), _1514, float3(0.959999978542327880859375));
+                    float _1518 = _1517.x;
+                    float _1522 = 0.17999999225139617919921875 * exp2(18.0);
+                    float _1524 = exp2(-14.0);
+                    float _1527 = log((_1518 <= 0.0) ? _1524 : _1518) / _1091;
+                    float _1529 = log(0.17999999225139617919921875 * exp2(-15.0)) / _1091;
+                    float _1596;
+                    if (_1527 <= _1529)
+                    {
+                        _1596 = log(9.9999997473787516355514526367188e-05) / _1091;
+                    }
+                    else
+                    {
+                        float _1536 = log(0.180000007152557373046875) / _1091;
+                        float _1593;
+                        if ((_1527 > _1529) && (_1527 < _1536))
+                        {
+                            float _1576 = (3.0 * (_1527 - _1529)) / (_1536 - _1529);
+                            int _1577 = int(_1576);
+                            float _1579 = _1576 - float(_1577);
+                            _1593 = dot(float3(_1579 * _1579, _1579, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1577], _499[_1577 + 1], _499[_1577 + 2]));
+                        }
+                        else
+                        {
+                            float _1544 = log(_1522) / _1091;
+                            float _1572;
+                            if ((_1527 >= _1536) && (_1527 < _1544))
+                            {
+                                float _1555 = (3.0 * (_1527 - _1536)) / (_1544 - _1536);
+                                int _1556 = int(_1555);
+                                float _1558 = _1555 - float(_1556);
+                                _1572 = dot(float3(_1558 * _1558, _1558, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1556], _500[_1556 + 1], _500[_1556 + 2]));
+                            }
+                            else
+                            {
+                                _1572 = log(10000.0) / _1091;
+                            }
+                            _1593 = _1572;
+                        }
+                        _1596 = _1593;
+                    }
+                    float3 _1598 = _523;
+                    _1598.x = pow(10.0, _1596);
+                    float _1599 = _1517.y;
+                    float _1603 = log((_1599 <= 0.0) ? _1524 : _1599) / _1091;
+                    float _1670;
+                    if (_1603 <= _1529)
+                    {
+                        _1670 = log(9.9999997473787516355514526367188e-05) / _1091;
+                    }
+                    else
+                    {
+                        float _1610 = log(0.180000007152557373046875) / _1091;
+                        float _1667;
+                        if ((_1603 > _1529) && (_1603 < _1610))
+                        {
+                            float _1650 = (3.0 * (_1603 - _1529)) / (_1610 - _1529);
+                            int _1651 = int(_1650);
+                            float _1653 = _1650 - float(_1651);
+                            _1667 = dot(float3(_1653 * _1653, _1653, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1651], _499[_1651 + 1], _499[_1651 + 2]));
+                        }
+                        else
+                        {
+                            float _1618 = log(_1522) / _1091;
+                            float _1646;
+                            if ((_1603 >= _1610) && (_1603 < _1618))
+                            {
+                                float _1629 = (3.0 * (_1603 - _1610)) / (_1618 - _1610);
+                                int _1630 = int(_1629);
+                                float _1632 = _1629 - float(_1630);
+                                _1646 = dot(float3(_1632 * _1632, _1632, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1630], _500[_1630 + 1], _500[_1630 + 2]));
+                            }
+                            else
+                            {
+                                _1646 = log(10000.0) / _1091;
+                            }
+                            _1667 = _1646;
+                        }
+                        _1670 = _1667;
+                    }
+                    float3 _1672 = _1598;
+                    _1672.y = pow(10.0, _1670);
+                    float _1673 = _1517.z;
+                    float _1677 = log((_1673 <= 0.0) ? _1524 : _1673) / _1091;
+                    float _1744;
+                    if (_1677 <= _1529)
+                    {
+                        _1744 = log(9.9999997473787516355514526367188e-05) / _1091;
+                    }
+                    else
+                    {
+                        float _1684 = log(0.180000007152557373046875) / _1091;
+                        float _1741;
+                        if ((_1677 > _1529) && (_1677 < _1684))
+                        {
+                            float _1724 = (3.0 * (_1677 - _1529)) / (_1684 - _1529);
+                            int _1725 = int(_1724);
+                            float _1727 = _1724 - float(_1725);
+                            _1741 = dot(float3(_1727 * _1727, _1727, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1725], _499[_1725 + 1], _499[_1725 + 2]));
+                        }
+                        else
+                        {
+                            float _1692 = log(_1522) / _1091;
+                            float _1720;
+                            if ((_1677 >= _1684) && (_1677 < _1692))
+                            {
+                                float _1703 = (3.0 * (_1677 - _1684)) / (_1692 - _1684);
+                                int _1704 = int(_1703);
+                                float _1706 = _1703 - float(_1704);
+                                _1720 = dot(float3(_1706 * _1706, _1706, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1704], _500[_1704 + 1], _500[_1704 + 2]));
+                            }
+                            else
+                            {
+                                _1720 = log(10000.0) / _1091;
+                            }
+                            _1741 = _1720;
+                        }
+                        _1744 = _1741;
+                    }
+                    float3 _1746 = _1672;
+                    _1746.z = pow(10.0, _1744);
+                    float3 _1748 = (_1746 * float3x3(float3(0.695452213287353515625, 0.140678703784942626953125, 0.16386906802654266357421875), float3(0.0447945632040500640869140625, 0.859671115875244140625, 0.095534317195415496826171875), float3(-0.0055258828215301036834716796875, 0.0040252101607620716094970703125, 1.00150072574615478515625))) * float3x3(float3(1.45143926143646240234375, -0.236510753631591796875, -0.214928567409515380859375), float3(-0.07655377686023712158203125, 1.1762297153472900390625, -0.0996759235858917236328125), float3(0.0083161480724811553955078125, -0.0060324496589601039886474609375, 0.99771630764007568359375));
+                    float _1750 = 0.17999999225139617919921875 * pow(2.0, -12.0);
+                    float _1754 = log((_1750 <= 0.0) ? _1524 : _1750) / _1091;
+                    float _1821;
+                    if (_1754 <= _1529)
+                    {
+                        _1821 = log(9.9999997473787516355514526367188e-05) / _1091;
+                    }
+                    else
+                    {
+                        float _1761 = log(0.180000007152557373046875) / _1091;
+                        float _1818;
+                        if ((_1754 > _1529) && (_1754 < _1761))
+                        {
+                            float _1801 = (3.0 * (_1754 - _1529)) / (_1761 - _1529);
+                            int _1802 = int(_1801);
+                            float _1804 = _1801 - float(_1802);
+                            _1818 = dot(float3(_1804 * _1804, _1804, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1802], _499[_1802 + 1], _499[_1802 + 2]));
+                        }
+                        else
+                        {
+                            float _1769 = log(_1522) / _1091;
+                            float _1797;
+                            if ((_1754 >= _1761) && (_1754 < _1769))
+                            {
+                                float _1780 = (3.0 * (_1754 - _1761)) / (_1769 - _1761);
+                                int _1781 = int(_1780);
+                                float _1783 = _1780 - float(_1781);
+                                _1797 = dot(float3(_1783 * _1783, _1783, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1781], _500[_1781 + 1], _500[_1781 + 2]));
+                            }
+                            else
+                            {
+                                _1797 = log(10000.0) / _1091;
+                            }
+                            _1818 = _1797;
+                        }
+                        _1821 = _1818;
+                    }
+                    float _1824 = log(0.180000007152557373046875) / _1091;
+                    float _1878;
+                    if (_1824 <= _1529)
+                    {
+                        _1878 = log(9.9999997473787516355514526367188e-05) / _1091;
+                    }
+                    else
+                    {
+                        float _1875;
+                        if ((_1824 > _1529) && (_1824 < _1824))
+                        {
+                            _1875 = (float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(-0.485249996185302734375, 1.84773242473602294921875, 1.84773242473602294921875)).z;
+                        }
+                        else
+                        {
+                            float _1837 = log(_1522) / _1091;
+                            float _1865;
+                            if ((_1824 >= _1824) && (_1824 < _1837))
+                            {
+                                float _1848 = (3.0 * (_1824 - _1824)) / (_1837 - _1824);
+                                int _1849 = int(_1848);
+                                float _1851 = _1848 - float(_1849);
+                                _1865 = dot(float3(_1851 * _1851, _1851, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1849], _500[_1849 + 1], _500[_1849 + 2]));
+                            }
+                            else
+                            {
+                                _1865 = log(10000.0) / _1091;
+                            }
+                            _1875 = _1865;
+                        }
+                        _1878 = _1875;
+                    }
+                    float _1879 = pow(10.0, _1878);
+                    float _1881 = 0.17999999225139617919921875 * pow(2.0, 11.0);
+                    float _1885 = log((_1881 <= 0.0) ? _1524 : _1881) / _1091;
+                    float _1950;
+                    if (_1885 <= _1529)
+                    {
+                        _1950 = log(9.9999997473787516355514526367188e-05) / _1091;
+                    }
+                    else
+                    {
+                        float _1947;
+                        if ((_1885 > _1529) && (_1885 < _1824))
+                        {
+                            float _1930 = (3.0 * (_1885 - _1529)) / (_1824 - _1529);
+                            int _1931 = int(_1930);
+                            float _1933 = _1930 - float(_1931);
+                            _1947 = dot(float3(_1933 * _1933, _1933, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_499[_1931], _499[_1931 + 1], _499[_1931 + 2]));
+                        }
+                        else
+                        {
+                            float _1898 = log(_1522) / _1091;
+                            float _1926;
+                            if ((_1885 >= _1824) && (_1885 < _1898))
+                            {
+                                float _1909 = (3.0 * (_1885 - _1824)) / (_1898 - _1824);
+                                int _1910 = int(_1909);
+                                float _1912 = _1909 - float(_1910);
+                                _1926 = dot(float3(_1912 * _1912, _1912, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_500[_1910], _500[_1910 + 1], _500[_1910 + 2]));
+                            }
+                            else
+                            {
+                                _1926 = log(10000.0) / _1091;
+                            }
+                            _1947 = _1926;
+                        }
+                        _1950 = _1947;
+                    }
+                    float _1951 = pow(10.0, _1950);
+                    float _1952 = _1748.x;
+                    float _1956 = log((_1952 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _1952) / _1091;
+                    float _1958 = log(pow(10.0, _1821)) / _1091;
+                    float _2030;
+                    if (_1956 <= _1958)
+                    {
+                        _2030 = log(0.004999999888241291046142578125) / _1091;
+                    }
+                    else
+                    {
+                        float _1965 = log(_1879) / _1091;
+                        float _2027;
+                        if ((_1956 > _1958) && (_1956 < _1965))
+                        {
+                            float _2010 = (7.0 * (_1956 - _1958)) / (_1965 - _1958);
+                            int _2011 = int(_2010);
+                            float _2013 = _2010 - float(_2011);
+                            _2027 = dot(float3(_2013 * _2013, _2013, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2011], _506[_2011 + 1], _506[_2011 + 2]));
+                        }
+                        else
+                        {
+                            float _1972 = log(_1951);
+                            float _1973 = _1972 / _1091;
+                            float _2006;
+                            if ((_1956 >= _1965) && (_1956 < _1973))
+                            {
+                                float _1989 = (7.0 * (_1956 - _1965)) / (_1973 - _1965);
+                                int _1990 = int(_1989);
+                                float _1992 = _1989 - float(_1990);
+                                _2006 = dot(float3(_1992 * _1992, _1992, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_1990], _507[_1990 + 1], _507[_1990 + 2]));
+                            }
+                            else
+                            {
+                                _2006 = (_1956 * 0.119999997317790985107421875) + ((log(2000.0) / _1091) - ((0.119999997317790985107421875 * _1972) / _1091));
+                            }
+                            _2027 = _2006;
+                        }
+                        _2030 = _2027;
+                    }
+                    float3 _2032 = _523;
+                    _2032.x = pow(10.0, _2030);
+                    float _2033 = _1748.y;
+                    float _2037 = log((_2033 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2033) / _1091;
+                    float _2109;
+                    if (_2037 <= _1958)
+                    {
+                        _2109 = log(0.004999999888241291046142578125) / _1091;
+                    }
+                    else
+                    {
+                        float _2044 = log(_1879) / _1091;
+                        float _2106;
+                        if ((_2037 > _1958) && (_2037 < _2044))
+                        {
+                            float _2089 = (7.0 * (_2037 - _1958)) / (_2044 - _1958);
+                            int _2090 = int(_2089);
+                            float _2092 = _2089 - float(_2090);
+                            _2106 = dot(float3(_2092 * _2092, _2092, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2090], _506[_2090 + 1], _506[_2090 + 2]));
+                        }
+                        else
+                        {
+                            float _2051 = log(_1951);
+                            float _2052 = _2051 / _1091;
+                            float _2085;
+                            if ((_2037 >= _2044) && (_2037 < _2052))
+                            {
+                                float _2068 = (7.0 * (_2037 - _2044)) / (_2052 - _2044);
+                                int _2069 = int(_2068);
+                                float _2071 = _2068 - float(_2069);
+                                _2085 = dot(float3(_2071 * _2071, _2071, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_2069], _507[_2069 + 1], _507[_2069 + 2]));
+                            }
+                            else
+                            {
+                                _2085 = (_2037 * 0.119999997317790985107421875) + ((log(2000.0) / _1091) - ((0.119999997317790985107421875 * _2051) / _1091));
+                            }
+                            _2106 = _2085;
+                        }
+                        _2109 = _2106;
+                    }
+                    float3 _2111 = _2032;
+                    _2111.y = pow(10.0, _2109);
+                    float _2112 = _1748.z;
+                    float _2116 = log((_2112 <= 0.0) ? 9.9999997473787516355514526367188e-05 : _2112) / _1091;
+                    float _2188;
+                    if (_2116 <= _1958)
+                    {
+                        _2188 = log(0.004999999888241291046142578125) / _1091;
+                    }
+                    else
+                    {
+                        float _2123 = log(_1879) / _1091;
+                        float _2185;
+                        if ((_2116 > _1958) && (_2116 < _2123))
+                        {
+                            float _2168 = (7.0 * (_2116 - _1958)) / (_2123 - _1958);
+                            int _2169 = int(_2168);
+                            float _2171 = _2168 - float(_2169);
+                            _2185 = dot(float3(_2171 * _2171, _2171, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_506[_2169], _506[_2169 + 1], _506[_2169 + 2]));
+                        }
+                        else
+                        {
+                            float _2130 = log(_1951);
+                            float _2131 = _2130 / _1091;
+                            float _2164;
+                            if ((_2116 >= _2123) && (_2116 < _2131))
+                            {
+                                float _2147 = (7.0 * (_2116 - _2123)) / (_2131 - _2123);
+                                int _2148 = int(_2147);
+                                float _2150 = _2147 - float(_2148);
+                                _2164 = dot(float3(_2150 * _2150, _2150, 1.0), float3x3(float3(0.5, -1.0, 0.5), float3(-1.0, 1.0, 0.5), float3(0.5, 0.0, 0.0)) * float3(_507[_2148], _507[_2148 + 1], _507[_2148 + 2]));
+                            }
+                            else
+                            {
+                                _2164 = (_2116 * 0.119999997317790985107421875) + ((log(2000.0) / _1091) - ((0.119999997317790985107421875 * _2130) / _1091));
+                            }
+                            _2185 = _2164;
+                        }
+                        _2188 = _2185;
+                    }
+                    float3 _2190 = _2111;
+                    _2190.z = pow(10.0, _2188);
+                    float3 _2193 = pow((_2190 * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+                    _2201 = pow((float3(0.8359375) + (float3(18.8515625) * _2193)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _2193))), float3(78.84375));
+                }
+                else
+                {
+                    float3 _1366;
+                    if (_Globals.OutputDevice == 7u)
+                    {
+                        float3 _1358 = pow(((_932 * _573) * _602) * float3(9.9999997473787516355514526367188e-05), float3(0.1593017578125));
+                        _1366 = pow((float3(0.8359375) + (float3(18.8515625) * _1358)) * (float3(1.0) / (float3(1.0) + (float3(18.6875) * _1358))), float3(78.84375));
+                    }
+                    else
+                    {
+                        _1366 = pow((_1324 * _573) * _602, float3(_Globals.InverseGamma.z));
+                    }
+                    _2201 = _1366;
+                }
+                _3052 = _2201;
+            }
+            _3062 = _3052;
+        }
+        _3103 = _3062;
+    }
+    float3 _3104 = _3103 * float3(0.95238101482391357421875);
+    float4 _3106 = float4(_3104.x, _3104.y, _3104.z, float4(0.0).w);
+    _3106.w = 0.0;
+    out.out_var_SV_Target0 = _3106;
+    return out;
+}
+

+ 356 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/phi-variable-declaration.asm.frag

@@ -0,0 +1,356 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_ClipToWorld;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_908;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_924;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_940;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_956;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_972;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_1020;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_1036;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_1052;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1068;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1724;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1740;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1756;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2076;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2148;
+    float PrePadding_View_2152;
+    float PrePadding_View_2156;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2228;
+    float PrePadding_View_2232;
+    float PrePadding_View_2236;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2268;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2412;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    float View_AtmosphericFogSunDiscHalfApexAngleRadian;
+    float PrePadding_View_2492;
+    float4 View_AtmosphericFogSunDiscLuminance;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    uint PrePadding_View_2520;
+    uint PrePadding_View_2524;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2584;
+    float PrePadding_View_2588;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2744;
+    float PrePadding_View_2748;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float PrePadding_View_2908;
+    int2 View_CursorPosition;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    float PrePadding_View_2924;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2940;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2956;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2972;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2988;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_3004;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_PrimitiveDither
+{
+    float PrimitiveDither_LODFactor;
+};
+
+struct type_PrimitiveFade
+{
+    float2 PrimitiveFade_FadeTimeScaleBias;
+};
+
+struct type_Material
+{
+    float4 Material_VectorExpressions[9];
+    float4 Material_ScalarExpressions[3];
+};
+
+constant float _98 = {};
+constant float _103 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+    float gl_FragDepth [[depth(less)]];
+};
+
+struct main0_in
+{
+    float4 in_var_TEXCOORD6 [[user(locn0)]];
+    float4 in_var_TEXCOORD7 [[user(locn1)]];
+    float4 in_var_TEXCOORD10_centroid [[user(locn2)]];
+    float4 in_var_TEXCOORD11_centroid [[user(locn3)]];
+    float4 in_var_TEXCOORD0_0 [[user(locn4)]];
+};
+
+static inline __attribute__((always_inline))
+void _353()
+{
+    discard_fragment();
+}
+
+fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_PrimitiveDither& PrimitiveDither [[buffer(1)]], constant type_PrimitiveFade& PrimitiveFade [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture2d<float> Material_Texture2D_0 [[texture(0)]], texture2d<float> Material_Texture2D_3 [[texture(1)]], sampler Material_Texture2D_0Sampler [[sampler(0)]], sampler Material_Texture2D_3Sampler [[sampler(1)]], float4 gl_FragCoord [[position]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 1> in_var_TEXCOORD0 = {};
+    in_var_TEXCOORD0[0] = in.in_var_TEXCOORD0_0;
+    float2 _135 = gl_FragCoord.xy - View.View_ViewRectMin.xy;
+    float4 _140 = float4(_103, _103, gl_FragCoord.z, 1.0) * float4(gl_FragCoord.w);
+    float4 _144 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0);
+    float3 _148 = _144.xyz / float3(_144.w);
+    float3 _149 = _148 - float3(View.View_PreViewTranslation);
+    float3 _151 = normalize(-_148);
+    float3 _152 = _151 * float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz);
+    float _170 = mix(Material.Material_ScalarExpressions[0].y, Material.Material_ScalarExpressions[0].z, fast::min(fast::max(abs(dot(_151, in.in_var_TEXCOORD11_centroid.xyz)), 0.0), 1.0));
+    float _172 = 1.0 / _170;
+    float2 _174 = (float2(Material.Material_ScalarExpressions[0].x) * ((_152.xy * float2(-1.0)) / float2(_152.z))) * float2(_172);
+    float _180_copy;
+    float2 _183;
+    _183 = float2(0.0);
+    float _188;
+    float _211;
+    float2 _212;
+    float _180 = 1.0;
+    int _185 = 0;
+    float _187 = 1.0;
+    float _189 = 1.0;
+    for (;;)
+    {
+        if (float(_185) < (floor(_170) + 2.0))
+        {
+            _188 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _183), gradient2d(dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)), dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)))).y;
+            if (_180 < _188)
+            {
+                float _201 = _188 - _180;
+                float _203 = _201 / ((_189 - _187) + _201);
+                _211 = (_189 * _203) + (_180 * (1.0 - _203));
+                _212 = _183 - (float2(_203) * _174);
+                break;
+            }
+            _180_copy = _180;
+            _180 -= _172;
+            _183 += _174;
+            _185++;
+            _187 = _188;
+            _189 = _180_copy;
+            continue;
+        }
+        else
+        {
+            _211 = _98;
+            _212 = _183;
+            break;
+        }
+    }
+    float4 _218 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _212.xy), bias(View.View_MaterialTextureMipBias));
+    float2 _229 = _135 + float2(View.View_TemporalAAParams.x);
+    float _237 = float((uint(_229.x) + (2u * uint(_229.y))) % 5u);
+    float2 _238 = _135 * float2(0.015625);
+    float4 _242 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias));
+    float4 _254 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias));
+    float3 _272 = float3(_212, (1.0 - _211) * Material.Material_ScalarExpressions[0].x);
+    float2 _275 = dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y));
+    float2 _276 = abs(_275);
+    float3 _279 = dfdx(_149);
+    float2 _283 = dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y));
+    float2 _284 = abs(_283);
+    float3 _287 = dfdy(_149);
+    if (PrimitiveDither.PrimitiveDither_LODFactor != 0.0)
+    {
+        if (abs(PrimitiveDither.PrimitiveDither_LODFactor) > 0.001000000047497451305389404296875)
+        {
+            float _317 = fract(cos(dot(floor(gl_FragCoord.xy), float2(347.834503173828125, 3343.28369140625))) * 1000.0);
+            if ((float((PrimitiveDither.PrimitiveDither_LODFactor < 0.0) ? ((PrimitiveDither.PrimitiveDither_LODFactor + 1.0) > _317) : (PrimitiveDither.PrimitiveDither_LODFactor < _317)) - 0.001000000047497451305389404296875) < 0.0)
+            {
+                _353();
+            }
+        }
+    }
+    if ((((_218.z + ((fast::min(fast::max(1.0 - (_218.x * Material.Material_ScalarExpressions[2].y), 0.0), 1.0) + ((_237 + (_242.x * Material.Material_ScalarExpressions[2].z)) * 0.16666667163372039794921875)) + (-0.5))) * ((fast::clamp((View.View_RealTime * PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.x) + PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.y, 0.0, 1.0) + ((_237 + _254.x) * 0.16666667163372039794921875)) + (-0.5))) - 0.33329999446868896484375) < 0.0)
+    {
+        _353();
+    }
+    float2 _351 = ((((in.in_var_TEXCOORD6.xy / float2(in.in_var_TEXCOORD6.w)) - View.View_TemporalAAJitter.xy) - ((in.in_var_TEXCOORD7.xy / float2(in.in_var_TEXCOORD7.w)) - View.View_TemporalAAJitter.zw)) * float2(0.2495000064373016357421875)) + float2(0.49999237060546875);
+    out.gl_FragDepth = fast::min(_140.z / (_140.w + (sqrt(dot(_272, _272)) / (fast::max(sqrt(dot(_276, _276)) / sqrt(dot(_279, _279)), sqrt(dot(_284, _284)) / sqrt(dot(_287, _287))) / abs(dot(float3x3(View.View_ViewToTranslatedWorld[0].xyz, View.View_ViewToTranslatedWorld[1].xyz, View.View_ViewToTranslatedWorld[2].xyz) * float3(0.0, 0.0, 1.0), _151))))), gl_FragCoord.z);
+    out.out_var_SV_Target0 = float4(_351.x, _351.y, float2(0.0).x, float2(0.0).y);
+    return out;
+}
+

+ 503 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/sample-mask-not-array.asm.frag

@@ -0,0 +1,503 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_844;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_860;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_876;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_892;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_908;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_956;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_972;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_988;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1004;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1660;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1676;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1692;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2012;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2084;
+    float PrePadding_View_2088;
+    float PrePadding_View_2092;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2164;
+    float PrePadding_View_2168;
+    float PrePadding_View_2172;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2204;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2348;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2488;
+    float PrePadding_View_2492;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2648;
+    float PrePadding_View_2652;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2828;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2844;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2860;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2876;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_2892;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_StructuredBuffer_v4float
+{
+    float4 _m0[1];
+};
+
+struct type_TranslucentBasePass
+{
+    uint TranslucentBasePass_Shared_Forward_NumLocalLights;
+    uint TranslucentBasePass_Shared_Forward_NumReflectionCaptures;
+    uint TranslucentBasePass_Shared_Forward_HasDirectionalLight;
+    uint TranslucentBasePass_Shared_Forward_NumGridCells;
+    packed_int3 TranslucentBasePass_Shared_Forward_CulledGridSize;
+    uint TranslucentBasePass_Shared_Forward_MaxCulledLightsPerCell;
+    uint TranslucentBasePass_Shared_Forward_LightGridPixelSizeShift;
+    uint PrePadding_TranslucentBasePass_Shared_Forward_36;
+    uint PrePadding_TranslucentBasePass_Shared_Forward_40;
+    uint PrePadding_TranslucentBasePass_Shared_Forward_44;
+    packed_float3 TranslucentBasePass_Shared_Forward_LightGridZParams;
+    float PrePadding_TranslucentBasePass_Shared_Forward_60;
+    packed_float3 TranslucentBasePass_Shared_Forward_DirectionalLightDirection;
+    float PrePadding_TranslucentBasePass_Shared_Forward_76;
+    packed_float3 TranslucentBasePass_Shared_Forward_DirectionalLightColor;
+    float TranslucentBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity;
+    uint TranslucentBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask;
+    uint PrePadding_TranslucentBasePass_Shared_Forward_100;
+    float2 TranslucentBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD;
+    uint TranslucentBasePass_Shared_Forward_NumDirectionalLightCascades;
+    uint PrePadding_TranslucentBasePass_Shared_Forward_116;
+    uint PrePadding_TranslucentBasePass_Shared_Forward_120;
+    uint PrePadding_TranslucentBasePass_Shared_Forward_124;
+    float4 TranslucentBasePass_Shared_Forward_CascadeEndDepths;
+    float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix[4];
+    float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapMinMax[4];
+    float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize;
+    float TranslucentBasePass_Shared_Forward_DirectionalLightDepthBias;
+    uint TranslucentBasePass_Shared_Forward_DirectionalLightUseStaticShadowing;
+    uint PrePadding_TranslucentBasePass_Shared_Forward_488;
+    uint PrePadding_TranslucentBasePass_Shared_Forward_492;
+    float4 TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize;
+    float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_576;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_580;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_584;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_588;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_592;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_596;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_600;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_604;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_608;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_612;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_616;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_620;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_624;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_628;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_632;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_636;
+    uint TranslucentBasePass_Shared_ForwardISR_NumLocalLights;
+    uint TranslucentBasePass_Shared_ForwardISR_NumReflectionCaptures;
+    uint TranslucentBasePass_Shared_ForwardISR_HasDirectionalLight;
+    uint TranslucentBasePass_Shared_ForwardISR_NumGridCells;
+    packed_int3 TranslucentBasePass_Shared_ForwardISR_CulledGridSize;
+    uint TranslucentBasePass_Shared_ForwardISR_MaxCulledLightsPerCell;
+    uint TranslucentBasePass_Shared_ForwardISR_LightGridPixelSizeShift;
+    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_676;
+    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_680;
+    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_684;
+    packed_float3 TranslucentBasePass_Shared_ForwardISR_LightGridZParams;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_700;
+    packed_float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDirection;
+    float PrePadding_TranslucentBasePass_Shared_ForwardISR_716;
+    packed_float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightColor;
+    float TranslucentBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity;
+    uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask;
+    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_740;
+    float2 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD;
+    uint TranslucentBasePass_Shared_ForwardISR_NumDirectionalLightCascades;
+    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_756;
+    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_760;
+    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_764;
+    float4 TranslucentBasePass_Shared_ForwardISR_CascadeEndDepths;
+    float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix[4];
+    float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax[4];
+    float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize;
+    float TranslucentBasePass_Shared_ForwardISR_DirectionalLightDepthBias;
+    uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing;
+    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_1128;
+    uint PrePadding_TranslucentBasePass_Shared_ForwardISR_1132;
+    float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize;
+    float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1216;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1220;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1224;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1228;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1232;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1236;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1240;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1244;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1248;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1252;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1256;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1260;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1264;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1268;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1272;
+    float PrePadding_TranslucentBasePass_Shared_Reflection_1276;
+    float4 TranslucentBasePass_Shared_Reflection_SkyLightParameters;
+    float TranslucentBasePass_Shared_Reflection_SkyLightCubemapBrightness;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1300;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1304;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1308;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1312;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1316;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1320;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1324;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1328;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1332;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1336;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1340;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1344;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1348;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1352;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1356;
+    float4 TranslucentBasePass_Shared_PlanarReflection_ReflectionPlane;
+    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionOrigin;
+    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionXAxis;
+    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionYAxis;
+    float3x4 TranslucentBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix;
+    packed_float3 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1484;
+    float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters2;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1496;
+    float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1500;
+    float4x4 TranslucentBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV[2];
+    float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias[2];
+    float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound;
+    uint TranslucentBasePass_Shared_PlanarReflection_bIsStereo;
+    float PrePadding_TranslucentBasePass_Shared_Fog_1676;
+    float PrePadding_TranslucentBasePass_Shared_Fog_1680;
+    float PrePadding_TranslucentBasePass_Shared_Fog_1684;
+    float PrePadding_TranslucentBasePass_Shared_Fog_1688;
+    float PrePadding_TranslucentBasePass_Shared_Fog_1692;
+    float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters;
+    float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters2;
+    float4 TranslucentBasePass_Shared_Fog_ExponentialFogColorParameter;
+    float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters3;
+    float4 TranslucentBasePass_Shared_Fog_InscatteringLightDirection;
+    float4 TranslucentBasePass_Shared_Fog_DirectionalInscatteringColor;
+    float2 TranslucentBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation;
+    float PrePadding_TranslucentBasePass_Shared_Fog_1800;
+    float PrePadding_TranslucentBasePass_Shared_Fog_1804;
+    packed_float3 TranslucentBasePass_Shared_Fog_FogInscatteringTextureParameters;
+    float TranslucentBasePass_Shared_Fog_ApplyVolumetricFog;
+    float PrePadding_TranslucentBasePass_1824;
+    float PrePadding_TranslucentBasePass_1828;
+    float PrePadding_TranslucentBasePass_1832;
+    float PrePadding_TranslucentBasePass_1836;
+    float PrePadding_TranslucentBasePass_1840;
+    float PrePadding_TranslucentBasePass_1844;
+    float PrePadding_TranslucentBasePass_1848;
+    float PrePadding_TranslucentBasePass_1852;
+    float PrePadding_TranslucentBasePass_1856;
+    float PrePadding_TranslucentBasePass_1860;
+    float PrePadding_TranslucentBasePass_1864;
+    float PrePadding_TranslucentBasePass_1868;
+    float PrePadding_TranslucentBasePass_1872;
+    float PrePadding_TranslucentBasePass_1876;
+    float PrePadding_TranslucentBasePass_1880;
+    float PrePadding_TranslucentBasePass_1884;
+    float PrePadding_TranslucentBasePass_1888;
+    float PrePadding_TranslucentBasePass_1892;
+    float PrePadding_TranslucentBasePass_1896;
+    float PrePadding_TranslucentBasePass_1900;
+    float PrePadding_TranslucentBasePass_1904;
+    float PrePadding_TranslucentBasePass_1908;
+    float PrePadding_TranslucentBasePass_1912;
+    float PrePadding_TranslucentBasePass_1916;
+    float PrePadding_TranslucentBasePass_1920;
+    float PrePadding_TranslucentBasePass_1924;
+    float PrePadding_TranslucentBasePass_1928;
+    float PrePadding_TranslucentBasePass_1932;
+    float PrePadding_TranslucentBasePass_1936;
+    float PrePadding_TranslucentBasePass_1940;
+    float PrePadding_TranslucentBasePass_1944;
+    float PrePadding_TranslucentBasePass_1948;
+    float PrePadding_TranslucentBasePass_1952;
+    float PrePadding_TranslucentBasePass_1956;
+    float PrePadding_TranslucentBasePass_1960;
+    float PrePadding_TranslucentBasePass_1964;
+    float PrePadding_TranslucentBasePass_1968;
+    float PrePadding_TranslucentBasePass_1972;
+    float PrePadding_TranslucentBasePass_1976;
+    float PrePadding_TranslucentBasePass_1980;
+    float PrePadding_TranslucentBasePass_1984;
+    float PrePadding_TranslucentBasePass_1988;
+    float PrePadding_TranslucentBasePass_1992;
+    float PrePadding_TranslucentBasePass_1996;
+    float PrePadding_TranslucentBasePass_2000;
+    float PrePadding_TranslucentBasePass_2004;
+    float PrePadding_TranslucentBasePass_2008;
+    float PrePadding_TranslucentBasePass_2012;
+    float PrePadding_TranslucentBasePass_2016;
+    float PrePadding_TranslucentBasePass_2020;
+    float PrePadding_TranslucentBasePass_2024;
+    float PrePadding_TranslucentBasePass_2028;
+    float PrePadding_TranslucentBasePass_2032;
+    float PrePadding_TranslucentBasePass_2036;
+    float PrePadding_TranslucentBasePass_2040;
+    float PrePadding_TranslucentBasePass_2044;
+    float PrePadding_TranslucentBasePass_2048;
+    float PrePadding_TranslucentBasePass_2052;
+    float PrePadding_TranslucentBasePass_2056;
+    float PrePadding_TranslucentBasePass_2060;
+    float PrePadding_TranslucentBasePass_2064;
+    float PrePadding_TranslucentBasePass_2068;
+    float PrePadding_TranslucentBasePass_2072;
+    float PrePadding_TranslucentBasePass_2076;
+    float PrePadding_TranslucentBasePass_2080;
+    float PrePadding_TranslucentBasePass_2084;
+    float PrePadding_TranslucentBasePass_2088;
+    float PrePadding_TranslucentBasePass_2092;
+    float PrePadding_TranslucentBasePass_2096;
+    float PrePadding_TranslucentBasePass_2100;
+    float PrePadding_TranslucentBasePass_2104;
+    float PrePadding_TranslucentBasePass_2108;
+    float PrePadding_TranslucentBasePass_2112;
+    float PrePadding_TranslucentBasePass_2116;
+    float PrePadding_TranslucentBasePass_2120;
+    float PrePadding_TranslucentBasePass_2124;
+    float PrePadding_TranslucentBasePass_2128;
+    float PrePadding_TranslucentBasePass_2132;
+    float PrePadding_TranslucentBasePass_2136;
+    float PrePadding_TranslucentBasePass_2140;
+    float4 TranslucentBasePass_HZBUvFactorAndInvFactor;
+    float4 TranslucentBasePass_PrevScreenPositionScaleBias;
+    float TranslucentBasePass_PrevSceneColorPreExposureInv;
+};
+
+struct type_Material
+{
+    float4 Material_VectorExpressions[2];
+    float4 Material_ScalarExpressions[1];
+};
+
+constant float _108 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+    uint gl_SampleMask [[sample_mask]];
+};
+
+struct main0_in
+{
+    float4 in_var_TEXCOORD10_centroid [[user(locn0)]];
+    float4 in_var_TEXCOORD11_centroid [[user(locn1)]];
+    uint in_var_PRIMITIVE_ID [[user(locn2)]];
+    float4 in_var_TEXCOORD7 [[user(locn3)]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], const device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], constant type_TranslucentBasePass& TranslucentBasePass [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture3d<float> TranslucentBasePass_Shared_Fog_IntegratedLightScattering [[texture(0)]], sampler View_SharedBilinearClampedSampler [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleMaskIn [[sample_mask]])
+{
+    main0_out out = {};
+    float4 _137 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0);
+    float3 _142 = (_137.xyz / float3(_137.w)) - float3(View.View_PreViewTranslation);
+    bool _165 = TranslucentBasePass.TranslucentBasePass_Shared_Fog_ApplyVolumetricFog > 0.0;
+    float4 _215;
+    if (_165)
+    {
+        float4 _172 = View.View_WorldToClip * float4(_142, 1.0);
+        float _173 = _172.w;
+        float4 _202;
+        if (_165)
+        {
+            _202 = TranslucentBasePass_Shared_Fog_IntegratedLightScattering.sample(View_SharedBilinearClampedSampler, float3(((_172.xy / float2(_173)).xy * float2(0.5, -0.5)) + float2(0.5), (log2((_173 * View.View_VolumetricFogGridZParams[0]) + View.View_VolumetricFogGridZParams[1]) * View.View_VolumetricFogGridZParams[2]) * View.View_VolumetricFogInvGridSize[2]), level(0.0));
+        }
+        else
+        {
+            _202 = float4(0.0, 0.0, 0.0, 1.0);
+        }
+        _215 = float4(_202.xyz + (in.in_var_TEXCOORD7.xyz * float3(_202.w)), _202.w * in.in_var_TEXCOORD7.w);
+    }
+    else
+    {
+        _215 = in.in_var_TEXCOORD7;
+    }
+    float3 _216 = fast::max(Material.Material_VectorExpressions[1].xyz * float3(((1.0 + dot(float3(-1.0, -1.5, 3.0) / float3(sqrt(12.25)), normalize(float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz) * normalize((float3(0.0, 0.0, 1.0) * float3(View.View_NormalOverrideParameter.w)) + View.View_NormalOverrideParameter.xyz)))) * 0.5) + 0.20000000298023223876953125), float3(0.0));
+    float3 _246;
+    if (View.View_OutOfBoundsMask > 0.0)
+    {
+        uint _222 = in.in_var_PRIMITIVE_ID * 26u;
+        float3 _245;
+        if (any(abs(_142 - View_PrimitiveSceneData._m0[_222 + 5u].xyz) > (View_PrimitiveSceneData._m0[_222 + 19u].xyz + float3(1.0))))
+        {
+            _245 = mix(float3(1.0, 1.0, 0.0), float3(0.0, 1.0, 1.0), select(float3(0.0), float3(1.0), float3(fract(dot(_142, float3(0.57700002193450927734375)) * 0.00200000009499490261077880859375)) > float3(0.5)));
+        }
+        else
+        {
+            _245 = _216;
+        }
+        _246 = _245;
+    }
+    else
+    {
+        _246 = _216;
+    }
+    float4 _256 = float4((_246 * float3(_215.w)) + _215.xyz, _108);
+    _256.w = 1.0;
+    float4 _268;
+    uint _269;
+    if (View.View_NumSceneColorMSAASamples > 1)
+    {
+        _268 = _256 * float4(float(View.View_NumSceneColorMSAASamples) * 0.25);
+        _269 = gl_SampleMaskIn & 15u;
+    }
+    else
+    {
+        _268 = _256;
+        _269 = gl_SampleMaskIn;
+    }
+    out.out_var_SV_Target0 = _268;
+    out.gl_SampleMask = _269;
+    return out;
+}
+

+ 213 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/subpass-input.ios.framebuffer-fetch.asm.frag

@@ -0,0 +1,213 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_844;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_860;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_876;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_892;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_908;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_956;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_972;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_988;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1004;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1660;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1676;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1692;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2012;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2084;
+    float PrePadding_View_2088;
+    float PrePadding_View_2092;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2164;
+    float PrePadding_View_2168;
+    float PrePadding_View_2172;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2204;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2348;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2488;
+    float PrePadding_View_2492;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2648;
+    float PrePadding_View_2652;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2828;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2844;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2860;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2876;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_2892;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_Globals
+{
+    float3 SoftTransitionScale;
+    float4 ShadowBufferSize;
+    float ShadowFadeFraction;
+    float ShadowSharpen;
+    float4 LightPositionAndInvRadius;
+    float4x4 ScreenToShadowMatrix;
+    float2 ProjectionDepthBiasParameters;
+    float4 ModulatedShadowColor;
+    float4 ShadowTileOffsetAndSize;
+};
+
+constant float4 _58 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+};
+
+fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _gl_LastFragData [[color(0)]], texture2d<float> ShadowDepthTexture [[texture(1)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]])
+{
+    main0_out out = {};
+    float4 _67 = _gl_LastFragData;
+    float _68 = _67.w;
+    float4 _82 = _Globals.ScreenToShadowMatrix * float4((((gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw) - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0);
+    float _118 = fast::clamp(((fast::clamp((ShadowDepthTexture.sample(ShadowDepthTextureSampler, (((_82.xyz / float3(_82.w)).xy * _Globals.ShadowTileOffsetAndSize.zw).xy + _Globals.ShadowTileOffsetAndSize.xy).xy, level(0.0)).xxx * float3(_Globals.SoftTransitionScale.z)) - float3((fast::min(_82.z, 0.999989986419677734375) * _Globals.SoftTransitionScale.z) - 1.0), float3(0.0), float3(1.0)).x - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0);
+    float3 _127 = mix(_Globals.ModulatedShadowColor.xyz, float3(1.0), float3(mix(1.0, _118 * _118, _Globals.ShadowFadeFraction)));
+    float4 _129 = float4(_127.x, _127.y, _127.z, _58.w);
+    _129.w = 0.0;
+    out.out_var_SV_Target0 = _129;
+    return out;
+}
+

+ 121 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.frag

@@ -0,0 +1,121 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+#pragma clang diagnostic ignored "-Wunused-variable"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+#include <metal_atomic>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_StructuredBuffer_v4float
+{
+    float4 _m0[1];
+};
+
+struct type_Globals
+{
+    uint2 ShadowTileListGroupSize;
+};
+
+constant float3 _70 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+};
+
+struct main0_in
+{
+    uint in_var_TEXCOORD0 [[user(locn0)]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<uint> RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]])
+{
+    main0_out out = {};
+    uint2 _77 = uint2(gl_FragCoord.xy);
+    uint _78 = _77.y;
+    uint _83 = _77.x;
+    float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78));
+    float2 _93 = float2(_Globals.ShadowTileListGroupSize);
+    float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0);
+    float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0);
+    float3 _102 = float3(_100.x, _100.y, _70.z);
+    _102.z = 1.0;
+    uint _103 = in.in_var_TEXCOORD0 * 5u;
+    uint _107 = _103 + 1u;
+    if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _102))
+    {
+        float _122 = _96.x;
+        float _123 = _96.y;
+        spvUnsafeArray<float3, 8> _73;
+        _73[0] = float3(_122, _123, -1000.0);
+        float _126 = _100.x;
+        _73[1] = float3(_126, _123, -1000.0);
+        float _129 = _100.y;
+        _73[2] = float3(_122, _129, -1000.0);
+        _73[3] = float3(_126, _129, -1000.0);
+        _73[4] = float3(_122, _123, 1.0);
+        _73[5] = float3(_126, _123, 1.0);
+        _73[6] = float3(_122, _129, 1.0);
+        _73[7] = float3(_126, _129, 1.0);
+        float3 _155;
+        float3 _158;
+        _155 = float3(-500000.0);
+        _158 = float3(500000.0);
+        for (int _160 = 0; _160 < 8; )
+        {
+            float3 _166 = _73[_160] - (float3(0.5) * (CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz));
+            float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz));
+            _155 = fast::max(_155, _170);
+            _158 = fast::min(_158, _170);
+            _160++;
+            continue;
+        }
+        if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0)))
+        {
+            uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed);
+        }
+    }
+    out.out_var_SV_Target0 = float4(0.0);
+    return out;
+}
+

+ 122 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/frag/texture-atomics.asm.graphics-robust-access.frag

@@ -0,0 +1,122 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+#pragma clang diagnostic ignored "-Wunused-variable"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+#include <metal_atomic>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_StructuredBuffer_v4float
+{
+    float4 _m0[1];
+};
+
+struct type_Globals
+{
+    uint2 ShadowTileListGroupSize;
+};
+
+constant float3 _70 = {};
+
+struct main0_out
+{
+    float4 out_var_SV_Target0 [[color(0)]];
+};
+
+struct main0_in
+{
+    uint in_var_TEXCOORD0 [[user(locn0)]];
+};
+
+fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvBufferSizeConstants [[buffer(25)]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<uint> RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]])
+{
+    main0_out out = {};
+    constant uint& CulledObjectBoxBoundsBufferSize = spvBufferSizeConstants[0];
+    uint2 _77 = uint2(gl_FragCoord.xy);
+    uint _78 = _77.y;
+    uint _83 = _77.x;
+    float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78));
+    float2 _93 = float2(_Globals.ShadowTileListGroupSize);
+    float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0);
+    float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0);
+    float3 _102 = float3(_100.x, _100.y, _70.z);
+    _102.z = 1.0;
+    uint _103 = in.in_var_TEXCOORD0 * 5u;
+    uint _186 = clamp(_103 + 1u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u);
+    if (all(CulledObjectBoxBounds._m0[_186].xy > _96.xy) && all(CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz < _102))
+    {
+        float _122 = _96.x;
+        float _123 = _96.y;
+        spvUnsafeArray<float3, 8> _73;
+        _73[0] = float3(_122, _123, -1000.0);
+        float _126 = _100.x;
+        _73[1] = float3(_126, _123, -1000.0);
+        float _129 = _100.y;
+        _73[2] = float3(_122, _129, -1000.0);
+        _73[3] = float3(_126, _129, -1000.0);
+        _73[4] = float3(_122, _123, 1.0);
+        _73[5] = float3(_126, _123, 1.0);
+        _73[6] = float3(_122, _129, 1.0);
+        _73[7] = float3(_126, _129, 1.0);
+        float3 _155;
+        float3 _158;
+        _155 = float3(-500000.0);
+        _158 = float3(500000.0);
+        for (int _160 = 0; _160 < 8; )
+        {
+            float3 _166 = _73[int(clamp(uint(_160), uint(0), uint(7)))] - (float3(0.5) * (CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz + CulledObjectBoxBounds._m0[_186].xyz));
+            float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 2u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 3u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 4u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz));
+            _155 = fast::max(_155, _170);
+            _158 = fast::min(_158, _170);
+            _160++;
+            continue;
+        }
+        if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0)))
+        {
+            uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed);
+        }
+    }
+    out.out_var_SV_Target0 = float4(0.0);
+    return out;
+}
+

File diff ditekan karena terlalu besar
+ 318 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-incorrect-base-type.asm.tesc


+ 467 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-input-array-access.asm.tesc

@@ -0,0 +1,467 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct FVertexFactoryInterpolantsVSToPS
+{
+    float4 TangentToWorld0;
+    float4 TangentToWorld2;
+};
+
+struct FVertexFactoryInterpolantsVSToDS
+{
+    FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS;
+};
+
+struct FHitProxyVSToDS
+{
+    FVertexFactoryInterpolantsVSToDS FactoryInterpolants;
+    float4 Position;
+    uint VertexID;
+};
+
+struct FHullShaderConstantDominantVertexData
+{
+    float2 UV;
+    float4 Normal;
+    float3 Tangent;
+};
+
+struct FHullShaderConstantDominantEdgeData
+{
+    float2 UV0;
+    float2 UV1;
+    float4 Normal0;
+    float4 Normal1;
+    float3 Tangent0;
+    float3 Tangent1;
+};
+
+struct FPNTessellationHSToDS
+{
+    FHitProxyVSToDS PassSpecificData;
+    spvUnsafeArray<float4, 3> WorldPosition;
+    float3 DisplacementScale;
+    float TessellationMultiplier;
+    float WorldDisplacementMultiplier;
+    FHullShaderConstantDominantVertexData DominantVertex;
+    FHullShaderConstantDominantEdgeData DominantEdge;
+};
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_ClipToWorld;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_908;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_924;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_940;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_956;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_972;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_1020;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_1036;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_1052;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1068;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1724;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1740;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1756;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2076;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2148;
+    float PrePadding_View_2152;
+    float PrePadding_View_2156;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2228;
+    float PrePadding_View_2232;
+    float PrePadding_View_2236;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2268;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2412;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    float View_AtmosphericFogSunDiscHalfApexAngleRadian;
+    float PrePadding_View_2492;
+    float4 View_AtmosphericFogSunDiscLuminance;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    uint PrePadding_View_2520;
+    uint PrePadding_View_2524;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2584;
+    float PrePadding_View_2588;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2744;
+    float PrePadding_View_2748;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float PrePadding_View_2908;
+    int2 View_CursorPosition;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    float PrePadding_View_2924;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2940;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2956;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2972;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2988;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_3004;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_Primitive
+{
+    float4x4 Primitive_LocalToWorld;
+    float4 Primitive_InvNonUniformScaleAndDeterminantSign;
+    float4 Primitive_ObjectWorldPositionAndRadius;
+    float4x4 Primitive_WorldToLocal;
+    float4x4 Primitive_PreviousLocalToWorld;
+    float4x4 Primitive_PreviousWorldToLocal;
+    packed_float3 Primitive_ActorWorldPosition;
+    float Primitive_UseSingleSampleShadowFromStationaryLights;
+    packed_float3 Primitive_ObjectBounds;
+    float Primitive_LpvBiasMultiplier;
+    float Primitive_DecalReceiverMask;
+    float Primitive_PerObjectGBufferData;
+    float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
+    float Primitive_DrawsVelocity;
+    float4 Primitive_ObjectOrientation;
+    float4 Primitive_NonUniformScale;
+    packed_float3 Primitive_LocalObjectBoundsMin;
+    uint Primitive_LightingChannelMask;
+    packed_float3 Primitive_LocalObjectBoundsMax;
+    uint Primitive_LightmapDataIndex;
+    packed_float3 Primitive_PreSkinnedLocalBounds;
+    int Primitive_SingleCaptureIndex;
+    uint Primitive_OutputVelocity;
+    uint PrePadding_Primitive_420;
+    uint PrePadding_Primitive_424;
+    uint PrePadding_Primitive_428;
+    float4 Primitive_CustomPrimitiveData[4];
+};
+
+constant float4 _611 = {};
+
+struct main0_out
+{
+    float3 out_var_PN_DisplacementScales;
+    float2 out_var_PN_DominantEdge;
+    float2 out_var_PN_DominantEdge1;
+    float4 out_var_PN_DominantEdge2;
+    float4 out_var_PN_DominantEdge3;
+    float3 out_var_PN_DominantEdge4;
+    float3 out_var_PN_DominantEdge5;
+    float2 out_var_PN_DominantVertex;
+    float4 out_var_PN_DominantVertex1;
+    float3 out_var_PN_DominantVertex2;
+    spvUnsafeArray<float4, 3> out_var_PN_POSITION;
+    float out_var_PN_TessellationMultiplier;
+    float out_var_PN_WorldDisplacementMultiplier;
+    float4 out_var_TEXCOORD10_centroid;
+    float4 out_var_TEXCOORD11_centroid;
+    float4 out_var_VS_To_DS_Position;
+    uint out_var_VS_To_DS_VertexID;
+};
+
+struct main0_patchOut
+{
+    float4 out_var_PN_POSITION9;
+};
+
+struct main0_in
+{
+    float4 in_var_TEXCOORD10_centroid [[attribute(0)]];
+    float4 in_var_TEXCOORD11_centroid [[attribute(1)]];
+    float4 in_var_VS_To_DS_Position [[attribute(2)]];
+    uint in_var_VS_To_DS_VertexID [[attribute(3)]];
+};
+
+kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], 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 main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+{
+    threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3];
+    device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
+    device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
+    if (gl_InvocationID < spvIndirectParams[0])
+        gl_in[gl_InvocationID] = in;
+    threadgroup_barrier(mem_flags::mem_threadgroup);
+    if (gl_InvocationID >= 3)
+        return;
+    spvUnsafeArray<float4, 12> _142 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid });
+    spvUnsafeArray<float4, 12> _143 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid });
+    spvUnsafeArray<float4, 12> _192 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position });
+    spvUnsafeArray<uint, 12> _193 = spvUnsafeArray<uint, 12>({ gl_in[0].in_var_VS_To_DS_VertexID, gl_in[1].in_var_VS_To_DS_VertexID, gl_in[2].in_var_VS_To_DS_VertexID, gl_in[3].in_var_VS_To_DS_VertexID, gl_in[4].in_var_VS_To_DS_VertexID, gl_in[5].in_var_VS_To_DS_VertexID, gl_in[6].in_var_VS_To_DS_VertexID, gl_in[7].in_var_VS_To_DS_VertexID, gl_in[8].in_var_VS_To_DS_VertexID, gl_in[9].in_var_VS_To_DS_VertexID, gl_in[10].in_var_VS_To_DS_VertexID, gl_in[11].in_var_VS_To_DS_VertexID });
+    spvUnsafeArray<FHitProxyVSToDS, 12> _230 = spvUnsafeArray<FHitProxyVSToDS, 12>({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[0], _143[0] } }, _192[0], _193[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[1], _143[1] } }, _192[1], _193[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[2], _143[2] } }, _192[2], _193[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[3], _143[3] } }, _192[3], _193[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[4], _143[4] } }, _192[4], _193[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[5], _143[5] } }, _192[5], _193[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[6], _143[6] } }, _192[6], _193[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[7], _143[7] } }, _192[7], _193[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[8], _143[8] } }, _192[8], _193[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[9], _143[9] } }, _192[9], _193[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[10], _143[10] } }, _192[10], _193[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[11], _143[11] } }, _192[11], _193[11] } });
+    spvUnsafeArray<FHitProxyVSToDS, 12> param_var_I;
+    param_var_I = _230;
+    float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
+    float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz);
+    uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u;
+    uint _255 = 2u * gl_InvocationID;
+    uint _256 = 3u + _255;
+    uint _257 = _255 + 4u;
+    uint _264 = (_254 < 2u) ? (_254 + 1u) : 0u;
+    uint _265 = 2u * _254;
+    uint _266 = 3u + _265;
+    uint _267 = _265 + 4u;
+    float4 _279 = float4(param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
+    float4 _315;
+    float4 _316;
+    float4 _317;
+    float4 _318;
+    if ((param_var_I[_266].VertexID < param_var_I[_254].VertexID) || ((param_var_I[_266].VertexID == param_var_I[_254].VertexID) && (param_var_I[_267].VertexID < param_var_I[_264].VertexID)))
+    {
+        _315 = param_var_I[_267].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
+        _316 = param_var_I[_267].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
+        _317 = param_var_I[_266].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
+        _318 = param_var_I[_266].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
+    }
+    else
+    {
+        _315 = param_var_I[_264].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
+        _316 = param_var_I[_264].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
+        _317 = param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
+        _318 = param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
+    }
+    float4 _324 = float4(_318.xyz, 0.0);
+    float4 _328 = float4(_316.xyz, 0.0);
+    float4 _336 = float4(param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
+    float4 _344 = float4(param_var_I[_256].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
+    float4 _352 = float4(param_var_I[_257].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
+    spvUnsafeArray<float4, 3> _402 = spvUnsafeArray<float4, 3>({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_254].Position) - (float4(dot(param_var_I[_254].Position - param_var_I[gl_InvocationID].Position, _247)) * _247)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_256].Position) + param_var_I[_257].Position) - (float4(dot(param_var_I[_257].Position - param_var_I[_256].Position, _344)) * _344)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_254].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_254].Position, _336)) * _336)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_257].Position) + param_var_I[_256].Position) - (float4(dot(param_var_I[_256].Position - param_var_I[_257].Position, _352)) * _352)) * float4(0.3333333432674407958984375))) * float4(0.5) });
+    gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
+    gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
+    gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position;
+    gl_out[gl_InvocationID].out_var_VS_To_DS_VertexID = param_var_I[gl_InvocationID].VertexID;
+    gl_out[gl_InvocationID].out_var_PN_POSITION = _402;
+    gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _251;
+    gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0;
+    gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0;
+    gl_out[gl_InvocationID].out_var_PN_DominantVertex = float2(0.0);
+    gl_out[gl_InvocationID].out_var_PN_DominantVertex1 = _279;
+    gl_out[gl_InvocationID].out_var_PN_DominantVertex2 = param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz;
+    gl_out[gl_InvocationID].out_var_PN_DominantEdge = float2(0.0);
+    gl_out[gl_InvocationID].out_var_PN_DominantEdge1 = float2(0.0);
+    gl_out[gl_InvocationID].out_var_PN_DominantEdge2 = _324;
+    gl_out[gl_InvocationID].out_var_PN_DominantEdge3 = _328;
+    gl_out[gl_InvocationID].out_var_PN_DominantEdge4 = _317.xyz;
+    gl_out[gl_InvocationID].out_var_PN_DominantEdge5 = _315.xyz;
+    temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _402, _251, 1.0, 1.0, FHullShaderConstantDominantVertexData{ float2(0.0), _279, param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz }, FHullShaderConstantDominantEdgeData{ float2(0.0), float2(0.0), _324, _328, _317.xyz, _315.xyz } };
+    threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
+    if (gl_InvocationID == 0u)
+    {
+        float4 _461 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875);
+        float4 _474 = _611;
+        _474.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier);
+        float4 _480 = _474;
+        _480.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier);
+        float4 _485 = _480;
+        _485.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier);
+        float4 _492 = _485;
+        _492.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier);
+        float4 _600;
+        for (;;)
+        {
+            float4 _500 = View.View_ViewToClip * float4(0.0);
+            float4 _505 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0);
+            float3 _506 = _505.xyz;
+            float3 _507 = _500.xyz;
+            float _509 = _505.w;
+            float _510 = _500.w;
+            float4 _527 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0);
+            float3 _528 = _527.xyz;
+            float _530 = _527.w;
+            float4 _548 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0);
+            float3 _549 = _548.xyz;
+            float _551 = _548.w;
+            if (any((((select(int3(0), int3(1), (_506 - _507) < float3(_509 + _510)) + (int3(2) * select(int3(0), int3(1), (_506 + _507) > float3((-_509) - _510)))) | (select(int3(0), int3(1), (_528 - _507) < float3(_530 + _510)) + (int3(2) * select(int3(0), int3(1), (_528 + _507) > float3((-_530) - _510))))) | (select(int3(0), int3(1), (_549 - _507) < float3(_551 + _510)) + (int3(2) * select(int3(0), int3(1), (_549 + _507) > float3((-_551) - _510))))) != int3(3)))
+            {
+                _600 = float4(0.0);
+                break;
+            }
+            float3 _569 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz;
+            float3 _570 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz;
+            float3 _571 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz;
+            float3 _574 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
+            float3 _577 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
+            float3 _580 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
+            float _584 = sqrt(dot(_570, _570) / dot(_577, _577));
+            float _588 = sqrt(dot(_571, _571) / dot(_580, _580));
+            float _592 = sqrt(dot(_569, _569) / dot(_574, _574));
+            float4 _597 = float4(_584, _588, _592, 1.0);
+            _597.w = 0.333000004291534423828125 * ((_584 + _588) + _592);
+            _600 = float4(View.View_AdaptiveTessellationFactor) * _597;
+            break;
+        }
+        float4 _602 = fast::clamp(_492 * _600, float4(1.0), float4(15.0));
+        spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_602.x);
+        spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_602.y);
+        spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_602.z);
+        spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_602.w);
+        patchOut.out_var_PN_POSITION9 = _461 + ((_461 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5));
+    }
+}
+

+ 411 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tesc/hs-texcoord-array.asm.tesc

@@ -0,0 +1,411 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct FVertexFactoryInterpolantsVSToPS
+{
+    float4 TangentToWorld0;
+    float4 TangentToWorld2;
+    float4 Color;
+    spvUnsafeArray<float2, 2> TexCoords;
+};
+
+struct FVertexFactoryInterpolantsVSToDS
+{
+    FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS;
+};
+
+struct FHitProxyVSToDS
+{
+    FVertexFactoryInterpolantsVSToDS FactoryInterpolants;
+    float4 Position;
+};
+
+struct FPNTessellationHSToDS
+{
+    FHitProxyVSToDS PassSpecificData;
+    spvUnsafeArray<float4, 3> WorldPosition;
+    float3 DisplacementScale;
+    float TessellationMultiplier;
+    float WorldDisplacementMultiplier;
+};
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_ClipToWorld;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_908;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_924;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_940;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_956;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_972;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_1020;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_1036;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_1052;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1068;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1724;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1740;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1756;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2076;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2148;
+    float PrePadding_View_2152;
+    float PrePadding_View_2156;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2228;
+    float PrePadding_View_2232;
+    float PrePadding_View_2236;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2268;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2412;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    float View_AtmosphericFogSunDiscHalfApexAngleRadian;
+    float PrePadding_View_2492;
+    float4 View_AtmosphericFogSunDiscLuminance;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    uint PrePadding_View_2520;
+    uint PrePadding_View_2524;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2584;
+    float PrePadding_View_2588;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2744;
+    float PrePadding_View_2748;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float PrePadding_View_2908;
+    int2 View_CursorPosition;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    float PrePadding_View_2924;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2940;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2956;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2972;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2988;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_3004;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_Primitive
+{
+    float4x4 Primitive_LocalToWorld;
+    float4 Primitive_InvNonUniformScaleAndDeterminantSign;
+    float4 Primitive_ObjectWorldPositionAndRadius;
+    float4x4 Primitive_WorldToLocal;
+    float4x4 Primitive_PreviousLocalToWorld;
+    float4x4 Primitive_PreviousWorldToLocal;
+    packed_float3 Primitive_ActorWorldPosition;
+    float Primitive_UseSingleSampleShadowFromStationaryLights;
+    packed_float3 Primitive_ObjectBounds;
+    float Primitive_LpvBiasMultiplier;
+    float Primitive_DecalReceiverMask;
+    float Primitive_PerObjectGBufferData;
+    float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
+    float Primitive_DrawsVelocity;
+    float4 Primitive_ObjectOrientation;
+    float4 Primitive_NonUniformScale;
+    packed_float3 Primitive_LocalObjectBoundsMin;
+    uint Primitive_LightingChannelMask;
+    packed_float3 Primitive_LocalObjectBoundsMax;
+    uint Primitive_LightmapDataIndex;
+    packed_float3 Primitive_PreSkinnedLocalBounds;
+    int Primitive_SingleCaptureIndex;
+    uint Primitive_OutputVelocity;
+    uint PrePadding_Primitive_420;
+    uint PrePadding_Primitive_424;
+    uint PrePadding_Primitive_428;
+    float4 Primitive_CustomPrimitiveData[4];
+};
+
+constant float4 _535 = {};
+
+struct main0_out
+{
+    float4 out_var_COLOR0;
+    float3 out_var_PN_DisplacementScales;
+    spvUnsafeArray<float4, 3> out_var_PN_POSITION;
+    float out_var_PN_TessellationMultiplier;
+    float out_var_PN_WorldDisplacementMultiplier;
+    spvUnsafeArray<float2, 2> out_var_TEXCOORD0;
+    float4 out_var_TEXCOORD10_centroid;
+    float4 out_var_TEXCOORD11_centroid;
+    float4 out_var_VS_To_DS_Position;
+};
+
+struct main0_patchOut
+{
+    float4 out_var_PN_POSITION9;
+};
+
+struct main0_in
+{
+    float4 in_var_TEXCOORD10_centroid [[attribute(0)]];
+    float4 in_var_TEXCOORD11_centroid [[attribute(1)]];
+    float4 in_var_COLOR0 [[attribute(2)]];
+    float2 in_var_TEXCOORD0_0 [[attribute(3)]];
+    float2 in_var_TEXCOORD0_1 [[attribute(4)]];
+    float4 in_var_VS_To_DS_Position [[attribute(5)]];
+};
+
+kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], 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 main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+{
+    threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3];
+    device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
+    device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
+    if (gl_InvocationID < spvIndirectParams[0])
+        gl_in[gl_InvocationID] = in;
+    threadgroup_barrier(mem_flags::mem_threadgroup);
+    if (gl_InvocationID >= 3)
+        return;
+    spvUnsafeArray<float4, 12> _129 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid });
+    spvUnsafeArray<float4, 12> _130 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid });
+    spvUnsafeArray<float4, 12> _131 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_COLOR0, gl_in[1].in_var_COLOR0, gl_in[2].in_var_COLOR0, gl_in[3].in_var_COLOR0, gl_in[4].in_var_COLOR0, gl_in[5].in_var_COLOR0, gl_in[6].in_var_COLOR0, gl_in[7].in_var_COLOR0, gl_in[8].in_var_COLOR0, gl_in[9].in_var_COLOR0, gl_in[10].in_var_COLOR0, gl_in[11].in_var_COLOR0 });
+    spvUnsafeArray<spvUnsafeArray<float2, 2>, 12> _132 = spvUnsafeArray<spvUnsafeArray<float2, 2>, 12>({ spvUnsafeArray<float2, 2>({ gl_in[0].in_var_TEXCOORD0_0, gl_in[0].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[1].in_var_TEXCOORD0_0, gl_in[1].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[2].in_var_TEXCOORD0_0, gl_in[2].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[3].in_var_TEXCOORD0_0, gl_in[3].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[4].in_var_TEXCOORD0_0, gl_in[4].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[5].in_var_TEXCOORD0_0, gl_in[5].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[6].in_var_TEXCOORD0_0, gl_in[6].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[7].in_var_TEXCOORD0_0, gl_in[7].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[8].in_var_TEXCOORD0_0, gl_in[8].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[9].in_var_TEXCOORD0_0, gl_in[9].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[10].in_var_TEXCOORD0_0, gl_in[10].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[11].in_var_TEXCOORD0_0, gl_in[11].in_var_TEXCOORD0_1 }) });
+    spvUnsafeArray<float4, 12> _205 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position });
+    spvUnsafeArray<FHitProxyVSToDS, 12> _230 = spvUnsafeArray<FHitProxyVSToDS, 12>({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[0], _130[0], _131[0], _132[0] } }, _205[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[1], _130[1], _131[1], _132[1] } }, _205[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[2], _130[2], _131[2], _132[2] } }, _205[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[3], _130[3], _131[3], _132[3] } }, _205[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[4], _130[4], _131[4], _132[4] } }, _205[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[5], _130[5], _131[5], _132[5] } }, _205[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[6], _130[6], _131[6], _132[6] } }, _205[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[7], _130[7], _131[7], _132[7] } }, _205[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[8], _130[8], _131[8], _132[8] } }, _205[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[9], _130[9], _131[9], _132[9] } }, _205[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[10], _130[10], _131[10], _132[10] } }, _205[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[11], _130[11], _131[11], _132[11] } }, _205[11] } });
+    spvUnsafeArray<FHitProxyVSToDS, 12> param_var_I;
+    param_var_I = _230;
+    float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
+    float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz);
+    uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u;
+    uint _255 = 2u * gl_InvocationID;
+    uint _256 = 3u + _255;
+    uint _257 = _255 + 4u;
+    float4 _269 = float4(param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
+    float4 _277 = float4(param_var_I[_256].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
+    float4 _285 = float4(param_var_I[_257].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
+    spvUnsafeArray<float4, 3> _333 = spvUnsafeArray<float4, 3>({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_254].Position) - (float4(dot(param_var_I[_254].Position - param_var_I[gl_InvocationID].Position, _247)) * _247)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_256].Position) + param_var_I[_257].Position) - (float4(dot(param_var_I[_257].Position - param_var_I[_256].Position, _277)) * _277)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_254].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_254].Position, _269)) * _269)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_257].Position) + param_var_I[_256].Position) - (float4(dot(param_var_I[_256].Position - param_var_I[_257].Position, _285)) * _285)) * float4(0.3333333432674407958984375))) * float4(0.5) });
+    gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
+    gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
+    gl_out[gl_InvocationID].out_var_COLOR0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.Color;
+    gl_out[gl_InvocationID].out_var_TEXCOORD0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TexCoords;
+    gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position;
+    gl_out[gl_InvocationID].out_var_PN_POSITION = _333;
+    gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _251;
+    gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0;
+    gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0;
+    temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _333, _251, 1.0, 1.0 };
+    threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
+    if (gl_InvocationID == 0u)
+    {
+        float4 _385 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875);
+        float4 _398 = _535;
+        _398.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier);
+        float4 _404 = _398;
+        _404.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier);
+        float4 _409 = _404;
+        _409.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier);
+        float4 _416 = _409;
+        _416.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier);
+        float4 _524;
+        for (;;)
+        {
+            float4 _424 = View.View_ViewToClip * float4(0.0);
+            float4 _429 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0);
+            float3 _430 = _429.xyz;
+            float3 _431 = _424.xyz;
+            float _433 = _429.w;
+            float _434 = _424.w;
+            float4 _451 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0);
+            float3 _452 = _451.xyz;
+            float _454 = _451.w;
+            float4 _472 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0);
+            float3 _473 = _472.xyz;
+            float _475 = _472.w;
+            if (any((((select(int3(0), int3(1), (_430 - _431) < float3(_433 + _434)) + (int3(2) * select(int3(0), int3(1), (_430 + _431) > float3((-_433) - _434)))) | (select(int3(0), int3(1), (_452 - _431) < float3(_454 + _434)) + (int3(2) * select(int3(0), int3(1), (_452 + _431) > float3((-_454) - _434))))) | (select(int3(0), int3(1), (_473 - _431) < float3(_475 + _434)) + (int3(2) * select(int3(0), int3(1), (_473 + _431) > float3((-_475) - _434))))) != int3(3)))
+            {
+                _524 = float4(0.0);
+                break;
+            }
+            float3 _493 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz;
+            float3 _494 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz;
+            float3 _495 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz;
+            float3 _498 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
+            float3 _501 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
+            float3 _504 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
+            float _508 = sqrt(dot(_494, _494) / dot(_501, _501));
+            float _512 = sqrt(dot(_495, _495) / dot(_504, _504));
+            float _516 = sqrt(dot(_493, _493) / dot(_498, _498));
+            float4 _521 = float4(_508, _512, _516, 1.0);
+            _521.w = 0.333000004291534423828125 * ((_508 + _512) + _516);
+            _524 = float4(View.View_AdaptiveTessellationFactor) * _521;
+            break;
+        }
+        float4 _526 = fast::clamp(_416 * _524, float4(1.0), float4(15.0));
+        spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_526.x);
+        spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_526.y);
+        spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_526.z);
+        spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_526.w);
+        patchOut.out_var_PN_POSITION9 = _385 + ((_385 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5));
+    }
+}
+

+ 178 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tesc/tess-factor-must-be-threadgroup.asm.tesc

@@ -0,0 +1,178 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct FVertexFactoryInterpolantsVSToPS
+{
+    float4 TangentToWorld0;
+    float4 TangentToWorld2;
+};
+
+struct FVertexFactoryInterpolantsVSToDS
+{
+    FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS;
+};
+
+struct FSharedBasePassInterpolants
+{
+};
+struct FBasePassInterpolantsVSToDS
+{
+    FSharedBasePassInterpolants _m0;
+};
+
+struct FBasePassVSToDS
+{
+    FVertexFactoryInterpolantsVSToDS FactoryInterpolants;
+    FBasePassInterpolantsVSToDS BasePassInterpolants;
+    float4 Position;
+};
+
+struct FFlatTessellationHSToDS
+{
+    FBasePassVSToDS PassSpecificData;
+    float3 DisplacementScale;
+    float TessellationMultiplier;
+    float WorldDisplacementMultiplier;
+};
+
+struct type_Primitive
+{
+    float4x4 Primitive_LocalToWorld;
+    float4 Primitive_InvNonUniformScaleAndDeterminantSign;
+    float4 Primitive_ObjectWorldPositionAndRadius;
+    float4x4 Primitive_WorldToLocal;
+    float4x4 Primitive_PreviousLocalToWorld;
+    float4x4 Primitive_PreviousWorldToLocal;
+    packed_float3 Primitive_ActorWorldPosition;
+    float Primitive_UseSingleSampleShadowFromStationaryLights;
+    packed_float3 Primitive_ObjectBounds;
+    float Primitive_LpvBiasMultiplier;
+    float Primitive_DecalReceiverMask;
+    float Primitive_PerObjectGBufferData;
+    float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
+    float Primitive_DrawsVelocity;
+    float4 Primitive_ObjectOrientation;
+    float4 Primitive_NonUniformScale;
+    packed_float3 Primitive_LocalObjectBoundsMin;
+    uint Primitive_LightingChannelMask;
+    packed_float3 Primitive_LocalObjectBoundsMax;
+    uint Primitive_LightmapDataIndex;
+    packed_float3 Primitive_PreSkinnedLocalBounds;
+    int Primitive_SingleCaptureIndex;
+    uint Primitive_OutputVelocity;
+    uint PrePadding_Primitive_420;
+    uint PrePadding_Primitive_424;
+    uint PrePadding_Primitive_428;
+    float4 Primitive_CustomPrimitiveData[4];
+};
+
+struct type_Material
+{
+    float4 Material_VectorExpressions[3];
+    float4 Material_ScalarExpressions[1];
+};
+
+constant float4 _182 = {};
+
+struct main0_out
+{
+    float3 out_var_Flat_DisplacementScales;
+    float out_var_Flat_TessellationMultiplier;
+    float out_var_Flat_WorldDisplacementMultiplier;
+    float4 out_var_TEXCOORD10_centroid;
+    float4 out_var_TEXCOORD11_centroid;
+    float4 out_var_VS_To_DS_Position;
+};
+
+struct main0_in
+{
+    float4 in_var_TEXCOORD10_centroid [[attribute(0)]];
+    float4 in_var_TEXCOORD11_centroid [[attribute(1)]];
+    float4 in_var_VS_To_DS_Position [[attribute(2)]];
+};
+
+kernel void main0(main0_in in [[stage_in]], constant type_Primitive& Primitive [[buffer(0)]], constant type_Material& Material [[buffer(1)]], 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)]])
+{
+    threadgroup FFlatTessellationHSToDS temp_var_hullMainRetVal[3];
+    device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
+    if (gl_InvocationID < spvIndirectParams[0])
+        gl_in[gl_InvocationID] = in;
+    threadgroup_barrier(mem_flags::mem_threadgroup);
+    if (gl_InvocationID >= 3)
+        return;
+    spvUnsafeArray<float4, 3> _90 = spvUnsafeArray<float4, 3>({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid });
+    spvUnsafeArray<float4, 3> _91 = spvUnsafeArray<float4, 3>({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid });
+    spvUnsafeArray<float4, 3> _104 = spvUnsafeArray<float4, 3>({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position });
+    spvUnsafeArray<FBasePassVSToDS, 3> _111 = spvUnsafeArray<FBasePassVSToDS, 3>({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[0], _91[0] } }, FBasePassInterpolantsVSToDS{ { } }, _104[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[1], _91[1] } }, FBasePassInterpolantsVSToDS{ { } }, _104[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[2], _91[2] } }, FBasePassInterpolantsVSToDS{ { } }, _104[2] } });
+    spvUnsafeArray<FBasePassVSToDS, 3> param_var_I;
+    param_var_I = _111;
+    float3 _128 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz);
+    gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
+    gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
+    gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position;
+    gl_out[gl_InvocationID].out_var_Flat_DisplacementScales = _128;
+    gl_out[gl_InvocationID].out_var_Flat_TessellationMultiplier = Material.Material_ScalarExpressions[0].x;
+    gl_out[gl_InvocationID].out_var_Flat_WorldDisplacementMultiplier = 1.0;
+    temp_var_hullMainRetVal[gl_InvocationID] = FFlatTessellationHSToDS{ param_var_I[gl_InvocationID], _128, Material.Material_ScalarExpressions[0].x, 1.0 };
+    threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
+    if (gl_InvocationID == 0u)
+    {
+        float4 _154 = _182;
+        _154.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier);
+        float4 _160 = _154;
+        _160.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier);
+        float4 _165 = _160;
+        _165.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier);
+        float4 _172 = _165;
+        _172.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier);
+        float4 _173 = fast::clamp(_172, float4(1.0), float4(15.0));
+        spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_173.x);
+        spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_173.y);
+        spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_173.z);
+        spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_173.w);
+    }
+}
+

+ 419 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-double-gl-in-deref.asm.tese

@@ -0,0 +1,419 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_ClipToWorld;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_908;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_924;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_940;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_956;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_972;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_1020;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_1036;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_1052;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1068;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1724;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1740;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1756;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2076;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2148;
+    float PrePadding_View_2152;
+    float PrePadding_View_2156;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2228;
+    float PrePadding_View_2232;
+    float PrePadding_View_2236;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2268;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2412;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    float View_AtmosphericFogSunDiscHalfApexAngleRadian;
+    float PrePadding_View_2492;
+    float4 View_AtmosphericFogSunDiscLuminance;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    uint PrePadding_View_2520;
+    uint PrePadding_View_2524;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2584;
+    float PrePadding_View_2588;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2744;
+    float PrePadding_View_2748;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float PrePadding_View_2908;
+    int2 View_CursorPosition;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    float PrePadding_View_2924;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2940;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2956;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2972;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2988;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_3004;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_ShadowDepthPass
+{
+    float PrePadding_ShadowDepthPass_LPV_0;
+    float PrePadding_ShadowDepthPass_LPV_4;
+    float PrePadding_ShadowDepthPass_LPV_8;
+    float PrePadding_ShadowDepthPass_LPV_12;
+    float PrePadding_ShadowDepthPass_LPV_16;
+    float PrePadding_ShadowDepthPass_LPV_20;
+    float PrePadding_ShadowDepthPass_LPV_24;
+    float PrePadding_ShadowDepthPass_LPV_28;
+    float PrePadding_ShadowDepthPass_LPV_32;
+    float PrePadding_ShadowDepthPass_LPV_36;
+    float PrePadding_ShadowDepthPass_LPV_40;
+    float PrePadding_ShadowDepthPass_LPV_44;
+    float PrePadding_ShadowDepthPass_LPV_48;
+    float PrePadding_ShadowDepthPass_LPV_52;
+    float PrePadding_ShadowDepthPass_LPV_56;
+    float PrePadding_ShadowDepthPass_LPV_60;
+    float PrePadding_ShadowDepthPass_LPV_64;
+    float PrePadding_ShadowDepthPass_LPV_68;
+    float PrePadding_ShadowDepthPass_LPV_72;
+    float PrePadding_ShadowDepthPass_LPV_76;
+    float PrePadding_ShadowDepthPass_LPV_80;
+    float PrePadding_ShadowDepthPass_LPV_84;
+    float PrePadding_ShadowDepthPass_LPV_88;
+    float PrePadding_ShadowDepthPass_LPV_92;
+    float PrePadding_ShadowDepthPass_LPV_96;
+    float PrePadding_ShadowDepthPass_LPV_100;
+    float PrePadding_ShadowDepthPass_LPV_104;
+    float PrePadding_ShadowDepthPass_LPV_108;
+    float PrePadding_ShadowDepthPass_LPV_112;
+    float PrePadding_ShadowDepthPass_LPV_116;
+    float PrePadding_ShadowDepthPass_LPV_120;
+    float PrePadding_ShadowDepthPass_LPV_124;
+    float PrePadding_ShadowDepthPass_LPV_128;
+    float PrePadding_ShadowDepthPass_LPV_132;
+    float PrePadding_ShadowDepthPass_LPV_136;
+    float PrePadding_ShadowDepthPass_LPV_140;
+    float PrePadding_ShadowDepthPass_LPV_144;
+    float PrePadding_ShadowDepthPass_LPV_148;
+    float PrePadding_ShadowDepthPass_LPV_152;
+    float PrePadding_ShadowDepthPass_LPV_156;
+    float PrePadding_ShadowDepthPass_LPV_160;
+    float PrePadding_ShadowDepthPass_LPV_164;
+    float PrePadding_ShadowDepthPass_LPV_168;
+    float PrePadding_ShadowDepthPass_LPV_172;
+    float PrePadding_ShadowDepthPass_LPV_176;
+    float PrePadding_ShadowDepthPass_LPV_180;
+    float PrePadding_ShadowDepthPass_LPV_184;
+    float PrePadding_ShadowDepthPass_LPV_188;
+    float PrePadding_ShadowDepthPass_LPV_192;
+    float PrePadding_ShadowDepthPass_LPV_196;
+    float PrePadding_ShadowDepthPass_LPV_200;
+    float PrePadding_ShadowDepthPass_LPV_204;
+    float PrePadding_ShadowDepthPass_LPV_208;
+    float PrePadding_ShadowDepthPass_LPV_212;
+    float PrePadding_ShadowDepthPass_LPV_216;
+    float PrePadding_ShadowDepthPass_LPV_220;
+    float PrePadding_ShadowDepthPass_LPV_224;
+    float PrePadding_ShadowDepthPass_LPV_228;
+    float PrePadding_ShadowDepthPass_LPV_232;
+    float PrePadding_ShadowDepthPass_LPV_236;
+    float PrePadding_ShadowDepthPass_LPV_240;
+    float PrePadding_ShadowDepthPass_LPV_244;
+    float PrePadding_ShadowDepthPass_LPV_248;
+    float PrePadding_ShadowDepthPass_LPV_252;
+    float PrePadding_ShadowDepthPass_LPV_256;
+    float PrePadding_ShadowDepthPass_LPV_260;
+    float PrePadding_ShadowDepthPass_LPV_264;
+    float PrePadding_ShadowDepthPass_LPV_268;
+    float4x4 ShadowDepthPass_LPV_mRsmToWorld;
+    float4 ShadowDepthPass_LPV_mLightColour;
+    float4 ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection;
+    float4 ShadowDepthPass_LPV_mEyePos;
+    packed_int3 ShadowDepthPass_LPV_mOldGridOffset;
+    int PrePadding_ShadowDepthPass_LPV_396;
+    packed_int3 ShadowDepthPass_LPV_mLpvGridOffset;
+    float ShadowDepthPass_LPV_ClearMultiplier;
+    float ShadowDepthPass_LPV_LpvScale;
+    float ShadowDepthPass_LPV_OneOverLpvScale;
+    float ShadowDepthPass_LPV_DirectionalOcclusionIntensity;
+    float ShadowDepthPass_LPV_DirectionalOcclusionRadius;
+    float ShadowDepthPass_LPV_RsmAreaIntensityMultiplier;
+    float ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier;
+    float ShadowDepthPass_LPV_SecondaryOcclusionStrength;
+    float ShadowDepthPass_LPV_SecondaryBounceStrength;
+    float ShadowDepthPass_LPV_VplInjectionBias;
+    float ShadowDepthPass_LPV_GeometryVolumeInjectionBias;
+    float ShadowDepthPass_LPV_EmissiveInjectionMultiplier;
+    int ShadowDepthPass_LPV_PropagationIndex;
+    float4x4 ShadowDepthPass_ProjectionMatrix;
+    float4x4 ShadowDepthPass_ViewMatrix;
+    float4 ShadowDepthPass_ShadowParams;
+    float ShadowDepthPass_bClampToNearPlane;
+    float PrePadding_ShadowDepthPass_612;
+    float PrePadding_ShadowDepthPass_616;
+    float PrePadding_ShadowDepthPass_620;
+    float4x4 ShadowDepthPass_ShadowViewProjectionMatrices[6];
+    float4x4 ShadowDepthPass_ShadowViewMatrices[6];
+};
+
+constant float4 _113 = {};
+
+struct main0_out
+{
+    float4 out_var_TEXCOORD10_centroid [[user(locn0)]];
+    float4 out_var_TEXCOORD11_centroid [[user(locn1)]];
+    float4 out_var_COLOR0 [[user(locn2)]];
+    float4 out_var_TEXCOORD0_0 [[user(locn3)]];
+    uint out_var_PRIMITIVE_ID [[user(locn4)]];
+    float out_var_TEXCOORD6 [[user(locn5)]];
+    float out_var_TEXCOORD8 [[user(locn6)]];
+    float3 out_var_TEXCOORD7 [[user(locn7)]];
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float4 in_var_COLOR0 [[attribute(0)]];
+    float4 in_var_PN_POSITION_0 [[attribute(2)]];
+    float4 in_var_PN_POSITION_1 [[attribute(3)]];
+    float4 in_var_PN_POSITION_2 [[attribute(4)]];
+    float in_var_PN_WorldDisplacementMultiplier [[attribute(7)]];
+    uint in_var_PRIMITIVE_ID [[attribute(8)]];
+    float4 in_var_TEXCOORD0_0 [[attribute(9)]];
+    float4 in_var_TEXCOORD10_centroid [[attribute(10)]];
+    float4 in_var_TEXCOORD11_centroid [[attribute(11)]];
+};
+
+struct main0_patchIn
+{
+    float4 in_var_PN_POSITION9 [[attribute(5)]];
+    patch_control_point<main0_in> gl_in;
+};
+
+[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], constant type_ShadowDepthPass& ShadowDepthPass [[buffer(1)]], texture2d<float> Material_Texture2D_3 [[texture(0)]], sampler Material_Texture2D_3Sampler [[sampler(0)]], float3 gl_TessCoord [[position_in_patch]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 1> out_var_TEXCOORD0 = {};
+    spvUnsafeArray<float4, 3> _117 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid });
+    spvUnsafeArray<float4, 3> _118 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid });
+    spvUnsafeArray<float4, 3> _119 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_COLOR0, patchIn.gl_in[1].in_var_COLOR0, patchIn.gl_in[2].in_var_COLOR0 });
+    spvUnsafeArray<spvUnsafeArray<float4, 1>, 3> _120 = spvUnsafeArray<spvUnsafeArray<float4, 1>, 3>({ spvUnsafeArray<float4, 1>({ patchIn.gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[2].in_var_TEXCOORD0_0 }) });
+    spvUnsafeArray<spvUnsafeArray<float4, 3>, 3> _135 = spvUnsafeArray<spvUnsafeArray<float4, 3>, 3>({ spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) });
+    spvUnsafeArray<float, 3> _136 = spvUnsafeArray<float, 3>({ patchIn.gl_in[0].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[1].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[2].in_var_PN_WorldDisplacementMultiplier });
+    float _157 = gl_TessCoord.x * gl_TessCoord.x;
+    float _158 = gl_TessCoord.y * gl_TessCoord.y;
+    float _159 = gl_TessCoord.z * gl_TessCoord.z;
+    float4 _165 = float4(gl_TessCoord.x);
+    float4 _169 = float4(gl_TessCoord.y);
+    float4 _174 = float4(gl_TessCoord.z);
+    float4 _177 = float4(_157 * 3.0);
+    float4 _181 = float4(_158 * 3.0);
+    float4 _188 = float4(_159 * 3.0);
+    float4 _202 = ((((((((((_135[0][0] * float4(_157)) * _165) + ((_135[1][0] * float4(_158)) * _169)) + ((_135[2][0] * float4(_159)) * _174)) + ((_135[0][1] * _177) * _169)) + ((_135[0][2] * _181) * _165)) + ((_135[1][1] * _181) * _174)) + ((_135[1][2] * _188) * _169)) + ((_135[2][1] * _188) * _165)) + ((_135[2][2] * _177) * _174)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _174) * _165) * _169);
+    float3 _226 = ((_117[0].xyz * float3(gl_TessCoord.x)) + (_117[1].xyz * float3(gl_TessCoord.y))).xyz + (_117[2].xyz * float3(gl_TessCoord.z));
+    float4 _229 = ((_118[0] * _165) + (_118[1] * _169)) + (_118[2] * _174);
+    float4 _231 = ((_119[0] * _165) + (_119[1] * _169)) + (_119[2] * _174);
+    float4 _233 = ((_120[0][0] * _165) + (_120[1][0] * _169)) + (_120[2][0] * _174);
+    spvUnsafeArray<float4, 1> _234 = spvUnsafeArray<float4, 1>({ _233 });
+    float3 _236 = _229.xyz;
+    float3 _264 = _202.xyz + (((float3((Material_Texture2D_3.sample(Material_Texture2D_3Sampler, (float2(View.View_GameTime * 0.20000000298023223876953125, View.View_GameTime * (-0.699999988079071044921875)) + (_233.zw * float2(1.0, 2.0))), level(-1.0)).x * 10.0) * (1.0 - _231.x)) * _236) * float3(0.5)) * float3(((_136[0] * gl_TessCoord.x) + (_136[1] * gl_TessCoord.y)) + (_136[2] * gl_TessCoord.z)));
+    float4 _270 = ShadowDepthPass.ShadowDepthPass_ProjectionMatrix * float4(_264.x, _264.y, _264.z, _202.w);
+    float4 _281;
+    if ((ShadowDepthPass.ShadowDepthPass_bClampToNearPlane > 0.0) && (_270.z < 0.0))
+    {
+        float4 _279 = _270;
+        _279.z = 9.9999999747524270787835121154785e-07;
+        float4 _280 = _279;
+        _280.w = 1.0;
+        _281 = _280;
+    }
+    else
+    {
+        _281 = _270;
+    }
+    float _290 = abs(dot(float3(ShadowDepthPass.ShadowDepthPass_ViewMatrix[0].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[1].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[2].z), _236));
+    out.out_var_TEXCOORD10_centroid = float4(_226.x, _226.y, _226.z, _113.w);
+    out.out_var_TEXCOORD11_centroid = _229;
+    out.out_var_COLOR0 = _231;
+    out_var_TEXCOORD0 = _234;
+    out.out_var_PRIMITIVE_ID = patchIn.gl_in[0u].in_var_PRIMITIVE_ID;
+    out.out_var_TEXCOORD6 = _281.z;
+    out.out_var_TEXCOORD8 = (ShadowDepthPass.ShadowDepthPass_ShadowParams.y * fast::clamp((abs(_290) > 0.0) ? (sqrt(fast::clamp(1.0 - (_290 * _290), 0.0, 1.0)) / _290) : ShadowDepthPass.ShadowDepthPass_ShadowParams.z, 0.0, ShadowDepthPass.ShadowDepthPass_ShadowParams.z)) + ShadowDepthPass.ShadowDepthPass_ShadowParams.x;
+    out.out_var_TEXCOORD7 = _264.xyz;
+    out.gl_Position = _281;
+    out.out_var_TEXCOORD0_0 = out_var_TEXCOORD0[0];
+    return out;
+}
+

+ 415 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-input-fixes.asm.tese

@@ -0,0 +1,415 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_ClipToWorld;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_908;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_924;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_940;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_956;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_972;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_1020;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_1036;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_1052;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1068;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1724;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1740;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1756;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2076;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2148;
+    float PrePadding_View_2152;
+    float PrePadding_View_2156;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2228;
+    float PrePadding_View_2232;
+    float PrePadding_View_2236;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2268;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2412;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    float View_AtmosphericFogSunDiscHalfApexAngleRadian;
+    float PrePadding_View_2492;
+    float4 View_AtmosphericFogSunDiscLuminance;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    uint PrePadding_View_2520;
+    uint PrePadding_View_2524;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2584;
+    float PrePadding_View_2588;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2744;
+    float PrePadding_View_2748;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float PrePadding_View_2908;
+    int2 View_CursorPosition;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    float PrePadding_View_2924;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2940;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2956;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2972;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2988;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_3004;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+    float PrePadding_View_3048;
+    float PrePadding_View_3052;
+    float4x4 View_WorldToVirtualTexture;
+    float4 View_VirtualTextureParams;
+    float4 View_XRPassthroughCameraUVs[2];
+};
+
+struct type_Material
+{
+    float4 Material_VectorExpressions[5];
+    float4 Material_ScalarExpressions[2];
+};
+
+constant float4 _118 = {};
+
+struct main0_out
+{
+    float4 out_var_TEXCOORD6 [[user(locn0)]];
+    float4 out_var_TEXCOORD7 [[user(locn1)]];
+    float4 out_var_TEXCOORD10_centroid [[user(locn2)]];
+    float4 out_var_TEXCOORD11_centroid [[user(locn3)]];
+    float gl_ClipDistance [[clip_distance]] [1];
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float4 in_var_PN_DominantEdge2 [[attribute(3)]];
+    float4 in_var_PN_DominantEdge3 [[attribute(4)]];
+    float3 in_var_PN_DominantEdge4 [[attribute(5)]];
+    float3 in_var_PN_DominantEdge5 [[attribute(6)]];
+    float4 in_var_PN_DominantVertex1 [[attribute(8)]];
+    float3 in_var_PN_DominantVertex2 [[attribute(9)]];
+    float4 in_var_PN_POSITION_0 [[attribute(10)]];
+    float4 in_var_PN_POSITION_1 [[attribute(11)]];
+    float4 in_var_PN_POSITION_2 [[attribute(12)]];
+    float in_var_PN_WorldDisplacementMultiplier [[attribute(15)]];
+    float4 in_var_TEXCOORD10_centroid [[attribute(16)]];
+    float4 in_var_TEXCOORD11_centroid [[attribute(17)]];
+    float4 in_var_TEXCOORD6 [[attribute(18)]];
+    float4 in_var_TEXCOORD8 [[attribute(19)]];
+};
+
+struct main0_patchIn
+{
+    float4 in_var_PN_POSITION9 [[attribute(13)]];
+    patch_control_point<main0_in> gl_in;
+};
+
+[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Material& Material [[buffer(1)]], texture3d<float> View_GlobalDistanceFieldTexture0 [[texture(0)]], texture3d<float> View_GlobalDistanceFieldTexture1 [[texture(1)]], texture3d<float> View_GlobalDistanceFieldTexture2 [[texture(2)]], texture3d<float> View_GlobalDistanceFieldTexture3 [[texture(3)]], sampler View_GlobalDistanceFieldSampler0 [[sampler(0)]], float3 gl_TessCoord [[position_in_patch]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 3> _120 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD6, patchIn.gl_in[1].in_var_TEXCOORD6, patchIn.gl_in[2].in_var_TEXCOORD6 });
+    spvUnsafeArray<float4, 3> _121 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD8, patchIn.gl_in[1].in_var_TEXCOORD8, patchIn.gl_in[2].in_var_TEXCOORD8 });
+    spvUnsafeArray<float4, 3> _128 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid });
+    spvUnsafeArray<float4, 3> _129 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid });
+    spvUnsafeArray<spvUnsafeArray<float4, 3>, 3> _136 = spvUnsafeArray<spvUnsafeArray<float4, 3>, 3>({ spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) });
+    spvUnsafeArray<float, 3> _137 = spvUnsafeArray<float, 3>({ patchIn.gl_in[0].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[1].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[2].in_var_PN_WorldDisplacementMultiplier });
+    spvUnsafeArray<float4, 3> _138 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_DominantVertex1, patchIn.gl_in[1].in_var_PN_DominantVertex1, patchIn.gl_in[2].in_var_PN_DominantVertex1 });
+    spvUnsafeArray<float3, 3> _139 = spvUnsafeArray<float3, 3>({ patchIn.gl_in[0].in_var_PN_DominantVertex2, patchIn.gl_in[1].in_var_PN_DominantVertex2, patchIn.gl_in[2].in_var_PN_DominantVertex2 });
+    spvUnsafeArray<float4, 3> _146 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_DominantEdge2, patchIn.gl_in[1].in_var_PN_DominantEdge2, patchIn.gl_in[2].in_var_PN_DominantEdge2 });
+    spvUnsafeArray<float4, 3> _147 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_DominantEdge3, patchIn.gl_in[1].in_var_PN_DominantEdge3, patchIn.gl_in[2].in_var_PN_DominantEdge3 });
+    spvUnsafeArray<float3, 3> _148 = spvUnsafeArray<float3, 3>({ patchIn.gl_in[0].in_var_PN_DominantEdge4, patchIn.gl_in[1].in_var_PN_DominantEdge4, patchIn.gl_in[2].in_var_PN_DominantEdge4 });
+    spvUnsafeArray<float3, 3> _149 = spvUnsafeArray<float3, 3>({ patchIn.gl_in[0].in_var_PN_DominantEdge5, patchIn.gl_in[1].in_var_PN_DominantEdge5, patchIn.gl_in[2].in_var_PN_DominantEdge5 });
+    float _190 = gl_TessCoord.x * gl_TessCoord.x;
+    float _191 = gl_TessCoord.y * gl_TessCoord.y;
+    float _192 = gl_TessCoord.z * gl_TessCoord.z;
+    float4 _198 = float4(gl_TessCoord.x);
+    float4 _202 = float4(gl_TessCoord.y);
+    float4 _207 = float4(gl_TessCoord.z);
+    float4 _210 = float4(_190 * 3.0);
+    float4 _214 = float4(_191 * 3.0);
+    float4 _221 = float4(_192 * 3.0);
+    float4 _235 = ((((((((((_136[0][0] * float4(_190)) * _198) + ((_136[1][0] * float4(_191)) * _202)) + ((_136[2][0] * float4(_192)) * _207)) + ((_136[0][1] * _210) * _202)) + ((_136[0][2] * _214) * _198)) + ((_136[1][1] * _214) * _207)) + ((_136[1][2] * _221) * _202)) + ((_136[2][1] * _221) * _198)) + ((_136[2][2] * _210) * _207)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _207) * _198) * _202);
+    float3 _237 = float3(gl_TessCoord.x);
+    float3 _240 = float3(gl_TessCoord.y);
+    float3 _254 = float3(gl_TessCoord.z);
+    float3 _256 = ((_128[0].xyz * _237) + (_128[1].xyz * _240)).xyz + (_128[2].xyz * _254);
+    float4 _259 = ((_129[0] * _198) + (_129[1] * _202)) + (_129[2] * _207);
+    float3 _264 = _235.xyz;
+    float3 _265 = _256.xyz;
+    float3 _266 = _259.xyz;
+    float3 _272 = _264 + float3(View.View_WorldCameraOrigin);
+    float _279 = float(int(gl_TessCoord.x == 0.0));
+    float _282 = float(int(gl_TessCoord.y == 0.0));
+    float _285 = float(int(gl_TessCoord.z == 0.0));
+    float _286 = _279 + _282;
+    float _287 = _286 + _285;
+    float4 _387;
+    float3 _388;
+    if (float(int(_287 == 2.0)) == 1.0)
+    {
+        float _363 = float(int((_282 + _285) == 2.0));
+        float _367 = float(int((_285 + _279) == 2.0));
+        float _370 = float(int(_286 == 2.0));
+        _387 = ((float4(_363) * _138[0]) + (float4(_367) * _138[1])) + (float4(_370) * _138[2]);
+        _388 = ((float3(_363) * _139[0]) + (float3(_367) * _139[1])) + (float3(_370) * _139[2]);
+    }
+    else
+    {
+        float4 _358;
+        float3 _359;
+        if (float(int(_287 == 1.0)) != 0.0)
+        {
+            float4 _304 = float4(_279);
+            float4 _306 = float4(_282);
+            float4 _309 = float4(_285);
+            float4 _311 = ((_304 * _146[0]) + (_306 * _146[1])) + (_309 * _146[2]);
+            float4 _316 = ((_304 * _147[0]) + (_306 * _147[1])) + (_309 * _147[2]);
+            float3 _331 = float3(_279);
+            float3 _333 = float3(_282);
+            float3 _336 = float3(_285);
+            float3 _338 = ((_331 * _148[0]) + (_333 * _148[1])) + (_336 * _148[2]);
+            float3 _343 = ((_331 * _149[0]) + (_333 * _149[1])) + (_336 * _149[2]);
+            _358 = ((_304 * ((_202 * _311) + (_207 * _316))) + (_306 * ((_207 * _311) + (_198 * _316)))) + (_309 * ((_198 * _311) + (_202 * _316)));
+            _359 = ((_331 * ((_240 * _338) + (_254 * _343))) + (_333 * ((_254 * _338) + (_237 * _343)))) + (_336 * ((_237 * _338) + (_240 * _343)));
+        }
+        else
+        {
+            _358 = float4(_259.xyz, 0.0);
+            _359 = _265;
+        }
+        _387 = _358;
+        _388 = _359;
+    }
+    float3x3 _398;
+    if (float(int(_287 == 0.0)) == 0.0)
+    {
+        _398 = float3x3(_388, cross(_387.xyz, _388) * float3(_387.w), _387.xyz);
+    }
+    else
+    {
+        _398 = float3x3(_265, cross(_266, _265) * float3(_259.w), _266);
+    }
+    float3 _411 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[0].xyz) + View.View_GlobalVolumeCenterAndExtent[0].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[0].xyz + View.View_GlobalVolumeCenterAndExtent[0].www) - _272, float3(0.0)));
+    float _547;
+    if (fast::min(_411.x, fast::min(_411.y, _411.z)) > (View.View_GlobalVolumeCenterAndExtent[0].w * View.View_GlobalVolumeTexelSize))
+    {
+        _547 = View_GlobalDistanceFieldTexture0.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[0u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[0u].xyz), level(0.0)).x;
+    }
+    else
+    {
+        float3 _436 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[1].xyz) + View.View_GlobalVolumeCenterAndExtent[1].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[1].xyz + View.View_GlobalVolumeCenterAndExtent[1].www) - _272, float3(0.0)));
+        float _535;
+        if (fast::min(_436.x, fast::min(_436.y, _436.z)) > (View.View_GlobalVolumeCenterAndExtent[1].w * View.View_GlobalVolumeTexelSize))
+        {
+            _535 = View_GlobalDistanceFieldTexture1.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[1u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[1u].xyz), level(0.0)).x;
+        }
+        else
+        {
+            float3 _459 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[2].xyz) + View.View_GlobalVolumeCenterAndExtent[2].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[2].xyz + View.View_GlobalVolumeCenterAndExtent[2].www) - _272, float3(0.0)));
+            float3 _475 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[3].xyz) + View.View_GlobalVolumeCenterAndExtent[3].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[3].xyz + View.View_GlobalVolumeCenterAndExtent[3].www) - _272, float3(0.0)));
+            float _480 = fast::min(_475.x, fast::min(_475.y, _475.z));
+            float _523;
+            if (fast::min(_459.x, fast::min(_459.y, _459.z)) > (View.View_GlobalVolumeCenterAndExtent[2].w * View.View_GlobalVolumeTexelSize))
+            {
+                _523 = View_GlobalDistanceFieldTexture2.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[2u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[2u].xyz), level(0.0)).x;
+            }
+            else
+            {
+                float _511;
+                if (_480 > (View.View_GlobalVolumeCenterAndExtent[3].w * View.View_GlobalVolumeTexelSize))
+                {
+                    _511 = mix(View.View_MaxGlobalDistance, View_GlobalDistanceFieldTexture3.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[3u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[3u].xyz), level(0.0)).x, fast::clamp((_480 * 10.0) * View.View_GlobalVolumeWorldToUVAddAndMul[3].w, 0.0, 1.0));
+                }
+                else
+                {
+                    _511 = View.View_MaxGlobalDistance;
+                }
+                _523 = _511;
+            }
+            _535 = _523;
+        }
+        _547 = _535;
+    }
+    float3 _565 = _264 + ((_398[2] * float3(fast::min(_547 + Material.Material_ScalarExpressions[0].z, 0.0) * Material.Material_ScalarExpressions[0].w)) * float3(((_137[0] * gl_TessCoord.x) + (_137[1] * gl_TessCoord.y)) + (_137[2] * gl_TessCoord.z)));
+    float4 _574 = View.View_TranslatedWorldToClip * float4(_565.x, _565.y, _565.z, _235.w);
+    float4 _579 = _574;
+    _579.z = _574.z + (0.001000000047497451305389404296875 * _574.w);
+    out.gl_Position = _579;
+    out.out_var_TEXCOORD6 = ((_120[0] * _198) + (_120[1] * _202)) + (_120[2] * _207);
+    out.out_var_TEXCOORD7 = ((_121[0] * _198) + (_121[1] * _202)) + (_121[2] * _207);
+    out.out_var_TEXCOORD10_centroid = float4(_256.x, _256.y, _256.z, _118.w);
+    out.out_var_TEXCOORD11_centroid = _259;
+    out.gl_ClipDistance[0u] = dot(View.View_GlobalClippingPlane, float4(_565.xyz - float3(View.View_PreViewTranslation), 1.0));
+    return out;
+}
+

+ 216 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-patch-inputs.asm.tese

@@ -0,0 +1,216 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_ShadowDepthPass
+{
+    float PrePadding_ShadowDepthPass_LPV_0;
+    float PrePadding_ShadowDepthPass_LPV_4;
+    float PrePadding_ShadowDepthPass_LPV_8;
+    float PrePadding_ShadowDepthPass_LPV_12;
+    float PrePadding_ShadowDepthPass_LPV_16;
+    float PrePadding_ShadowDepthPass_LPV_20;
+    float PrePadding_ShadowDepthPass_LPV_24;
+    float PrePadding_ShadowDepthPass_LPV_28;
+    float PrePadding_ShadowDepthPass_LPV_32;
+    float PrePadding_ShadowDepthPass_LPV_36;
+    float PrePadding_ShadowDepthPass_LPV_40;
+    float PrePadding_ShadowDepthPass_LPV_44;
+    float PrePadding_ShadowDepthPass_LPV_48;
+    float PrePadding_ShadowDepthPass_LPV_52;
+    float PrePadding_ShadowDepthPass_LPV_56;
+    float PrePadding_ShadowDepthPass_LPV_60;
+    float PrePadding_ShadowDepthPass_LPV_64;
+    float PrePadding_ShadowDepthPass_LPV_68;
+    float PrePadding_ShadowDepthPass_LPV_72;
+    float PrePadding_ShadowDepthPass_LPV_76;
+    float PrePadding_ShadowDepthPass_LPV_80;
+    float PrePadding_ShadowDepthPass_LPV_84;
+    float PrePadding_ShadowDepthPass_LPV_88;
+    float PrePadding_ShadowDepthPass_LPV_92;
+    float PrePadding_ShadowDepthPass_LPV_96;
+    float PrePadding_ShadowDepthPass_LPV_100;
+    float PrePadding_ShadowDepthPass_LPV_104;
+    float PrePadding_ShadowDepthPass_LPV_108;
+    float PrePadding_ShadowDepthPass_LPV_112;
+    float PrePadding_ShadowDepthPass_LPV_116;
+    float PrePadding_ShadowDepthPass_LPV_120;
+    float PrePadding_ShadowDepthPass_LPV_124;
+    float PrePadding_ShadowDepthPass_LPV_128;
+    float PrePadding_ShadowDepthPass_LPV_132;
+    float PrePadding_ShadowDepthPass_LPV_136;
+    float PrePadding_ShadowDepthPass_LPV_140;
+    float PrePadding_ShadowDepthPass_LPV_144;
+    float PrePadding_ShadowDepthPass_LPV_148;
+    float PrePadding_ShadowDepthPass_LPV_152;
+    float PrePadding_ShadowDepthPass_LPV_156;
+    float PrePadding_ShadowDepthPass_LPV_160;
+    float PrePadding_ShadowDepthPass_LPV_164;
+    float PrePadding_ShadowDepthPass_LPV_168;
+    float PrePadding_ShadowDepthPass_LPV_172;
+    float PrePadding_ShadowDepthPass_LPV_176;
+    float PrePadding_ShadowDepthPass_LPV_180;
+    float PrePadding_ShadowDepthPass_LPV_184;
+    float PrePadding_ShadowDepthPass_LPV_188;
+    float PrePadding_ShadowDepthPass_LPV_192;
+    float PrePadding_ShadowDepthPass_LPV_196;
+    float PrePadding_ShadowDepthPass_LPV_200;
+    float PrePadding_ShadowDepthPass_LPV_204;
+    float PrePadding_ShadowDepthPass_LPV_208;
+    float PrePadding_ShadowDepthPass_LPV_212;
+    float PrePadding_ShadowDepthPass_LPV_216;
+    float PrePadding_ShadowDepthPass_LPV_220;
+    float PrePadding_ShadowDepthPass_LPV_224;
+    float PrePadding_ShadowDepthPass_LPV_228;
+    float PrePadding_ShadowDepthPass_LPV_232;
+    float PrePadding_ShadowDepthPass_LPV_236;
+    float PrePadding_ShadowDepthPass_LPV_240;
+    float PrePadding_ShadowDepthPass_LPV_244;
+    float PrePadding_ShadowDepthPass_LPV_248;
+    float PrePadding_ShadowDepthPass_LPV_252;
+    float PrePadding_ShadowDepthPass_LPV_256;
+    float PrePadding_ShadowDepthPass_LPV_260;
+    float PrePadding_ShadowDepthPass_LPV_264;
+    float PrePadding_ShadowDepthPass_LPV_268;
+    float4x4 ShadowDepthPass_LPV_mRsmToWorld;
+    float4 ShadowDepthPass_LPV_mLightColour;
+    float4 ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection;
+    float4 ShadowDepthPass_LPV_mEyePos;
+    packed_int3 ShadowDepthPass_LPV_mOldGridOffset;
+    int PrePadding_ShadowDepthPass_LPV_396;
+    packed_int3 ShadowDepthPass_LPV_mLpvGridOffset;
+    float ShadowDepthPass_LPV_ClearMultiplier;
+    float ShadowDepthPass_LPV_LpvScale;
+    float ShadowDepthPass_LPV_OneOverLpvScale;
+    float ShadowDepthPass_LPV_DirectionalOcclusionIntensity;
+    float ShadowDepthPass_LPV_DirectionalOcclusionRadius;
+    float ShadowDepthPass_LPV_RsmAreaIntensityMultiplier;
+    float ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier;
+    float ShadowDepthPass_LPV_SecondaryOcclusionStrength;
+    float ShadowDepthPass_LPV_SecondaryBounceStrength;
+    float ShadowDepthPass_LPV_VplInjectionBias;
+    float ShadowDepthPass_LPV_GeometryVolumeInjectionBias;
+    float ShadowDepthPass_LPV_EmissiveInjectionMultiplier;
+    int ShadowDepthPass_LPV_PropagationIndex;
+    float4x4 ShadowDepthPass_ProjectionMatrix;
+    float4x4 ShadowDepthPass_ViewMatrix;
+    float4 ShadowDepthPass_ShadowParams;
+    float ShadowDepthPass_bClampToNearPlane;
+    float PrePadding_ShadowDepthPass_612;
+    float PrePadding_ShadowDepthPass_616;
+    float PrePadding_ShadowDepthPass_620;
+    float4x4 ShadowDepthPass_ShadowViewProjectionMatrices[6];
+    float4x4 ShadowDepthPass_ShadowViewMatrices[6];
+};
+
+constant float4 _90 = {};
+
+struct main0_out
+{
+    float4 out_var_TEXCOORD10_centroid [[user(locn0)]];
+    float4 out_var_TEXCOORD11_centroid [[user(locn1)]];
+    float out_var_TEXCOORD6 [[user(locn2)]];
+    float3 out_var_TEXCOORD7 [[user(locn3)]];
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float4 in_var_PN_POSITION_0 [[attribute(10)]];
+    float4 in_var_PN_POSITION_1 [[attribute(11)]];
+    float4 in_var_PN_POSITION_2 [[attribute(12)]];
+    float4 in_var_TEXCOORD10_centroid [[attribute(16)]];
+    float4 in_var_TEXCOORD11_centroid [[attribute(17)]];
+};
+
+struct main0_patchIn
+{
+    float4 in_var_PN_POSITION9 [[attribute(13)]];
+    patch_control_point<main0_in> gl_in;
+};
+
+[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_ShadowDepthPass& ShadowDepthPass [[buffer(0)]], float3 gl_TessCoord [[position_in_patch]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 3> _93 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid });
+    spvUnsafeArray<float4, 3> _94 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid });
+    spvUnsafeArray<spvUnsafeArray<float4, 3>, 3> _101 = spvUnsafeArray<spvUnsafeArray<float4, 3>, 3>({ spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) });
+    float _119 = gl_TessCoord.x * gl_TessCoord.x;
+    float _120 = gl_TessCoord.y * gl_TessCoord.y;
+    float _121 = gl_TessCoord.z * gl_TessCoord.z;
+    float4 _127 = float4(gl_TessCoord.x);
+    float4 _131 = float4(gl_TessCoord.y);
+    float4 _136 = float4(gl_TessCoord.z);
+    float4 _139 = float4(_119 * 3.0);
+    float4 _143 = float4(_120 * 3.0);
+    float4 _150 = float4(_121 * 3.0);
+    float4 _164 = ((((((((((_101[0][0] * float4(_119)) * _127) + ((_101[1][0] * float4(_120)) * _131)) + ((_101[2][0] * float4(_121)) * _136)) + ((_101[0][1] * _139) * _131)) + ((_101[0][2] * _143) * _127)) + ((_101[1][1] * _143) * _136)) + ((_101[1][2] * _150) * _131)) + ((_101[2][1] * _150) * _127)) + ((_101[2][2] * _139) * _136)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _136) * _127) * _131);
+    float3 _179 = ((_93[0].xyz * float3(gl_TessCoord.x)) + (_93[1].xyz * float3(gl_TessCoord.y))).xyz + (_93[2].xyz * float3(gl_TessCoord.z));
+    float4 _182 = ((_94[0] * _127) + (_94[1] * _131)) + (_94[2] * _136);
+    float4 _189 = ShadowDepthPass.ShadowDepthPass_ProjectionMatrix * float4(_164.x, _164.y, _164.z, _164.w);
+    float4 _200;
+    if ((ShadowDepthPass.ShadowDepthPass_bClampToNearPlane > 0.0) && (_189.z < 0.0))
+    {
+        float4 _198 = _189;
+        _198.z = 9.9999999747524270787835121154785e-07;
+        float4 _199 = _198;
+        _199.w = 1.0;
+        _200 = _199;
+    }
+    else
+    {
+        _200 = _189;
+    }
+    float _209 = abs(dot(float3(ShadowDepthPass.ShadowDepthPass_ViewMatrix[0].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[1].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[2].z), _182.xyz));
+    float4 _234 = _200;
+    _234.z = ((_200.z * ShadowDepthPass.ShadowDepthPass_ShadowParams.w) + ((ShadowDepthPass.ShadowDepthPass_ShadowParams.y * fast::clamp((abs(_209) > 0.0) ? (sqrt(fast::clamp(1.0 - (_209 * _209), 0.0, 1.0)) / _209) : ShadowDepthPass.ShadowDepthPass_ShadowParams.z, 0.0, ShadowDepthPass.ShadowDepthPass_ShadowParams.z)) + ShadowDepthPass.ShadowDepthPass_ShadowParams.x)) * _200.w;
+    out.out_var_TEXCOORD10_centroid = float4(_179.x, _179.y, _179.z, _90.w);
+    out.out_var_TEXCOORD11_centroid = _182;
+    out.out_var_TEXCOORD6 = 0.0;
+    out.out_var_TEXCOORD7 = _164.xyz;
+    out.gl_Position = _234;
+    return out;
+}
+

+ 318 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/tese/ds-texcoord-array.asm.tese

@@ -0,0 +1,318 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_ClipToWorld;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_908;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_924;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_940;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_956;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_972;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_1020;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_1036;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_1052;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1068;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1724;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1740;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1756;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2076;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2148;
+    float PrePadding_View_2152;
+    float PrePadding_View_2156;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2228;
+    float PrePadding_View_2232;
+    float PrePadding_View_2236;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2268;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2412;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    float View_AtmosphericFogSunDiscHalfApexAngleRadian;
+    float PrePadding_View_2492;
+    float4 View_AtmosphericFogSunDiscLuminance;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    uint PrePadding_View_2520;
+    uint PrePadding_View_2524;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2584;
+    float PrePadding_View_2588;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2744;
+    float PrePadding_View_2748;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float PrePadding_View_2908;
+    int2 View_CursorPosition;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    float PrePadding_View_2924;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2940;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2956;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2972;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2988;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_3004;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+    float PrePadding_View_3048;
+    float PrePadding_View_3052;
+    float4x4 View_WorldToVirtualTexture;
+    float4 View_VirtualTextureParams;
+    float4 View_XRPassthroughCameraUVs[2];
+};
+
+constant float4 _68 = {};
+
+struct main0_out
+{
+    float4 out_var_TEXCOORD10_centroid [[user(locn0)]];
+    float4 out_var_TEXCOORD11_centroid [[user(locn1)]];
+    float4 out_var_TEXCOORD0_0 [[user(locn2)]];
+    float4 out_var_COLOR1 [[user(locn3)]];
+    float4 out_var_COLOR2 [[user(locn4)]];
+    float4 out_var_TEXCOORD6 [[user(locn5)]];
+    float3 out_var_TEXCOORD7 [[user(locn6)]];
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float4 in_var_COLOR1 [[attribute(0)]];
+    float4 in_var_COLOR2 [[attribute(1)]];
+    float4 in_var_TEXCOORD0_0 [[attribute(5)]];
+    float4 in_var_TEXCOORD10_centroid [[attribute(6)]];
+    float4 in_var_TEXCOORD11_centroid [[attribute(7)]];
+    float3 in_var_TEXCOORD7 [[attribute(8)]];
+    float4 in_var_VS_To_DS_Position [[attribute(9)]];
+};
+
+struct main0_patchIn
+{
+    patch_control_point<main0_in> gl_in;
+};
+
+[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], float3 gl_TessCoord [[position_in_patch]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 1> out_var_TEXCOORD0 = {};
+    spvUnsafeArray<float4, 3> _77 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid });
+    spvUnsafeArray<float4, 3> _78 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid });
+    spvUnsafeArray<spvUnsafeArray<float4, 1>, 3> _79 = spvUnsafeArray<spvUnsafeArray<float4, 1>, 3>({ spvUnsafeArray<float4, 1>({ patchIn.gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[2].in_var_TEXCOORD0_0 }) });
+    spvUnsafeArray<float4, 3> _80 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_COLOR1, patchIn.gl_in[1].in_var_COLOR1, patchIn.gl_in[2].in_var_COLOR1 });
+    spvUnsafeArray<float4, 3> _81 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_COLOR2, patchIn.gl_in[1].in_var_COLOR2, patchIn.gl_in[2].in_var_COLOR2 });
+    spvUnsafeArray<float4, 3> _97 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_VS_To_DS_Position, patchIn.gl_in[1].in_var_VS_To_DS_Position, patchIn.gl_in[2].in_var_VS_To_DS_Position });
+    spvUnsafeArray<float3, 3> _98 = spvUnsafeArray<float3, 3>({ patchIn.gl_in[0].in_var_TEXCOORD7, patchIn.gl_in[1].in_var_TEXCOORD7, patchIn.gl_in[2].in_var_TEXCOORD7 });
+    float4 _111 = float4(gl_TessCoord.x);
+    float4 _113 = float4(gl_TessCoord.y);
+    float4 _116 = float4(gl_TessCoord.z);
+    float4 _118 = ((_97[0] * _111) + (_97[1] * _113)) + (_97[2] * _116);
+    spvUnsafeArray<float4, 1> _72;
+    _72 = _79[0];
+    spvUnsafeArray<float4, 1> _71;
+    _71 = _79[1];
+    float3 _120 = float3(gl_TessCoord.x);
+    float3 _123 = float3(gl_TessCoord.y);
+    spvUnsafeArray<float4, 1> _73;
+    for (int _133 = 0; _133 < 1; )
+    {
+        _73[_133] = (_72[_133] * _111) + (_71[_133] * _113);
+        _133++;
+        continue;
+    }
+    spvUnsafeArray<float4, 1> _75;
+    _75 = _73;
+    spvUnsafeArray<float4, 1> _74;
+    _74 = _79[2];
+    float3 _155 = float3(gl_TessCoord.z);
+    float3 _157 = ((_77[0].xyz * _120) + (_77[1].xyz * _123)).xyz + (_77[2].xyz * _155);
+    spvUnsafeArray<float4, 1> _76;
+    for (int _164 = 0; _164 < 1; )
+    {
+        _76[_164] = _75[_164] + (_74[_164] * _116);
+        _164++;
+        continue;
+    }
+    float4 _181 = float4(_118.x, _118.y, _118.z, _118.w);
+    out.out_var_TEXCOORD10_centroid = float4(_157.x, _157.y, _157.z, _68.w);
+    out.out_var_TEXCOORD11_centroid = ((_78[0] * _111) + (_78[1] * _113)) + (_78[2] * _116);
+    out_var_TEXCOORD0 = _76;
+    out.out_var_COLOR1 = ((_80[0] * _111) + (_80[1] * _113)) + (_80[2] * _116);
+    out.out_var_COLOR2 = ((_81[0] * _111) + (_81[1] * _113)) + (_81[2] * _116);
+    out.out_var_TEXCOORD6 = _181;
+    out.out_var_TEXCOORD7 = ((_98[0] * _120) + (_98[1] * _123)) + (_98[2] * _155);
+    out.gl_Position = View.View_TranslatedWorldToClip * _181;
+    out.out_var_TEXCOORD0_0 = out_var_TEXCOORD0[0];
+    return out;
+}
+

+ 466 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/vert/array-missing-copies.asm.vert

@@ -0,0 +1,466 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_844;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_860;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_876;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_892;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_908;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_956;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_972;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_988;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1004;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1660;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1676;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1692;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2012;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2084;
+    float PrePadding_View_2088;
+    float PrePadding_View_2092;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2164;
+    float PrePadding_View_2168;
+    float PrePadding_View_2172;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2204;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2348;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2488;
+    float PrePadding_View_2492;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2648;
+    float PrePadding_View_2652;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2828;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2844;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2860;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2876;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_2892;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_MobileBasePass
+{
+    float4 MobileBasePass_Fog_ExponentialFogParameters;
+    float4 MobileBasePass_Fog_ExponentialFogParameters2;
+    float4 MobileBasePass_Fog_ExponentialFogColorParameter;
+    float4 MobileBasePass_Fog_ExponentialFogParameters3;
+    float4 MobileBasePass_Fog_InscatteringLightDirection;
+    float4 MobileBasePass_Fog_DirectionalInscatteringColor;
+    float2 MobileBasePass_Fog_SinCosInscatteringColorCubemapRotation;
+    float PrePadding_MobileBasePass_Fog_104;
+    float PrePadding_MobileBasePass_Fog_108;
+    packed_float3 MobileBasePass_Fog_FogInscatteringTextureParameters;
+    float MobileBasePass_Fog_ApplyVolumetricFog;
+    float PrePadding_MobileBasePass_PlanarReflection_128;
+    float PrePadding_MobileBasePass_PlanarReflection_132;
+    float PrePadding_MobileBasePass_PlanarReflection_136;
+    float PrePadding_MobileBasePass_PlanarReflection_140;
+    float PrePadding_MobileBasePass_PlanarReflection_144;
+    float PrePadding_MobileBasePass_PlanarReflection_148;
+    float PrePadding_MobileBasePass_PlanarReflection_152;
+    float PrePadding_MobileBasePass_PlanarReflection_156;
+    float4 MobileBasePass_PlanarReflection_ReflectionPlane;
+    float4 MobileBasePass_PlanarReflection_PlanarReflectionOrigin;
+    float4 MobileBasePass_PlanarReflection_PlanarReflectionXAxis;
+    float4 MobileBasePass_PlanarReflection_PlanarReflectionYAxis;
+    float3x4 MobileBasePass_PlanarReflection_InverseTransposeMirrorMatrix;
+    packed_float3 MobileBasePass_PlanarReflection_PlanarReflectionParameters;
+    float PrePadding_MobileBasePass_PlanarReflection_284;
+    float2 MobileBasePass_PlanarReflection_PlanarReflectionParameters2;
+    float PrePadding_MobileBasePass_PlanarReflection_296;
+    float PrePadding_MobileBasePass_PlanarReflection_300;
+    float4x4 MobileBasePass_PlanarReflection_ProjectionWithExtraFOV[2];
+    float4 MobileBasePass_PlanarReflection_PlanarReflectionScreenScaleBias[2];
+    float2 MobileBasePass_PlanarReflection_PlanarReflectionScreenBound;
+    uint MobileBasePass_PlanarReflection_bIsStereo;
+};
+
+struct type_Primitive
+{
+    float4x4 Primitive_LocalToWorld;
+    float4 Primitive_InvNonUniformScaleAndDeterminantSign;
+    float4 Primitive_ObjectWorldPositionAndRadius;
+    float4x4 Primitive_WorldToLocal;
+    float4x4 Primitive_PreviousLocalToWorld;
+    float4x4 Primitive_PreviousWorldToLocal;
+    packed_float3 Primitive_ActorWorldPosition;
+    float Primitive_UseSingleSampleShadowFromStationaryLights;
+    packed_float3 Primitive_ObjectBounds;
+    float Primitive_LpvBiasMultiplier;
+    float Primitive_DecalReceiverMask;
+    float Primitive_PerObjectGBufferData;
+    float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
+    float Primitive_UseEditorDepthTest;
+    float4 Primitive_ObjectOrientation;
+    float4 Primitive_NonUniformScale;
+    packed_float3 Primitive_LocalObjectBoundsMin;
+    float PrePadding_Primitive_380;
+    packed_float3 Primitive_LocalObjectBoundsMax;
+    uint Primitive_LightingChannelMask;
+    uint Primitive_LightmapDataIndex;
+    int Primitive_SingleCaptureIndex;
+};
+
+struct type_LandscapeParameters
+{
+    float4 LandscapeParameters_HeightmapUVScaleBias;
+    float4 LandscapeParameters_WeightmapUVScaleBias;
+    float4 LandscapeParameters_LandscapeLightmapScaleBias;
+    float4 LandscapeParameters_SubsectionSizeVertsLayerUVPan;
+    float4 LandscapeParameters_SubsectionOffsetParams;
+    float4 LandscapeParameters_LightmapSubsectionOffsetParams;
+    float4x4 LandscapeParameters_LocalToWorldNoScaling;
+};
+
+struct type_Globals
+{
+    float4 LodBias;
+    float4 LodValues;
+    float4 SectionLods;
+    float4 NeighborSectionLod[4];
+};
+
+struct main0_out
+{
+    float2 out_var_TEXCOORD0 [[user(locn0)]];
+    float2 out_var_TEXCOORD1 [[user(locn1)]];
+    float4 out_var_TEXCOORD2 [[user(locn2)]];
+    float4 out_var_TEXCOORD3 [[user(locn3)]];
+    float4 out_var_TEXCOORD8 [[user(locn4)]];
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float4 in_var_ATTRIBUTE0 [[attribute(0)]];
+    float4 in_var_ATTRIBUTE1_0 [[attribute(1)]];
+    float4 in_var_ATTRIBUTE1_1 [[attribute(2)]];
+};
+
+vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_MobileBasePass& MobileBasePass [[buffer(1)]], constant type_Primitive& Primitive [[buffer(2)]], constant type_LandscapeParameters& LandscapeParameters [[buffer(3)]], constant type_Globals& _Globals [[buffer(4)]])
+{
+    main0_out out = {};
+    spvUnsafeArray<float4, 2> in_var_ATTRIBUTE1 = {};
+    in_var_ATTRIBUTE1[0] = in.in_var_ATTRIBUTE1_0;
+    in_var_ATTRIBUTE1[1] = in.in_var_ATTRIBUTE1_1;
+    spvUnsafeArray<float4, 1> _97;
+    for (int _107 = 0; _107 < 1; )
+    {
+        _97[_107] = float4(0.0);
+        _107++;
+        continue;
+    }
+    float4 _115 = in.in_var_ATTRIBUTE0 * float4(255.0);
+    float2 _116 = _115.zw;
+    float2 _119 = fract(_116 * float2(0.5)) * float2(2.0);
+    float2 _121 = (_116 - _119) * float2(0.0039215688593685626983642578125);
+    float2 _122 = _115.xy;
+    float2 _126 = _122 * float2(_Globals.LodValues.w);
+    float _127 = _126.y;
+    float _128 = _126.x;
+    float4 _132 = float4(_127, _128, 1.0 - _128, 1.0 - _127) * float4(2.0);
+    float4 _186;
+    if (_119.y > 0.5)
+    {
+        float4 _161;
+        if (_119.x > 0.5)
+        {
+            _161 = (_132 * float4(_Globals.SectionLods.w)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[3]);
+        }
+        else
+        {
+            _161 = (_132 * float4(_Globals.SectionLods.z)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[2]);
+        }
+        _186 = _161;
+    }
+    else
+    {
+        float4 _185;
+        if (_119.x > 0.5)
+        {
+            _185 = (_132 * float4(_Globals.SectionLods.y)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[1]);
+        }
+        else
+        {
+            _185 = (_132 * float4(_Globals.SectionLods.x)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[0]);
+        }
+        _186 = _185;
+    }
+    float _206;
+    if ((_128 + _127) > 1.0)
+    {
+        float _198;
+        if (_128 < _127)
+        {
+            _198 = _186.w;
+        }
+        else
+        {
+            _198 = _186.z;
+        }
+        _206 = _198;
+    }
+    else
+    {
+        float _205;
+        if (_128 < _127)
+        {
+            _205 = _186.y;
+        }
+        else
+        {
+            _205 = _186.x;
+        }
+        _206 = _205;
+    }
+    float _207 = floor(_206);
+    float _220 = _121.x;
+    float3 _235 = select(select(select(select(select(float3(0.03125, _121.yy), float3(0.0625, _220, _121.y), bool3(_207 < 5.0)), float3(0.125, in_var_ATTRIBUTE1[1].w, _220), bool3(_207 < 4.0)), float3(0.25, in_var_ATTRIBUTE1[1].zw), bool3(_207 < 3.0)), float3(0.5, in_var_ATTRIBUTE1[1].yz), bool3(_207 < 2.0)), float3(1.0, in_var_ATTRIBUTE1[1].xy), bool3(_207 < 1.0));
+    float _236 = _235.x;
+    float _245 = (((in_var_ATTRIBUTE1[0].x * 65280.0) + (in_var_ATTRIBUTE1[0].y * 255.0)) - 32768.0) * 0.0078125;
+    float _252 = (((in_var_ATTRIBUTE1[0].z * 65280.0) + (in_var_ATTRIBUTE1[0].w * 255.0)) - 32768.0) * 0.0078125;
+    float2 _257 = floor(_122 * float2(_236));
+    float2 _271 = float2((LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x * _236) - 1.0, fast::max((LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x * 0.5) * _236, 2.0) - 1.0) * float2(LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.y);
+    float3 _287 = mix(float3(_257 / float2(_271.x), mix(_245, _252, _235.y)), float3(floor(_257 * float2(0.5)) / float2(_271.y), mix(_245, _252, _235.z)), float3(_206 - _207));
+    float2 _288 = _119.xy;
+    float2 _292 = _288 * LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.ww;
+    float3 _296 = _287 + float3(_292, 0.0);
+    float4 _322 = float4((((Primitive.Primitive_LocalToWorld[0u].xyz * _296.xxx) + (Primitive.Primitive_LocalToWorld[1u].xyz * _296.yyy)) + (Primitive.Primitive_LocalToWorld[2u].xyz * _296.zzz)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0);
+    float2 _323 = _287.xy;
+    float4 _338 = float4(_322.x, _322.y, _322.z, _322.w);
+    float4 _339 = View.View_TranslatedWorldToClip * _338;
+    float3 _341 = _322.xyz - float3(View.View_TranslatedWorldCameraOrigin);
+    float _345 = dot(_341, _341);
+    float _346 = rsqrt(_345);
+    float _347 = _345 * _346;
+    float _354 = _341.z;
+    float _357 = fast::max(0.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.w);
+    float _393;
+    float _394;
+    float _395;
+    float _396;
+    if (_357 > 0.0)
+    {
+        float _361 = _357 * _346;
+        float _362 = _361 * _354;
+        float _365 = View.View_WorldCameraOrigin[2] + _362;
+        _393 = (1.0 - _361) * _347;
+        _394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.z * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.w)));
+        _395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.x * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.y)));
+        _396 = _354 - _362;
+    }
+    else
+    {
+        _393 = _347;
+        _394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.x;
+        _395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.x;
+        _396 = _354;
+    }
+    float _400 = fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * _396);
+    float _405 = log(2.0);
+    float _407 = 0.5 * (_405 * _405);
+    float _417 = fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * _396);
+    float _428 = (_395 * ((abs(_400) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_400)) / _400) : (_405 - (_407 * _400)))) + (_394 * ((abs(_417) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_417)) / _417) : (_405 - (_407 * _417))));
+    float3 _459;
+    if (MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w >= 0.0)
+    {
+        _459 = (MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.xyz * float3(pow(fast::clamp(dot(_341 * float3(_346), MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.xyz), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.w))) * float3(1.0 - fast::clamp(exp2(-(_428 * fast::max(_393 - MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w, 0.0))), 0.0, 1.0));
+    }
+    else
+    {
+        _459 = float3(0.0);
+    }
+    bool _468 = (MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w > 0.0) && (_347 > MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w);
+    float _471 = _468 ? 1.0 : fast::max(fast::clamp(exp2(-(_428 * _393)), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.w);
+    _97[0] = float4((MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.xyz * float3(1.0 - _471)) + select(_459, float3(0.0), bool3(_468)), _471);
+    float4 _482 = _338;
+    _482.w = _339.w;
+    out.out_var_TEXCOORD0 = ((_323 + LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.zw) + _292).xy;
+    out.out_var_TEXCOORD1 = ((_323 * LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.xy) + LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.zw) + (_288 * LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.zz);
+    out.out_var_TEXCOORD2 = float4(float4(0.0).x, float4(0.0).y, _97[0].x, _97[0].y);
+    out.out_var_TEXCOORD3 = float4(float4(0.0).x, float4(0.0).y, _97[0].z, _97[0].w);
+    out.out_var_TEXCOORD8 = _482;
+    out.gl_Position = _339;
+    return out;
+}
+

+ 122 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/vert/loop-accesschain-writethrough.asm.vert

@@ -0,0 +1,122 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
+struct type_Globals
+{
+    float4 ViewportSize;
+    float ScatteringScaling;
+    float CocRadiusToCircumscribedRadius;
+};
+
+struct type_StructuredBuffer_v4float
+{
+    float4 _m0[1];
+};
+
+struct main0_out
+{
+    float2 out_var_TEXCOORD0 [[user(locn0)]];
+    float4 out_var_TEXCOORD1 [[user(locn1)]];
+    float4 out_var_TEXCOORD2 [[user(locn2)]];
+    float4 out_var_TEXCOORD3 [[user(locn3)]];
+    float4 out_var_TEXCOORD4 [[user(locn4)]];
+    float4 out_var_TEXCOORD5 [[user(locn5)]];
+    float4 out_var_TEXCOORD6 [[user(locn6)]];
+    float4 gl_Position [[position]];
+};
+
+vertex main0_out main0(constant type_Globals& _Globals [[buffer(0)]], const device type_StructuredBuffer_v4float& ScatterDrawList [[buffer(1)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]])
+{
+    main0_out out = {};
+    uint _66 = gl_VertexIndex / 4u;
+    uint _68 = gl_VertexIndex - (_66 * 4u);
+    uint _70 = (16u * gl_InstanceIndex) + _66;
+    float _72;
+    _72 = 0.0;
+    spvUnsafeArray<float4, 4> _61;
+    spvUnsafeArray<float, 4> _62;
+    spvUnsafeArray<float2, 4> _63;
+    float _73;
+    uint _75 = 0u;
+    for (;;)
+    {
+        if (_75 < 4u)
+        {
+            uint _82 = ((5u * _70) + _75) + 1u;
+            _61[_75] = float4(ScatterDrawList._m0[_82].xyz, 0.0);
+            _62[_75] = ScatterDrawList._m0[_82].w;
+            if (_75 == 0u)
+            {
+                _73 = _62[_75];
+            }
+            else
+            {
+                _73 = fast::max(_72, _62[_75]);
+            }
+            _63[_75].x = (-0.5) / _62[_75];
+            _63[_75].y = (0.5 * _62[_75]) + 0.5;
+            _72 = _73;
+            _75++;
+            continue;
+        }
+        else
+        {
+            break;
+        }
+    }
+    float2 _144 = float2(_Globals.ScatteringScaling) * ScatterDrawList._m0[5u * _70].xy;
+    float2 _173 = (((float2((_72 * _Globals.CocRadiusToCircumscribedRadius) + 1.0) * ((float2(float(_68 % 2u), float(_68 / 2u)) * float2(2.0)) - float2(1.0))) + _144) + float2(0.5)) * _Globals.ViewportSize.zw;
+    out.out_var_TEXCOORD0 = _144;
+    out.out_var_TEXCOORD1 = float4(_61[0].xyz, _62[0]);
+    out.out_var_TEXCOORD2 = float4(_61[1].xyz, _62[1]);
+    out.out_var_TEXCOORD3 = float4(_61[2].xyz, _62[2]);
+    out.out_var_TEXCOORD4 = float4(_61[3].xyz, _62[3]);
+    out.out_var_TEXCOORD5 = float4(_63[0].x, _63[0].y, _63[1].x, _63[1].y);
+    out.out_var_TEXCOORD6 = float4(_63[2].x, _63[2].y, _63[3].x, _63[3].y);
+    out.gl_Position = float4((_173.x * 2.0) - 1.0, 1.0 - (_173.y * 2.0), 0.0, 1.0);
+    return out;
+}
+

+ 387 - 0
3rdparty/spirv-cross/reference/opt/shaders-ue4/asm/vert/texture-buffer.asm.vert

@@ -0,0 +1,387 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct type_View
+{
+    float4x4 View_TranslatedWorldToClip;
+    float4x4 View_WorldToClip;
+    float4x4 View_TranslatedWorldToView;
+    float4x4 View_ViewToTranslatedWorld;
+    float4x4 View_TranslatedWorldToCameraView;
+    float4x4 View_CameraViewToTranslatedWorld;
+    float4x4 View_ViewToClip;
+    float4x4 View_ViewToClipNoAA;
+    float4x4 View_ClipToView;
+    float4x4 View_ClipToTranslatedWorld;
+    float4x4 View_SVPositionToTranslatedWorld;
+    float4x4 View_ScreenToWorld;
+    float4x4 View_ScreenToTranslatedWorld;
+    packed_float3 View_ViewForward;
+    float PrePadding_View_844;
+    packed_float3 View_ViewUp;
+    float PrePadding_View_860;
+    packed_float3 View_ViewRight;
+    float PrePadding_View_876;
+    packed_float3 View_HMDViewNoRollUp;
+    float PrePadding_View_892;
+    packed_float3 View_HMDViewNoRollRight;
+    float PrePadding_View_908;
+    float4 View_InvDeviceZToWorldZTransform;
+    float4 View_ScreenPositionScaleBias;
+    packed_float3 View_WorldCameraOrigin;
+    float PrePadding_View_956;
+    packed_float3 View_TranslatedWorldCameraOrigin;
+    float PrePadding_View_972;
+    packed_float3 View_WorldViewOrigin;
+    float PrePadding_View_988;
+    packed_float3 View_PreViewTranslation;
+    float PrePadding_View_1004;
+    float4x4 View_PrevProjection;
+    float4x4 View_PrevViewProj;
+    float4x4 View_PrevViewRotationProj;
+    float4x4 View_PrevViewToClip;
+    float4x4 View_PrevClipToView;
+    float4x4 View_PrevTranslatedWorldToClip;
+    float4x4 View_PrevTranslatedWorldToView;
+    float4x4 View_PrevViewToTranslatedWorld;
+    float4x4 View_PrevTranslatedWorldToCameraView;
+    float4x4 View_PrevCameraViewToTranslatedWorld;
+    packed_float3 View_PrevWorldCameraOrigin;
+    float PrePadding_View_1660;
+    packed_float3 View_PrevWorldViewOrigin;
+    float PrePadding_View_1676;
+    packed_float3 View_PrevPreViewTranslation;
+    float PrePadding_View_1692;
+    float4x4 View_PrevInvViewProj;
+    float4x4 View_PrevScreenToTranslatedWorld;
+    float4x4 View_ClipToPrevClip;
+    float4 View_TemporalAAJitter;
+    float4 View_GlobalClippingPlane;
+    float2 View_FieldOfViewWideAngles;
+    float2 View_PrevFieldOfViewWideAngles;
+    float4 View_ViewRectMin;
+    float4 View_ViewSizeAndInvSize;
+    float4 View_BufferSizeAndInvSize;
+    float4 View_BufferBilinearUVMinMax;
+    int View_NumSceneColorMSAASamples;
+    float View_PreExposure;
+    float View_OneOverPreExposure;
+    float PrePadding_View_2012;
+    float4 View_DiffuseOverrideParameter;
+    float4 View_SpecularOverrideParameter;
+    float4 View_NormalOverrideParameter;
+    float2 View_RoughnessOverrideParameter;
+    float View_PrevFrameGameTime;
+    float View_PrevFrameRealTime;
+    float View_OutOfBoundsMask;
+    float PrePadding_View_2084;
+    float PrePadding_View_2088;
+    float PrePadding_View_2092;
+    packed_float3 View_WorldCameraMovementSinceLastFrame;
+    float View_CullingSign;
+    float View_NearPlane;
+    float View_AdaptiveTessellationFactor;
+    float View_GameTime;
+    float View_RealTime;
+    float View_DeltaTime;
+    float View_MaterialTextureMipBias;
+    float View_MaterialTextureDerivativeMultiply;
+    uint View_Random;
+    uint View_FrameNumber;
+    uint View_StateFrameIndexMod8;
+    uint View_StateFrameIndex;
+    float View_CameraCut;
+    float View_UnlitViewmodeMask;
+    float PrePadding_View_2164;
+    float PrePadding_View_2168;
+    float PrePadding_View_2172;
+    float4 View_DirectionalLightColor;
+    packed_float3 View_DirectionalLightDirection;
+    float PrePadding_View_2204;
+    float4 View_TranslucencyLightingVolumeMin[2];
+    float4 View_TranslucencyLightingVolumeInvSize[2];
+    float4 View_TemporalAAParams;
+    float4 View_CircleDOFParams;
+    float View_DepthOfFieldSensorWidth;
+    float View_DepthOfFieldFocalDistance;
+    float View_DepthOfFieldScale;
+    float View_DepthOfFieldFocalLength;
+    float View_DepthOfFieldFocalRegion;
+    float View_DepthOfFieldNearTransitionRegion;
+    float View_DepthOfFieldFarTransitionRegion;
+    float View_MotionBlurNormalizedToPixel;
+    float View_bSubsurfacePostprocessEnabled;
+    float View_GeneralPurposeTweak;
+    float View_DemosaicVposOffset;
+    float PrePadding_View_2348;
+    packed_float3 View_IndirectLightingColorScale;
+    float View_HDR32bppEncodingMode;
+    packed_float3 View_AtmosphericFogSunDirection;
+    float View_AtmosphericFogSunPower;
+    float View_AtmosphericFogPower;
+    float View_AtmosphericFogDensityScale;
+    float View_AtmosphericFogDensityOffset;
+    float View_AtmosphericFogGroundOffset;
+    float View_AtmosphericFogDistanceScale;
+    float View_AtmosphericFogAltitudeScale;
+    float View_AtmosphericFogHeightScaleRayleigh;
+    float View_AtmosphericFogStartDistance;
+    float View_AtmosphericFogDistanceOffset;
+    float View_AtmosphericFogSunDiscScale;
+    uint View_AtmosphericFogRenderMask;
+    uint View_AtmosphericFogInscatterAltitudeSampleNum;
+    float4 View_AtmosphericFogSunColor;
+    packed_float3 View_NormalCurvatureToRoughnessScaleBias;
+    float View_RenderingReflectionCaptureMask;
+    float4 View_AmbientCubemapTint;
+    float View_AmbientCubemapIntensity;
+    float View_SkyLightParameters;
+    float PrePadding_View_2488;
+    float PrePadding_View_2492;
+    float4 View_SkyLightColor;
+    float4 View_SkyIrradianceEnvironmentMap[7];
+    float View_MobilePreviewMode;
+    float View_HMDEyePaddingOffset;
+    float View_ReflectionCubemapMaxMip;
+    float View_ShowDecalsMask;
+    uint View_DistanceFieldAOSpecularOcclusionMode;
+    float View_IndirectCapsuleSelfShadowingIntensity;
+    float PrePadding_View_2648;
+    float PrePadding_View_2652;
+    packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
+    int View_StereoPassIndex;
+    float4 View_GlobalVolumeCenterAndExtent[4];
+    float4 View_GlobalVolumeWorldToUVAddAndMul[4];
+    float View_GlobalVolumeDimension;
+    float View_GlobalVolumeTexelSize;
+    float View_MaxGlobalDistance;
+    float View_bCheckerboardSubsurfaceProfileRendering;
+    packed_float3 View_VolumetricFogInvGridSize;
+    float PrePadding_View_2828;
+    packed_float3 View_VolumetricFogGridZParams;
+    float PrePadding_View_2844;
+    float2 View_VolumetricFogSVPosToVolumeUV;
+    float View_VolumetricFogMaxDistance;
+    float PrePadding_View_2860;
+    packed_float3 View_VolumetricLightmapWorldToUVScale;
+    float PrePadding_View_2876;
+    packed_float3 View_VolumetricLightmapWorldToUVAdd;
+    float PrePadding_View_2892;
+    packed_float3 View_VolumetricLightmapIndirectionTextureSize;
+    float View_VolumetricLightmapBrickSize;
+    packed_float3 View_VolumetricLightmapBrickTexelSize;
+    float View_StereoIPD;
+    float View_IndirectLightingCacheShowFlag;
+    float View_EyeToPixelSpreadAngle;
+};
+
+struct type_Primitive
+{
+    float4x4 Primitive_LocalToWorld;
+    float4 Primitive_InvNonUniformScaleAndDeterminantSign;
+    float4 Primitive_ObjectWorldPositionAndRadius;
+    float4x4 Primitive_WorldToLocal;
+    float4x4 Primitive_PreviousLocalToWorld;
+    float4x4 Primitive_PreviousWorldToLocal;
+    packed_float3 Primitive_ActorWorldPosition;
+    float Primitive_UseSingleSampleShadowFromStationaryLights;
+    packed_float3 Primitive_ObjectBounds;
+    float Primitive_LpvBiasMultiplier;
+    float Primitive_DecalReceiverMask;
+    float Primitive_PerObjectGBufferData;
+    float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
+    float Primitive_UseEditorDepthTest;
+    float4 Primitive_ObjectOrientation;
+    float4 Primitive_NonUniformScale;
+    packed_float3 Primitive_LocalObjectBoundsMin;
+    float PrePadding_Primitive_380;
+    packed_float3 Primitive_LocalObjectBoundsMax;
+    uint Primitive_LightingChannelMask;
+    uint Primitive_LightmapDataIndex;
+    int Primitive_SingleCaptureIndex;
+};
+
+struct type_MobileShadowDepthPass
+{
+    float PrePadding_MobileShadowDepthPass_0;
+    float PrePadding_MobileShadowDepthPass_4;
+    float PrePadding_MobileShadowDepthPass_8;
+    float PrePadding_MobileShadowDepthPass_12;
+    float PrePadding_MobileShadowDepthPass_16;
+    float PrePadding_MobileShadowDepthPass_20;
+    float PrePadding_MobileShadowDepthPass_24;
+    float PrePadding_MobileShadowDepthPass_28;
+    float PrePadding_MobileShadowDepthPass_32;
+    float PrePadding_MobileShadowDepthPass_36;
+    float PrePadding_MobileShadowDepthPass_40;
+    float PrePadding_MobileShadowDepthPass_44;
+    float PrePadding_MobileShadowDepthPass_48;
+    float PrePadding_MobileShadowDepthPass_52;
+    float PrePadding_MobileShadowDepthPass_56;
+    float PrePadding_MobileShadowDepthPass_60;
+    float PrePadding_MobileShadowDepthPass_64;
+    float PrePadding_MobileShadowDepthPass_68;
+    float PrePadding_MobileShadowDepthPass_72;
+    float PrePadding_MobileShadowDepthPass_76;
+    float4x4 MobileShadowDepthPass_ProjectionMatrix;
+    float2 MobileShadowDepthPass_ShadowParams;
+    float MobileShadowDepthPass_bClampToNearPlane;
+    float PrePadding_MobileShadowDepthPass_156;
+    float4x4 MobileShadowDepthPass_ShadowViewProjectionMatrices[6];
+};
+
+struct type_EmitterDynamicUniforms
+{
+    float2 EmitterDynamicUniforms_LocalToWorldScale;
+    float EmitterDynamicUniforms_EmitterInstRandom;
+    float PrePadding_EmitterDynamicUniforms_12;
+    float4 EmitterDynamicUniforms_AxisLockRight;
+    float4 EmitterDynamicUniforms_AxisLockUp;
+    float4 EmitterDynamicUniforms_DynamicColor;
+    float4 EmitterDynamicUniforms_MacroUVParameters;
+};
+
+struct type_EmitterUniforms
+{
+    float4 EmitterUniforms_ColorCurve;
+    float4 EmitterUniforms_ColorScale;
+    float4 EmitterUniforms_ColorBias;
+    float4 EmitterUniforms_MiscCurve;
+    float4 EmitterUniforms_MiscScale;
+    float4 EmitterUniforms_MiscBias;
+    float4 EmitterUniforms_SizeBySpeed;
+    float4 EmitterUniforms_SubImageSize;
+    float4 EmitterUniforms_TangentSelector;
+    packed_float3 EmitterUniforms_CameraFacingBlend;
+    float EmitterUniforms_RemoveHMDRoll;
+    float EmitterUniforms_RotationRateScale;
+    float EmitterUniforms_RotationBias;
+    float EmitterUniforms_CameraMotionBlurAmount;
+    float PrePadding_EmitterUniforms_172;
+    float2 EmitterUniforms_PivotOffset;
+};
+
+struct type_Globals
+{
+    uint ParticleIndicesOffset;
+};
+
+struct main0_out
+{
+    float out_var_TEXCOORD6 [[user(locn0)]];
+    float4 gl_Position [[position]];
+};
+
+struct main0_in
+{
+    float2 in_var_ATTRIBUTE0 [[attribute(0)]];
+};
+
+// Returns 2D texture coords corresponding to 1D texel buffer coords
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
+{
+    return uint2(tc % 4096, tc / 4096);
+}
+
+vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], constant type_MobileShadowDepthPass& MobileShadowDepthPass [[buffer(2)]], constant type_EmitterDynamicUniforms& EmitterDynamicUniforms [[buffer(3)]], constant type_EmitterUniforms& EmitterUniforms [[buffer(4)]], constant type_Globals& _Globals [[buffer(5)]], texture2d<float> ParticleIndices [[texture(0)]], texture2d<float> PositionTexture [[texture(1)]], texture2d<float> VelocityTexture [[texture(2)]], texture2d<float> AttributesTexture [[texture(3)]], texture2d<float> CurveTexture [[texture(4)]], sampler PositionTextureSampler [[sampler(0)]], sampler VelocityTextureSampler [[sampler(1)]], sampler AttributesTextureSampler [[sampler(2)]], sampler CurveTextureSampler [[sampler(3)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]])
+{
+    main0_out out = {};
+    float2 _133 = ParticleIndices.read(spvTexelBufferCoord((_Globals.ParticleIndicesOffset + ((gl_InstanceIndex * 16u) + (gl_VertexIndex / 4u))))).xy;
+    float4 _137 = PositionTexture.sample(PositionTextureSampler, _133, level(0.0));
+    float4 _145 = AttributesTexture.sample(AttributesTextureSampler, _133, level(0.0));
+    float _146 = _137.w;
+    float3 _158 = float3x3(Primitive.Primitive_LocalToWorld[0].xyz, Primitive.Primitive_LocalToWorld[1].xyz, Primitive.Primitive_LocalToWorld[2].xyz) * VelocityTexture.sample(VelocityTextureSampler, _133, level(0.0)).xyz;
+    float3 _160 = normalize(_158 + float3(0.0, 0.0, 9.9999997473787516355514526367188e-05));
+    float2 _204 = ((((_145.xy + float2((_145.x < 0.5) ? 0.0 : (-0.5), (_145.y < 0.5) ? 0.0 : (-0.5))) * float2(2.0)) * (((CurveTexture.sample(CurveTextureSampler, (EmitterUniforms.EmitterUniforms_MiscCurve.xy + (EmitterUniforms.EmitterUniforms_MiscCurve.zw * float2(_146))), level(0.0)) * EmitterUniforms.EmitterUniforms_MiscScale) + EmitterUniforms.EmitterUniforms_MiscBias).xy * EmitterDynamicUniforms.EmitterDynamicUniforms_LocalToWorldScale)) * fast::min(fast::max(EmitterUniforms.EmitterUniforms_SizeBySpeed.xy * float2(length(_158)), float2(1.0)), EmitterUniforms.EmitterUniforms_SizeBySpeed.zw)) * float2(step(_146, 1.0));
+    float3 _239 = float4((((Primitive.Primitive_LocalToWorld[0u].xyz * _137.xxx) + (Primitive.Primitive_LocalToWorld[1u].xyz * _137.yyy)) + (Primitive.Primitive_LocalToWorld[2u].xyz * _137.zzz)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0).xyz;
+    float3 _242 = float3(EmitterUniforms.EmitterUniforms_RemoveHMDRoll);
+    float3 _251 = mix(mix(float3(View.View_ViewRight), float3(View.View_HMDViewNoRollRight), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.w));
+    float3 _259 = mix(-mix(float3(View.View_ViewUp), float3(View.View_HMDViewNoRollUp), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.w));
+    float3 _260 = float3(View.View_TranslatedWorldCameraOrigin) - _239;
+    float _261 = dot(_260, _260);
+    float3 _265 = _260 / float3(sqrt(fast::max(_261, 0.00999999977648258209228515625)));
+    float3 _335;
+    float3 _336;
+    if (EmitterUniforms.EmitterUniforms_CameraFacingBlend[0] > 0.0)
+    {
+        float3 _279 = cross(_265, float3(0.0, 0.0, 1.0));
+        float3 _284 = _279 / float3(sqrt(fast::max(dot(_279, _279), 0.00999999977648258209228515625)));
+        float3 _286 = float3(fast::clamp((_261 * EmitterUniforms.EmitterUniforms_CameraFacingBlend[1]) - EmitterUniforms.EmitterUniforms_CameraFacingBlend[2], 0.0, 1.0));
+        _335 = normalize(mix(_251, _284, _286));
+        _336 = normalize(mix(_259, cross(_265, _284), _286));
+    }
+    else
+    {
+        float3 _333;
+        float3 _334;
+        if (EmitterUniforms.EmitterUniforms_TangentSelector.y > 0.0)
+        {
+            float3 _297 = cross(_265, _160);
+            _333 = _297 / float3(sqrt(fast::max(dot(_297, _297), 0.00999999977648258209228515625)));
+            _334 = -_160;
+        }
+        else
+        {
+            float3 _331;
+            float3 _332;
+            if (EmitterUniforms.EmitterUniforms_TangentSelector.z > 0.0)
+            {
+                float3 _310 = cross(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, _265);
+                _331 = EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz;
+                _332 = -(_310 / float3(sqrt(fast::max(dot(_310, _310), 0.00999999977648258209228515625))));
+            }
+            else
+            {
+                float3 _329;
+                float3 _330;
+                if (EmitterUniforms.EmitterUniforms_TangentSelector.w > 0.0)
+                {
+                    float3 _322 = cross(_265, float3(0.0, 0.0, 1.0));
+                    float3 _327 = _322 / float3(sqrt(fast::max(dot(_322, _322), 0.00999999977648258209228515625)));
+                    _329 = _327;
+                    _330 = cross(_265, _327);
+                }
+                else
+                {
+                    _329 = _251;
+                    _330 = _259;
+                }
+                _331 = _329;
+                _332 = _330;
+            }
+            _333 = _331;
+            _334 = _332;
+        }
+        _335 = _333;
+        _336 = _334;
+    }
+    float _339 = ((_145.z + ((_145.w * EmitterUniforms.EmitterUniforms_RotationRateScale) * _146)) * 6.283185482025146484375) + EmitterUniforms.EmitterUniforms_RotationBias;
+    float3 _342 = float3(sin(_339));
+    float3 _344 = float3(cos(_339));
+    float4 _371 = float4(_239 + ((float3(_204.x * (in.in_var_ATTRIBUTE0.x + EmitterUniforms.EmitterUniforms_PivotOffset.x)) * ((_342 * _336) + (_344 * _335))) + (float3(_204.y * (in.in_var_ATTRIBUTE0.y + EmitterUniforms.EmitterUniforms_PivotOffset.y)) * ((_344 * _336) - (_342 * _335)))), 1.0);
+    float4 _375 = MobileShadowDepthPass.MobileShadowDepthPass_ProjectionMatrix * float4(_371.x, _371.y, _371.z, _371.w);
+    float4 _386;
+    if ((MobileShadowDepthPass.MobileShadowDepthPass_bClampToNearPlane > 0.0) && (_375.z < 0.0))
+    {
+        float4 _384 = _375;
+        _384.z = 9.9999999747524270787835121154785e-07;
+        float4 _385 = _384;
+        _385.w = 1.0;
+        _386 = _385;
+    }
+    else
+    {
+        _386 = _375;
+    }
+    float4 _396 = _386;
+    _396.z = ((_386.z * MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.y) + MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.x) * _386.w;
+    out.out_var_TEXCOORD6 = 0.0;
+    out.gl_Position = _396;
+    return out;
+}
+

+ 1 - 1
3rdparty/spirv-cross/reference/opt/shaders/asm/comp/phi-temporary-copy-loop-variable.asm.comp

@@ -5,9 +5,9 @@ layout(binding = 1, rgba32f) uniform writeonly image2D outImageTexture;
 
 void main()
 {
+    int _27_copy;
     int _30;
     _30 = 7;
-    int _27_copy;
     for (int _27 = 7; _27 >= 0; _27_copy = _27, _27--, _30 = _27_copy)
     {
         if (5.0 > float(_27))

+ 37 - 0
3rdparty/spirv-cross/reference/shaders-hlsl-no-opt/asm/frag/empty-struct-in-struct.asm.frag

@@ -0,0 +1,37 @@
+struct EmptyStructTest
+{
+    int empty_struct_member;
+};
+
+struct EmptyStruct2Test
+{
+    EmptyStructTest _m0;
+};
+
+static const EmptyStructTest _30 = { 0 };
+static const EmptyStruct2Test _20 = { { 0 } };
+
+float GetValue(EmptyStruct2Test self)
+{
+    return 0.0f;
+}
+
+float GetValue_1(EmptyStruct2Test self)
+{
+    return 0.0f;
+}
+
+void frag_main()
+{
+    EmptyStructTest _25 = { 0 };
+    EmptyStruct2Test _26 = { _25 };
+    EmptyStruct2Test emptyStruct;
+    float value = GetValue(emptyStruct);
+    value = GetValue_1(_26);
+    value = GetValue_1(_20);
+}
+
+void main()
+{
+    frag_main();
+}

+ 2 - 1
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/storage-buffer-pointer-argument.asm.comp

@@ -15,7 +15,8 @@ struct SSBORead
     float b;
 };
 
-inline void copy_out(device float& A, device const float& B)
+static inline __attribute__((always_inline))
+void copy_out(device float& A, device const float& B)
 {
     A = B;
 }

+ 6 - 3
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/comp/variable-pointers.asm.comp

@@ -22,17 +22,20 @@ struct baz
     int e[128];
 };
 
-inline device int* select_buffer(device foo& buf, device baz& buf2, constant bar& cb)
+static inline __attribute__((always_inline))
+device int* select_buffer(device foo& buf, device baz& buf2, constant bar& cb)
 {
     return (cb.d != 0) ? &buf.a[0u] : &buf2.e[0u];
 }
 
-inline device int* select_buffer_null(device foo& buf, constant bar& cb)
+static inline __attribute__((always_inline))
+device int* select_buffer_null(device foo& buf, constant bar& cb)
 {
     return (cb.d != 0) ? &buf.a[0u] : nullptr;
 }
 
-inline threadgroup int* select_tgsm(constant bar& cb, threadgroup int (&tgsm)[128])
+static inline __attribute__((always_inline))
+threadgroup int* select_tgsm(constant bar& cb, threadgroup int (&tgsm)[128])
 {
     return (cb.d != 0) ? &tgsm[0u] : nullptr;
 }

+ 35 - 0
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/empty-struct-in-struct.asm.frag

@@ -0,0 +1,35 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct EmptyStructTest
+{
+};
+struct EmptyStruct2Test
+{
+    EmptyStructTest _m0;
+};
+
+static inline __attribute__((always_inline))
+float GetValue(thread const EmptyStruct2Test& self)
+{
+    return 0.0;
+}
+
+static inline __attribute__((always_inline))
+float GetValue_1(EmptyStruct2Test self)
+{
+    return 0.0;
+}
+
+fragment void main0()
+{
+    EmptyStruct2Test emptyStruct;
+    float value = GetValue(emptyStruct);
+    value = GetValue_1(EmptyStruct2Test{ EmptyStructTest{  } });
+    value = GetValue_1(EmptyStruct2Test{ { } });
+}
+

+ 0 - 235
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/inliner-dominator-inside-loop.asm.frag

@@ -1,235 +0,0 @@
-#include <metal_stdlib>
-#include <simd/simd.h>
-
-using namespace metal;
-
-struct VertexOutput
-{
-    float4 HPosition;
-    float4 Uv_EdgeDistance1;
-    float4 UvStuds_EdgeDistance2;
-    float4 Color;
-    float4 LightPosition_Fog;
-    float4 View_Depth;
-    float4 Normal_SpecPower;
-    float3 Tangent;
-    float4 PosLightSpace_Reflectance;
-    float studIndex;
-};
-
-struct Surface
-{
-    float3 albedo;
-    float3 normal;
-    float specular;
-    float gloss;
-    float reflectance;
-    float opacity;
-};
-
-struct SurfaceInput
-{
-    float4 Color;
-    float2 Uv;
-    float2 UvStuds;
-};
-
-struct Globals
-{
-    float4x4 ViewProjection;
-    float4 ViewRight;
-    float4 ViewUp;
-    float4 ViewDir;
-    float3 CameraPosition;
-    float3 AmbientColor;
-    float3 Lamp0Color;
-    float3 Lamp0Dir;
-    float3 Lamp1Color;
-    float4 FogParams;
-    float3 FogColor;
-    float4 LightBorder;
-    float4 LightConfig0;
-    float4 LightConfig1;
-    float4 LightConfig2;
-    float4 LightConfig3;
-    float4 RefractionBias_FadeDistance_GlowFactor;
-    float4 OutlineBrightness_ShadowInfo;
-    float4 ShadowMatrix0;
-    float4 ShadowMatrix1;
-    float4 ShadowMatrix2;
-};
-
-struct CB0
-{
-    Globals CB0;
-};
-
-struct Params
-{
-    float4 LqmatFarTilingFactor;
-};
-
-struct CB2
-{
-    Params CB2;
-};
-
-constant VertexOutput _121 = {};
-constant SurfaceInput _122 = {};
-constant float2 _123 = {};
-constant float4 _124 = {};
-constant Surface _125 = {};
-constant float4 _192 = {};
-constant float4 _219 = {};
-constant float4 _297 = {};
-
-struct main0_out
-{
-    float4 _entryPointOutput [[color(0)]];
-};
-
-struct main0_in
-{
-    float4 IN_Uv_EdgeDistance1 [[user(locn0)]];
-    float4 IN_UvStuds_EdgeDistance2 [[user(locn1)]];
-    float4 IN_Color [[user(locn2)]];
-    float4 IN_LightPosition_Fog [[user(locn3)]];
-    float4 IN_View_Depth [[user(locn4)]];
-    float4 IN_Normal_SpecPower [[user(locn5)]];
-    float3 IN_Tangent [[user(locn6)]];
-    float4 IN_PosLightSpace_Reflectance [[user(locn7)]];
-    float IN_studIndex [[user(locn8)]];
-};
-
-fragment main0_out main0(main0_in in [[stage_in]], constant CB0& _19 [[buffer(0)]], texture3d<float> LightMapTexture [[texture(0)]], texture2d<float> ShadowMapTexture [[texture(1)]], texturecube<float> EnvironmentMapTexture [[texture(2)]], texture2d<float> DiffuseMapTexture [[texture(3)]], texture2d<float> NormalMapTexture [[texture(4)]], texture2d<float> NormalDetailMapTexture [[texture(5)]], texture2d<float> StudsMapTexture [[texture(6)]], texture2d<float> SpecularMapTexture [[texture(7)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], sampler NormalMapSampler [[sampler(4)]], sampler NormalDetailMapSampler [[sampler(5)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], float4 gl_FragCoord [[position]])
-{
-    main0_out out = {};
-    VertexOutput _128 = _121;
-    _128.HPosition = gl_FragCoord;
-    VertexOutput _130 = _128;
-    _130.Uv_EdgeDistance1 = in.IN_Uv_EdgeDistance1;
-    VertexOutput _132 = _130;
-    _132.UvStuds_EdgeDistance2 = in.IN_UvStuds_EdgeDistance2;
-    VertexOutput _134 = _132;
-    _134.Color = in.IN_Color;
-    VertexOutput _136 = _134;
-    _136.LightPosition_Fog = in.IN_LightPosition_Fog;
-    VertexOutput _138 = _136;
-    _138.View_Depth = in.IN_View_Depth;
-    VertexOutput _140 = _138;
-    _140.Normal_SpecPower = in.IN_Normal_SpecPower;
-    VertexOutput _142 = _140;
-    _142.Tangent = in.IN_Tangent;
-    VertexOutput _144 = _142;
-    _144.PosLightSpace_Reflectance = in.IN_PosLightSpace_Reflectance;
-    VertexOutput _146 = _144;
-    _146.studIndex = in.IN_studIndex;
-    SurfaceInput _147 = _122;
-    _147.Color = in.IN_Color;
-    SurfaceInput _149 = _147;
-    _149.Uv = in.IN_Uv_EdgeDistance1.xy;
-    SurfaceInput _151 = _149;
-    _151.UvStuds = in.IN_UvStuds_EdgeDistance2.xy;
-    SurfaceInput _156 = _151;
-    _156.UvStuds.y = (fract(_151.UvStuds.y) + in.IN_studIndex) * 0.25;
-    float _163 = _146.View_Depth.w * _19.CB0.RefractionBias_FadeDistance_GlowFactor.y;
-    float _165 = fast::clamp(1.0 - _163, 0.0, 1.0);
-    float2 _166 = in.IN_Uv_EdgeDistance1.xy * 1.0;
-    bool _173;
-    float4 _193;
-    for (;;)
-    {
-        _173 = 0.0 == 0.0;
-        if (_173)
-        {
-            _193 = DiffuseMapTexture.sample(DiffuseMapSampler, _166);
-            break;
-        }
-        else
-        {
-            float _180 = 1.0 / (1.0 - 0.0);
-            _193 = mix(DiffuseMapTexture.sample(DiffuseMapSampler, (_166 * 0.25)), DiffuseMapTexture.sample(DiffuseMapSampler, _166), float4(fast::clamp((fast::clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
-            break;
-        }
-        _193 = _192;
-        break;
-    }
-    float4 _220;
-    for (;;)
-    {
-        if (_173)
-        {
-            _220 = NormalMapTexture.sample(NormalMapSampler, _166);
-            break;
-        }
-        else
-        {
-            float _207 = 1.0 / (1.0 - 0.0);
-            _220 = mix(NormalMapTexture.sample(NormalMapSampler, (_166 * 0.25)), NormalMapTexture.sample(NormalMapSampler, _166), float4(fast::clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
-            break;
-        }
-        _220 = _219;
-        break;
-    }
-    float2 _223 = float2(1.0);
-    float2 _224 = (_220.wy * 2.0) - _223;
-    float3 _232 = float3(_224, sqrt(fast::clamp(1.0 + dot(-_224, _224), 0.0, 1.0)));
-    float2 _240 = (NormalDetailMapTexture.sample(NormalDetailMapSampler, (_166 * 0.0)).wy * 2.0) - _223;
-    float2 _252 = _232.xy + (float3(_240, sqrt(fast::clamp(1.0 + dot(-_240, _240), 0.0, 1.0))).xy * 0.0);
-    float3 _253 = float3(_252.x, _252.y, _232.z);
-    float2 _255 = _253.xy * _165;
-    float3 _256 = float3(_255.x, _255.y, _253.z);
-    float3 _271 = ((in.IN_Color.xyz * (_193 * 1.0).xyz) * (1.0 + (_256.x * 0.300000011920928955078125))) * (StudsMapTexture.sample(StudsMapSampler, _156.UvStuds).x * 2.0);
-    float4 _298;
-    for (;;)
-    {
-        if (0.75 == 0.0)
-        {
-            _298 = SpecularMapTexture.sample(SpecularMapSampler, _166);
-            break;
-        }
-        else
-        {
-            float _285 = 1.0 / (1.0 - 0.75);
-            _298 = mix(SpecularMapTexture.sample(SpecularMapSampler, (_166 * 0.25)), SpecularMapTexture.sample(SpecularMapSampler, _166), float4(fast::clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
-            break;
-        }
-        _298 = _297;
-        break;
-    }
-    float2 _303 = mix(float2(0.800000011920928955078125, 120.0), (_298.xy * float2(2.0, 256.0)) + float2(0.0, 0.00999999977648258209228515625), float2(_165));
-    Surface _304 = _125;
-    _304.albedo = _271;
-    Surface _305 = _304;
-    _305.normal = _256;
-    float _306 = _303.x;
-    Surface _307 = _305;
-    _307.specular = _306;
-    float _308 = _303.y;
-    Surface _309 = _307;
-    _309.gloss = _308;
-    float _312 = (_298.xy.y * _165) * 0.0;
-    Surface _313 = _309;
-    _313.reflectance = _312;
-    float4 _318 = float4(_271, _146.Color.w);
-    float3 _329 = normalize(((in.IN_Tangent * _313.normal.x) + (cross(in.IN_Normal_SpecPower.xyz, in.IN_Tangent) * _313.normal.y)) + (in.IN_Normal_SpecPower.xyz * _313.normal.z));
-    float3 _332 = -_19.CB0.Lamp0Dir;
-    float _333 = dot(_329, _332);
-    float _357 = fast::clamp(dot(step(_19.CB0.LightConfig3.xyz, abs(in.IN_LightPosition_Fog.xyz - _19.CB0.LightConfig2.xyz)), float3(1.0)), 0.0, 1.0);
-    float4 _368 = mix(LightMapTexture.sample(LightMapSampler, (in.IN_LightPosition_Fog.xyz.yzx - (in.IN_LightPosition_Fog.xyz.yzx * _357))), _19.CB0.LightBorder, float4(_357));
-    float2 _376 = ShadowMapTexture.sample(ShadowMapSampler, in.IN_PosLightSpace_Reflectance.xyz.xy).xy;
-    float _392 = (1.0 - (((step(_376.x, in.IN_PosLightSpace_Reflectance.xyz.z) * fast::clamp(9.0 - (20.0 * abs(in.IN_PosLightSpace_Reflectance.xyz.z - 0.5)), 0.0, 1.0)) * _376.y) * _19.CB0.OutlineBrightness_ShadowInfo.w)) * _368.w;
-    float3 _403 = mix(_318.xyz, EnvironmentMapTexture.sample(EnvironmentMapSampler, reflect(-in.IN_View_Depth.xyz, _329)).xyz, float3(_312));
-    float4 _404 = float4(_403.x, _403.y, _403.z, _318.w);
-    float3 _422 = (((_19.CB0.AmbientColor + (((_19.CB0.Lamp0Color * fast::clamp(_333, 0.0, 1.0)) + (_19.CB0.Lamp1Color * fast::max(-_333, 0.0))) * _392)) + _368.xyz) * _404.xyz) + (_19.CB0.Lamp0Color * (((step(0.0, _333) * _306) * _392) * pow(fast::clamp(dot(_329, normalize(_332 + normalize(in.IN_View_Depth.xyz))), 0.0, 1.0), _308)));
-    float4 _425 = float4(_422.x, _422.y, _422.z, _124.w);
-    _425.w = _404.w;
-    float2 _435 = fast::min(in.IN_Uv_EdgeDistance1.wz, in.IN_UvStuds_EdgeDistance2.wz);
-    float _439 = fast::min(_435.x, _435.y) / _163;
-    float3 _445 = _425.xyz * fast::clamp((fast::clamp((_163 * _19.CB0.OutlineBrightness_ShadowInfo.x) + _19.CB0.OutlineBrightness_ShadowInfo.y, 0.0, 1.0) * (1.5 - _439)) + _439, 0.0, 1.0);
-    float4 _446 = float4(_445.x, _445.y, _445.z, _425.w);
-    float3 _453 = mix(_19.CB0.FogColor, _446.xyz, float3(fast::clamp(_146.LightPosition_Fog.w, 0.0, 1.0)));
-    out._entryPointOutput = float4(_453.x, _453.y, _453.z, _446.w);
-    return out;
-}
-

+ 4 - 2
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-callstack.msl2.asm.frag

@@ -15,13 +15,15 @@ struct SSBO0
     uint values0[1];
 };
 
-inline void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
+static inline __attribute__((always_inline))
+void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
 {
     int _31 = int(gl_FragCoord.x);
     v_7.values1[_31]++;
 }
 
-inline void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
+static inline __attribute__((always_inline))
+void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
 {
     int _39 = int(gl_FragCoord.x);
     v_9.values0[_39]++;

+ 6 - 3
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-control-flow.msl2.asm.frag

@@ -20,13 +20,15 @@ struct SSBO0
     uint values0[1];
 };
 
-inline void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
+static inline __attribute__((always_inline))
+void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
 {
     int _44 = int(gl_FragCoord.x);
     v_7.values1[_44]++;
 }
 
-inline void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
+static inline __attribute__((always_inline))
+void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
 {
     int _52 = int(gl_FragCoord.x);
     v_9.values0[_52]++;
@@ -36,7 +38,8 @@ inline void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0&
     }
 }
 
-inline void _35(thread float4& gl_FragCoord, device _12& v_13)
+static inline __attribute__((always_inline))
+void _35(thread float4& gl_FragCoord, device _12& v_13)
 {
     v_13._m0[int(gl_FragCoord.x)] = 4u;
 }

+ 8 - 4
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/pixel-interlock-split-functions.msl2.asm.frag

@@ -15,24 +15,28 @@ struct SSBO0
     uint values0[1];
 };
 
-inline void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
+static inline __attribute__((always_inline))
+void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
 {
     int _37 = int(gl_FragCoord.x);
     v_7.values1[_37]++;
 }
 
-inline void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
+static inline __attribute__((always_inline))
+void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
 {
     int _45 = int(gl_FragCoord.x);
     v_9.values0[_45]++;
     callee2(gl_FragCoord, v_7);
 }
 
-inline void _29()
+static inline __attribute__((always_inline))
+void _29()
 {
 }
 
-inline void _31()
+static inline __attribute__((always_inline))
+void _31()
 {
 }
 

+ 2 - 1
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/frag/texture-access.swizzle.asm.frag

@@ -6,7 +6,8 @@
 using namespace metal;
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 1 - 4
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/vert/empty-struct-composite.asm.vert

@@ -5,12 +5,9 @@ using namespace metal;
 
 struct Test
 {
-    int empty_struct_member;
 };
-
 vertex void main0()
 {
-    Test _14 = Test{ 0 };
-    Test t = _14;
+    Test t = Test{  };
 }
 

+ 42 - 1
3rdparty/spirv-cross/reference/shaders-msl-no-opt/asm/vert/op-load-forced-temporary-array.asm.frag

@@ -1,8 +1,49 @@
+#pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 constant float _21 = {};
 
 struct main0_out
@@ -13,7 +54,7 @@ struct main0_out
 vertex main0_out main0()
 {
     main0_out out = {};
-    float _23[2];
+    spvUnsafeArray<float, 2> _23;
     for (int _25 = 0; _25 < 2; )
     {
         _23[_25] = 0.0;

+ 43 - 4
3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/array-copy-threadgroup-memory.comp

@@ -1,10 +1,49 @@
 #pragma clang diagnostic ignored "-Wmissing-prototypes"
+#pragma clang diagnostic ignored "-Wmissing-braces"
 
 #include <metal_stdlib>
 #include <simd/simd.h>
 
 using namespace metal;
 
+template<typename T, size_t Num>
+struct spvUnsafeArray
+{
+    T elements[Num ? Num : 1];
+    
+    thread T& operator [] (size_t pos) thread
+    {
+        return elements[pos];
+    }
+    constexpr const thread T& operator [] (size_t pos) const thread
+    {
+        return elements[pos];
+    }
+    
+    device T& operator [] (size_t pos) device
+    {
+        return elements[pos];
+    }
+    constexpr const device T& operator [] (size_t pos) const device
+    {
+        return elements[pos];
+    }
+    
+    constexpr const constant T& operator [] (size_t pos) const constant
+    {
+        return elements[pos];
+    }
+    
+    threadgroup T& operator [] (size_t pos) threadgroup
+    {
+        return elements[pos];
+    }
+    constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
+    {
+        return elements[pos];
+    }
+};
+
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 1u, 1u);
 
 template<typename T, uint A>
@@ -65,15 +104,15 @@ 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];
+    spvUnsafeArray<float, 8> blob;
     for (int i = 0; i < 8; i++)
     {
         blob[i] = float(i);
     }
-    spvArrayCopyFromStackToThreadGroup1(shared_group[gl_LocalInvocationIndex], blob);
+    spvArrayCopyFromStackToThreadGroup1(shared_group[gl_LocalInvocationIndex], blob.elements);
     threadgroup_barrier(mem_flags::mem_threadgroup);
-    float copied_blob[8];
-    spvArrayCopyFromThreadGroupToStack1(copied_blob, shared_group[gl_LocalInvocationIndex ^ 1u]);
+    spvUnsafeArray<float, 8> copied_blob;
+    spvArrayCopyFromThreadGroupToStack1(copied_blob.elements, shared_group[gl_LocalInvocationIndex ^ 1u]);
     spvArrayCopyFromThreadGroupToThreadGroup1(shared_group_alt[gl_LocalInvocationIndex], shared_group[gl_LocalInvocationIndex]);
 }
 

+ 10 - 5
3rdparty/spirv-cross/reference/shaders-msl-no-opt/comp/glsl.std450.comp

@@ -70,20 +70,23 @@ inline T sign(T x)
 }
 
 // Returns the determinant of a 2x2 matrix.
-inline float spvDet2x2(float a1, float a2, float b1, float b2)
+static inline __attribute__((always_inline))
+float spvDet2x2(float a1, float a2, float b1, float b2)
 {
     return a1 * b2 - b1 * a2;
 }
 
 // Returns the determinant of a 3x3 matrix.
-inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
+static inline __attribute__((always_inline))
+float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
 {
     return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3);
 }
 
 // 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.
-inline float4x4 spvInverse4x4(float4x4 m)
+static inline __attribute__((always_inline))
+float4x4 spvInverse4x4(float4x4 m)
 {
     float4x4 adj;	// The adjoint matrix (inverse after dividing by determinant)
 
@@ -118,7 +121,8 @@ inline 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.
-inline float3x3 spvInverse3x3(float3x3 m)
+static inline __attribute__((always_inline))
+float3x3 spvInverse3x3(float3x3 m)
 {
     float3x3 adj;	// The adjoint matrix (inverse after dividing by determinant)
 
@@ -145,7 +149,8 @@ inline 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.
-inline float2x2 spvInverse2x2(float2x2 m)
+static inline __attribute__((always_inline))
+float2x2 spvInverse2x2(float2x2 m)
 {
     float2x2 adj;	// The adjoint matrix (inverse after dividing by determinant)
 

+ 4 - 2
3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/pixel-interlock-simple-callstack.msl2.frag

@@ -15,13 +15,15 @@ struct SSBO0
     uint values0[1];
 };
 
-inline void callee2(device SSBO1& v_14, thread float4& gl_FragCoord)
+static inline __attribute__((always_inline))
+void callee2(device SSBO1& v_14, thread float4& gl_FragCoord)
 {
     int _25 = int(gl_FragCoord.x);
     v_14.values1[_25]++;
 }
 
-inline void callee(device SSBO1& v_14, thread float4& gl_FragCoord, device SSBO0& v_35)
+static inline __attribute__((always_inline))
+void callee(device SSBO1& v_14, thread float4& gl_FragCoord, device SSBO0& v_35)
 {
     int _38 = int(gl_FragCoord.x);
     v_35.values0[_38]++;

+ 2 - 1
3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-int.swizzle.frag

@@ -6,7 +6,8 @@
 using namespace metal;
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 4 - 2
3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-leaf.swizzle.frag

@@ -6,7 +6,8 @@
 using namespace metal;
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }
@@ -131,7 +132,8 @@ inline vec<T, 4> spvGatherCompareSwizzle(const thread Tex<T>& t, sampler s, uint
     return t.gather_compare(s, spvForward<Ts>(params)...);
 }
 
-inline float4 doSwizzle(thread texture1d<float> tex1d, thread const sampler tex1dSmplr, constant uint& tex1dSwzl, thread texture2d<float> tex2d, thread const sampler tex2dSmplr, constant uint& tex2dSwzl, thread texture3d<float> tex3d, thread const sampler tex3dSmplr, constant uint& tex3dSwzl, thread texturecube<float> texCube, thread const sampler texCubeSmplr, constant uint& texCubeSwzl, thread texture2d_array<float> tex2dArray, thread const sampler tex2dArraySmplr, constant uint& tex2dArraySwzl, thread texturecube_array<float> texCubeArray, thread const sampler texCubeArraySmplr, constant uint& texCubeArraySwzl, thread depth2d<float> depth2d, thread const sampler depth2dSmplr, constant uint& depth2dSwzl, thread depthcube<float> depthCube, thread const sampler depthCubeSmplr, constant uint& depthCubeSwzl, thread depth2d_array<float> depth2dArray, thread const sampler depth2dArraySmplr, constant uint& depth2dArraySwzl, thread depthcube_array<float> depthCubeArray, thread const sampler depthCubeArraySmplr, constant uint& depthCubeArraySwzl, thread texture2d<float> texBuffer)
+static inline __attribute__((always_inline))
+float4 doSwizzle(thread texture1d<float> tex1d, thread const sampler tex1dSmplr, constant uint& tex1dSwzl, thread texture2d<float> tex2d, thread const sampler tex2dSmplr, constant uint& tex2dSwzl, thread texture3d<float> tex3d, thread const sampler tex3dSmplr, constant uint& tex3dSwzl, thread texturecube<float> texCube, thread const sampler texCubeSmplr, constant uint& texCubeSwzl, thread texture2d_array<float> tex2dArray, thread const sampler tex2dArraySmplr, constant uint& tex2dArraySwzl, thread texturecube_array<float> texCubeArray, thread const sampler texCubeArraySmplr, constant uint& texCubeArraySwzl, thread depth2d<float> depth2d, thread const sampler depth2dSmplr, constant uint& depth2dSwzl, thread depthcube<float> depthCube, thread const sampler depthCubeSmplr, constant uint& depthCubeSwzl, thread depth2d_array<float> depth2dArray, thread const sampler depth2dArraySmplr, constant uint& depth2dArraySwzl, thread depthcube_array<float> depthCubeArray, thread const sampler depthCubeArraySmplr, constant uint& depthCubeArraySwzl, thread texture2d<float> texBuffer)
 {
     float4 c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl);
     c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0)), tex2dSwzl);

+ 2 - 1
3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag

@@ -6,7 +6,8 @@
 using namespace metal;
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 2 - 1
3rdparty/spirv-cross/reference/shaders-msl-no-opt/frag/texture-access.swizzle.frag

@@ -6,7 +6,8 @@
 using namespace metal;
 
 // Returns 2D texture coords corresponding to 1D texel buffer coords
-inline uint2 spvTexelBufferCoord(uint tc)
+static inline __attribute__((always_inline))
+uint2 spvTexelBufferCoord(uint tc)
 {
     return uint2(tc % 4096, tc / 4096);
 }

+ 17 - 0
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec3.comp

@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct SSBO
+{
+    packed_float3 v[16];
+};
+
+constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
+
+kernel void main0(device SSBO& _13 [[buffer(0)]])
+{
+    _13.v[1] = float3(_13.v[0]);
+}
+

+ 17 - 0
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/array-of-vec4.comp

@@ -0,0 +1,17 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct SSBO
+{
+    float4 v[16];
+};
+
+constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
+
+kernel void main0(device SSBO& _13 [[buffer(0)]])
+{
+    _13.v[1] = _13.v[0];
+}
+

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-scalar.comp

@@ -19,46 +19,54 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void load_store_to_variable_col_major(device SSBOCol& v_29)
 {
     float2x2 loaded = v_29.col_major0;
     v_29.col_major1 = loaded;
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void copy_col_major_to_col_major(device SSBOCol& v_29)
 {
     v_29.col_major0 = v_29.col_major1;
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_inline))
+void copy_row_major_to_row_major(device SSBORow& v_41)
 {
     v_41.row_major0 = v_41.row_major1;
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std140.comp

@@ -19,52 +19,60 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_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];
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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]);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_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];
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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]);
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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]);
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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];
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x2-std430.comp

@@ -19,46 +19,54 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void load_store_to_variable_col_major(device SSBOCol& v_29)
 {
     float2x2 loaded = v_29.col_major0;
     v_29.col_major1 = loaded;
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void copy_col_major_to_col_major(device SSBOCol& v_29)
 {
     v_29.col_major0 = v_29.col_major1;
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_inline))
+void copy_row_major_to_row_major(device SSBORow& v_41)
 {
     v_41.row_major0 = v_41.row_major1;
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-scalar.comp

@@ -21,42 +21,49 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_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];
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_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];
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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])));
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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]);
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_inline))
+void copy_row_major_to_row_major(device SSBORow& v_41)
 {
     v_41.row_major0 = v_41.row_major1;
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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];
@@ -64,7 +71,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
     v_41.row_major0[2][1] = v_29.col_major0[1][2];
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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];

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std140.comp

@@ -19,13 +19,15 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void load_store_to_variable_col_major(device SSBOCol& v_29)
 {
     float2x3 loaded = v_29.col_major0;
     v_29.col_major1 = loaded;
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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]);
@@ -33,31 +35,36 @@ inline void load_store_to_variable_row_major(device SSBORow& v_41)
     v_41.row_major0[2].xy = float2(loaded[0][2], loaded[1][2]);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void copy_col_major_to_col_major(device SSBOCol& v_29)
 {
     v_29.col_major0 = v_29.col_major1;
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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]);
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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));
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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];
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;
@@ -65,7 +72,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
     v_41.row_major0[2][1] = v_29.col_major0[1].z;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x3-std430.comp

@@ -19,39 +19,46 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void load_store_to_variable_col_major(device SSBOCol& v_29)
 {
     float2x3 loaded = v_29.col_major0;
     v_29.col_major1 = loaded;
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void copy_col_major_to_col_major(device SSBOCol& v_29)
 {
     v_29.col_major0 = v_29.col_major1;
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_inline))
+void copy_row_major_to_row_major(device SSBORow& v_41)
 {
     v_41.row_major0 = v_41.row_major1;
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;
@@ -59,7 +66,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
     v_41.row_major0[2][1] = v_29.col_major0[1].z;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-scalar.comp

@@ -19,39 +19,46 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void load_store_to_variable_col_major(device SSBOCol& v_29)
 {
     float2x4 loaded = v_29.col_major0;
     v_29.col_major1 = loaded;
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void copy_col_major_to_col_major(device SSBOCol& v_29)
 {
     v_29.col_major0 = v_29.col_major1;
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_inline))
+void copy_row_major_to_row_major(device SSBORow& v_41)
 {
     v_41.row_major0 = v_41.row_major1;
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;
@@ -60,7 +67,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
     v_41.row_major0[3][1] = v_29.col_major0[1].w;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std140.comp

@@ -19,13 +19,15 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void load_store_to_variable_col_major(device SSBOCol& v_29)
 {
     float2x4 loaded = v_29.col_major0;
     v_29.col_major1 = loaded;
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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]);
@@ -34,12 +36,14 @@ inline void load_store_to_variable_row_major(device SSBORow& v_41)
     v_41.row_major0[3].xy = float2(loaded[0][3], loaded[1][3]);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void copy_col_major_to_col_major(device SSBOCol& v_29)
 {
     v_29.col_major0 = v_29.col_major1;
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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]);
@@ -47,12 +51,14 @@ inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_
     v_41.row_major0[3].xy = float2(v_29.col_major0[0][3], v_29.col_major0[1][3]);
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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));
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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];
@@ -60,7 +66,8 @@ inline 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];
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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 +76,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
     v_41.row_major0[3][1] = v_29.col_major0[1].w;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-2x4-std430.comp

@@ -19,39 +19,46 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void load_store_to_variable_col_major(device SSBOCol& v_29)
 {
     float2x4 loaded = v_29.col_major0;
     v_29.col_major1 = loaded;
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void copy_col_major_to_col_major(device SSBOCol& v_29)
 {
     v_29.col_major0 = v_29.col_major1;
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_inline))
+void copy_row_major_to_row_major(device SSBORow& v_41)
 {
     v_41.row_major0 = v_41.row_major1;
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;
@@ -60,7 +67,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
     v_41.row_major0[3][1] = v_29.col_major0[1].w;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-scalar.comp

@@ -21,49 +21,57 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void load_store_to_variable_col_major(device SSBOCol& v_29)
 {
     float3x2 loaded = v_29.col_major0;
     v_29.col_major1 = loaded;
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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]);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_inline))
+void copy_col_major_to_col_major(device SSBOCol& v_29)
 {
     v_29.col_major0 = v_29.col_major1;
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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]);
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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])));
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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];
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

+ 16 - 8
3rdparty/spirv-cross/reference/shaders-msl-no-opt/packing/matrix-3x2-std140.comp

@@ -19,7 +19,8 @@ struct SSBORow
 
 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
 
-inline void load_store_to_variable_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_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];
@@ -27,44 +28,51 @@ inline void load_store_to_variable_col_major(device SSBOCol& v_29)
     v_29.col_major1[2].xy = loaded[2];
 }
 
-inline void load_store_to_variable_row_major(device SSBORow& v_41)
+static inline __attribute__((always_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);
 }
 
-inline void copy_col_major_to_col_major(device SSBOCol& v_29)
+static inline __attribute__((always_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];
 }
 
-inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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));
 }
 
-inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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]);
 }
 
-inline void copy_row_major_to_row_major(device SSBORow& v_41)
+static inline __attribute__((always_inline))
+void copy_row_major_to_row_major(device SSBORow& v_41)
 {
     v_41.row_major0 = v_41.row_major1;
 }
 
-inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;
 }
 
-inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
+static inline __attribute__((always_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;

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini