95 lines
2.5 KiB
GLSL
95 lines
2.5 KiB
GLSL
#pragma clang diagnostic ignored "-Wmissing-braces"
|
|
#pragma clang diagnostic ignored "-Wunused-variable"
|
|
|
|
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
template <typename T, size_t Num>
|
|
struct unsafe_array
|
|
{
|
|
T __Elements[Num ? Num : 1];
|
|
|
|
constexpr size_t size() const thread { return Num; }
|
|
constexpr size_t max_size() const thread { return Num; }
|
|
constexpr bool empty() const thread { return Num == 0; }
|
|
|
|
constexpr size_t size() const device { return Num; }
|
|
constexpr size_t max_size() const device { return Num; }
|
|
constexpr bool empty() const device { return Num == 0; }
|
|
|
|
constexpr size_t size() const constant { return Num; }
|
|
constexpr size_t max_size() const constant { return Num; }
|
|
constexpr bool empty() const constant { return Num == 0; }
|
|
|
|
constexpr size_t size() const threadgroup { return Num; }
|
|
constexpr size_t max_size() const threadgroup { return Num; }
|
|
constexpr bool empty() const threadgroup { return Num == 0; }
|
|
|
|
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];
|
|
}
|
|
};
|
|
|
|
using namespace metal;
|
|
|
|
constant int _7_tmp [[function_constant(201)]];
|
|
constant int _7 = is_function_constant_defined(_7_tmp) ? _7_tmp : -10;
|
|
constant int _20 = (_7 + 2);
|
|
constant uint _8_tmp [[function_constant(202)]];
|
|
constant uint _8 = is_function_constant_defined(_8_tmp) ? _8_tmp : 100u;
|
|
constant uint _25 = (_8 % 5u);
|
|
constant int4 _30 = int4(20, 30, _20, _20);
|
|
constant int2 _32 = int2(_30.y, _30.x);
|
|
constant int _33 = _30.y;
|
|
constant float _9_tmp [[function_constant(200)]];
|
|
constant float _9 = is_function_constant_defined(_9_tmp) ? _9_tmp : 3.141590118408203125;
|
|
|
|
struct main0_out
|
|
{
|
|
int m_4 [[user(locn0)]];
|
|
float4 gl_Position [[position]];
|
|
};
|
|
|
|
vertex main0_out main0()
|
|
{
|
|
main0_out out = {};
|
|
float4 pos = float4(0.0);
|
|
pos.y += float(_20);
|
|
pos.z += float(_25);
|
|
pos += float4(_30);
|
|
float2 _56 = pos.xy + float2(_32);
|
|
pos = float4(_56.x, _56.y, pos.z, pos.w);
|
|
out.gl_Position = pos;
|
|
out.m_4 = _33;
|
|
return out;
|
|
}
|
|
|