summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag')
-rw-r--r--3rdparty/bgfx/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag99
1 files changed, 42 insertions, 57 deletions
diff --git a/3rdparty/bgfx/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag b/3rdparty/bgfx/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag
index 428a9bf244f..41193536e69 100644
--- a/3rdparty/bgfx/3rdparty/spirv-cross/reference/shaders-msl/asm/frag/lut-promotion-initializer.asm.frag
+++ b/3rdparty/bgfx/3rdparty/spirv-cross/reference/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)
@@ -100,7 +85,7 @@ fragment main0_out main0(main0_in in [[stage_in]])
foobar[1].z = 20.0;
}
out.FragColor += foobar[in.index & 3].z;
- spvArrayCopyFromConstantToStack1(baz, _90);
+ baz = _90;
out.FragColor += baz[in.index & 3].z;
return out;
}