#pragma clang diagnostic ignored "-Wmissing-prototypes" #pragma clang diagnostic ignored "-Wmissing-braces" #include #include using namespace metal; template 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 Uniforms { float4x4 projection; float dpi_scale; uint mode; float2 _pad0; }; struct Gaussian_Blur_Primitive { float4 bounds; float4 radii; float2 half_size; float half_feather; uint color; }; struct Gaussian_Blur_Primitive_1 { float4 bounds; float4 radii; float2 half_size; float half_feather; uint color; }; struct Gaussian_Blur_Primitives { Gaussian_Blur_Primitive_1 primitives[1]; }; constant spvUnsafeArray _97 = spvUnsafeArray({ float2(0.0), float2(1.0, 0.0), float2(0.0, 1.0), float2(0.0, 1.0), float2(1.0, 0.0), float2(1.0) }); struct main0_out { float2 p_local [[user(locn0)]]; float4 f_color [[user(locn1)]]; float2 f_half_size [[user(locn2)]]; float4 f_radii [[user(locn3)]]; float f_half_feather [[user(locn4)]]; float4 gl_Position [[position]]; }; vertex main0_out main0(constant Uniforms& _13 [[buffer(0)]], const device Gaussian_Blur_Primitives& _69 [[buffer(1)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]]) { main0_out out = {}; if (_13.mode == 0u) { float2 ndc = float2((int(gl_VertexIndex) == 1) ? 3.0 : (-1.0), (int(gl_VertexIndex) == 2) ? 3.0 : (-1.0)); out.gl_Position = float4(ndc, 0.0, 1.0); out.p_local = float2(0.0); out.f_color = float4(0.0); out.f_half_size = float2(0.0); out.f_radii = float4(0.0); out.f_half_feather = 0.0; } else { Gaussian_Blur_Primitive p; p.bounds = _69.primitives[int(gl_InstanceIndex)].bounds; p.radii = _69.primitives[int(gl_InstanceIndex)].radii; p.half_size = _69.primitives[int(gl_InstanceIndex)].half_size; p.half_feather = _69.primitives[int(gl_InstanceIndex)].half_feather; p.color = _69.primitives[int(gl_InstanceIndex)].color; float2 corner = _97[int(gl_VertexIndex)]; float2 world_pos = mix(p.bounds.xy, p.bounds.zw, corner); float2 center = (p.bounds.xy + p.bounds.zw) * 0.5; out.p_local = (world_pos - center) * _13.dpi_scale; out.f_color = unpack_unorm4x8_to_float(p.color); out.f_half_size = p.half_size; out.f_radii = p.radii; out.f_half_feather = p.half_feather; out.gl_Position = _13.projection * float4(world_pos * _13.dpi_scale, 0.0, 1.0); } return out; }