| #include <metal_stdlib> |
| |
| using namespace metal; |
| |
| template<typename T, size_t N> |
| struct tint_array { |
| const constant T& operator[](size_t i) const constant { return elements[i]; } |
| device T& operator[](size_t i) device { return elements[i]; } |
| const device T& operator[](size_t i) const device { return elements[i]; } |
| thread T& operator[](size_t i) thread { return elements[i]; } |
| const thread T& operator[](size_t i) const thread { return elements[i]; } |
| threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } |
| const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } |
| T elements[N]; |
| }; |
| |
| struct tint_packed_vec3_f32_array_element { |
| /* 0x0000 */ packed_float3 elements; |
| /* 0x000c */ tint_array<int8_t, 4> tint_pad; |
| }; |
| |
| struct tint_packed_vec3_f16_array_element { |
| /* 0x0000 */ packed_half3 elements; |
| /* 0x0006 */ tint_array<int8_t, 2> tint_pad_1; |
| }; |
| |
| struct Inner { |
| /* 0x0000 */ int scalar_i32; |
| /* 0x0004 */ float scalar_f32; |
| /* 0x0008 */ half scalar_f16; |
| /* 0x000a */ tint_array<int8_t, 6> tint_pad_2; |
| }; |
| |
| struct S_tint_packed_vec3 { |
| /* 0x0000 */ float scalar_f32; |
| /* 0x0004 */ int scalar_i32; |
| /* 0x0008 */ uint scalar_u32; |
| /* 0x000c */ half scalar_f16; |
| /* 0x000e */ tint_array<int8_t, 2> tint_pad_3; |
| /* 0x0010 */ float2 vec2_f32; |
| /* 0x0018 */ int2 vec2_i32; |
| /* 0x0020 */ uint2 vec2_u32; |
| /* 0x0028 */ half2 vec2_f16; |
| /* 0x002c */ tint_array<int8_t, 4> tint_pad_4; |
| /* 0x0030 */ packed_float3 vec3_f32; |
| /* 0x003c */ tint_array<int8_t, 4> tint_pad_5; |
| /* 0x0040 */ packed_int3 vec3_i32; |
| /* 0x004c */ tint_array<int8_t, 4> tint_pad_6; |
| /* 0x0050 */ packed_uint3 vec3_u32; |
| /* 0x005c */ tint_array<int8_t, 4> tint_pad_7; |
| /* 0x0060 */ packed_half3 vec3_f16; |
| /* 0x0066 */ tint_array<int8_t, 10> tint_pad_8; |
| /* 0x0070 */ float4 vec4_f32; |
| /* 0x0080 */ int4 vec4_i32; |
| /* 0x0090 */ uint4 vec4_u32; |
| /* 0x00a0 */ half4 vec4_f16; |
| /* 0x00a8 */ float2x2 mat2x2_f32; |
| /* 0x00b8 */ tint_array<int8_t, 8> tint_pad_9; |
| /* 0x00c0 */ tint_array<tint_packed_vec3_f32_array_element, 2> mat2x3_f32; |
| /* 0x00e0 */ float2x4 mat2x4_f32; |
| /* 0x0100 */ float3x2 mat3x2_f32; |
| /* 0x0118 */ tint_array<int8_t, 8> tint_pad_10; |
| /* 0x0120 */ tint_array<tint_packed_vec3_f32_array_element, 3> mat3x3_f32; |
| /* 0x0150 */ float3x4 mat3x4_f32; |
| /* 0x0180 */ float4x2 mat4x2_f32; |
| /* 0x01a0 */ tint_array<tint_packed_vec3_f32_array_element, 4> mat4x3_f32; |
| /* 0x01e0 */ float4x4 mat4x4_f32; |
| /* 0x0220 */ half2x2 mat2x2_f16; |
| /* 0x0228 */ tint_array<tint_packed_vec3_f16_array_element, 2> mat2x3_f16; |
| /* 0x0238 */ half2x4 mat2x4_f16; |
| /* 0x0248 */ half3x2 mat3x2_f16; |
| /* 0x0254 */ tint_array<int8_t, 4> tint_pad_11; |
| /* 0x0258 */ tint_array<tint_packed_vec3_f16_array_element, 3> mat3x3_f16; |
| /* 0x0270 */ half3x4 mat3x4_f16; |
| /* 0x0288 */ half4x2 mat4x2_f16; |
| /* 0x0298 */ tint_array<tint_packed_vec3_f16_array_element, 4> mat4x3_f16; |
| /* 0x02b8 */ half4x4 mat4x4_f16; |
| /* 0x02d8 */ tint_array<int8_t, 8> tint_pad_12; |
| /* 0x02e0 */ tint_array<tint_packed_vec3_f32_array_element, 2> arr2_vec3_f32; |
| /* 0x0300 */ tint_array<half4x2, 2> arr2_mat4x2_f16; |
| /* 0x0320 */ Inner struct_inner; |
| /* 0x0330 */ tint_array<Inner, 4> array_struct_inner; |
| }; |
| |
| float2x3 tint_unpack_vec3_in_composite(tint_array<tint_packed_vec3_f32_array_element, 2> in) { |
| float2x3 result = float2x3(float3(in[0].elements), float3(in[1].elements)); |
| return result; |
| } |
| |
| float3x3 tint_unpack_vec3_in_composite_1(tint_array<tint_packed_vec3_f32_array_element, 3> in) { |
| float3x3 result = float3x3(float3(in[0].elements), float3(in[1].elements), float3(in[2].elements)); |
| return result; |
| } |
| |
| float4x3 tint_unpack_vec3_in_composite_2(tint_array<tint_packed_vec3_f32_array_element, 4> in) { |
| float4x3 result = float4x3(float3(in[0].elements), float3(in[1].elements), float3(in[2].elements), float3(in[3].elements)); |
| return result; |
| } |
| |
| half2x3 tint_unpack_vec3_in_composite_3(tint_array<tint_packed_vec3_f16_array_element, 2> in) { |
| half2x3 result = half2x3(half3(in[0].elements), half3(in[1].elements)); |
| return result; |
| } |
| |
| half3x3 tint_unpack_vec3_in_composite_4(tint_array<tint_packed_vec3_f16_array_element, 3> in) { |
| half3x3 result = half3x3(half3(in[0].elements), half3(in[1].elements), half3(in[2].elements)); |
| return result; |
| } |
| |
| half4x3 tint_unpack_vec3_in_composite_5(tint_array<tint_packed_vec3_f16_array_element, 4> in) { |
| half4x3 result = half4x3(half3(in[0].elements), half3(in[1].elements), half3(in[2].elements), half3(in[3].elements)); |
| return result; |
| } |
| |
| tint_array<float3, 2> tint_unpack_vec3_in_composite_6(tint_array<tint_packed_vec3_f32_array_element, 2> in) { |
| tint_array<float3, 2> result = tint_array<float3, 2>{float3(in[0].elements), float3(in[1].elements)}; |
| return result; |
| } |
| |
| int tint_ftoi(float v) { |
| return select(2147483647, select(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v <= 2147483520.0f)); |
| } |
| |
| struct S { |
| float scalar_f32; |
| int scalar_i32; |
| uint scalar_u32; |
| half scalar_f16; |
| float2 vec2_f32; |
| int2 vec2_i32; |
| uint2 vec2_u32; |
| half2 vec2_f16; |
| float3 vec3_f32; |
| int3 vec3_i32; |
| uint3 vec3_u32; |
| half3 vec3_f16; |
| float4 vec4_f32; |
| int4 vec4_i32; |
| uint4 vec4_u32; |
| half4 vec4_f16; |
| float2x2 mat2x2_f32; |
| float2x3 mat2x3_f32; |
| float2x4 mat2x4_f32; |
| float3x2 mat3x2_f32; |
| float3x3 mat3x3_f32; |
| float3x4 mat3x4_f32; |
| float4x2 mat4x2_f32; |
| float4x3 mat4x3_f32; |
| float4x4 mat4x4_f32; |
| half2x2 mat2x2_f16; |
| half2x3 mat2x3_f16; |
| half2x4 mat2x4_f16; |
| half3x2 mat3x2_f16; |
| half3x3 mat3x3_f16; |
| half3x4 mat3x4_f16; |
| half4x2 mat4x2_f16; |
| half4x3 mat4x3_f16; |
| half4x4 mat4x4_f16; |
| tint_array<float3, 2> arr2_vec3_f32; |
| tint_array<half4x2, 2> arr2_mat4x2_f16; |
| Inner struct_inner; |
| tint_array<Inner, 4> array_struct_inner; |
| }; |
| |
| kernel void tint_symbol(const constant S_tint_packed_vec3* tint_symbol_1 [[buffer(0)]], device int* tint_symbol_2 [[buffer(1)]]) { |
| float const scalar_f32 = (*(tint_symbol_1)).scalar_f32; |
| int const scalar_i32 = (*(tint_symbol_1)).scalar_i32; |
| uint const scalar_u32 = (*(tint_symbol_1)).scalar_u32; |
| half const scalar_f16 = (*(tint_symbol_1)).scalar_f16; |
| float2 const vec2_f32 = (*(tint_symbol_1)).vec2_f32; |
| int2 const vec2_i32 = (*(tint_symbol_1)).vec2_i32; |
| uint2 const vec2_u32 = (*(tint_symbol_1)).vec2_u32; |
| half2 const vec2_f16 = (*(tint_symbol_1)).vec2_f16; |
| float3 const vec3_f32 = float3((*(tint_symbol_1)).vec3_f32); |
| int3 const vec3_i32 = int3((*(tint_symbol_1)).vec3_i32); |
| uint3 const vec3_u32 = uint3((*(tint_symbol_1)).vec3_u32); |
| half3 const vec3_f16 = half3((*(tint_symbol_1)).vec3_f16); |
| float4 const vec4_f32 = (*(tint_symbol_1)).vec4_f32; |
| int4 const vec4_i32 = (*(tint_symbol_1)).vec4_i32; |
| uint4 const vec4_u32 = (*(tint_symbol_1)).vec4_u32; |
| half4 const vec4_f16 = (*(tint_symbol_1)).vec4_f16; |
| float2x2 const mat2x2_f32 = (*(tint_symbol_1)).mat2x2_f32; |
| float2x3 const mat2x3_f32 = tint_unpack_vec3_in_composite((*(tint_symbol_1)).mat2x3_f32); |
| float2x4 const mat2x4_f32 = (*(tint_symbol_1)).mat2x4_f32; |
| float3x2 const mat3x2_f32 = (*(tint_symbol_1)).mat3x2_f32; |
| float3x3 const mat3x3_f32 = tint_unpack_vec3_in_composite_1((*(tint_symbol_1)).mat3x3_f32); |
| float3x4 const mat3x4_f32 = (*(tint_symbol_1)).mat3x4_f32; |
| float4x2 const mat4x2_f32 = (*(tint_symbol_1)).mat4x2_f32; |
| float4x3 const mat4x3_f32 = tint_unpack_vec3_in_composite_2((*(tint_symbol_1)).mat4x3_f32); |
| float4x4 const mat4x4_f32 = (*(tint_symbol_1)).mat4x4_f32; |
| half2x2 const mat2x2_f16 = (*(tint_symbol_1)).mat2x2_f16; |
| half2x3 const mat2x3_f16 = tint_unpack_vec3_in_composite_3((*(tint_symbol_1)).mat2x3_f16); |
| half2x4 const mat2x4_f16 = (*(tint_symbol_1)).mat2x4_f16; |
| half3x2 const mat3x2_f16 = (*(tint_symbol_1)).mat3x2_f16; |
| half3x3 const mat3x3_f16 = tint_unpack_vec3_in_composite_4((*(tint_symbol_1)).mat3x3_f16); |
| half3x4 const mat3x4_f16 = (*(tint_symbol_1)).mat3x4_f16; |
| half4x2 const mat4x2_f16 = (*(tint_symbol_1)).mat4x2_f16; |
| half4x3 const mat4x3_f16 = tint_unpack_vec3_in_composite_5((*(tint_symbol_1)).mat4x3_f16); |
| half4x4 const mat4x4_f16 = (*(tint_symbol_1)).mat4x4_f16; |
| tint_array<float3, 2> const arr2_vec3_f32 = tint_unpack_vec3_in_composite_6((*(tint_symbol_1)).arr2_vec3_f32); |
| tint_array<half4x2, 2> const arr2_mat4x2_f16 = (*(tint_symbol_1)).arr2_mat4x2_f16; |
| Inner const struct_inner = (*(tint_symbol_1)).struct_inner; |
| tint_array<Inner, 4> const array_struct_inner = (*(tint_symbol_1)).array_struct_inner; |
| *(tint_symbol_2) = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(tint_ftoi(scalar_f32)) + as_type<uint>(scalar_i32)))) + as_type<uint>(int(scalar_u32))))) + as_type<uint>(int(scalar_f16))))) + as_type<uint>(tint_ftoi(vec2_f32[0]))))) + as_type<uint>(vec2_i32[0])))) + as_type<uint>(int(vec2_u32[0]))))) + as_type<uint>(int(vec2_f16[0]))))) + as_type<uint>(tint_ftoi(vec3_f32[1]))))) + as_type<uint>(vec3_i32[1])))) + as_type<uint>(int(vec3_u32[1]))))) + as_type<uint>(int(vec3_f16[1]))))) + as_type<uint>(tint_ftoi(vec4_f32[2]))))) + as_type<uint>(vec4_i32[2])))) + as_type<uint>(int(vec4_u32[2]))))) + as_type<uint>(int(vec4_f16[2]))))) + as_type<uint>(tint_ftoi(mat2x2_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat2x3_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat2x4_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat3x2_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat3x3_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat3x4_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat4x2_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat4x3_f32[0][0]))))) + as_type<uint>(tint_ftoi(mat4x4_f32[0][0]))))) + as_type<uint>(int(mat2x2_f16[0][0]))))) + as_type<uint>(int(mat2x3_f16[0][0]))))) + as_type<uint>(int(mat2x4_f16[0][0]))))) + as_type<uint>(int(mat3x2_f16[0][0]))))) + as_type<uint>(int(mat3x3_f16[0][0]))))) + as_type<uint>(int(mat3x4_f16[0][0]))))) + as_type<uint>(int(mat4x2_f16[0][0]))))) + as_type<uint>(int(mat4x3_f16[0][0]))))) + as_type<uint>(int(mat4x4_f16[0][0]))))) + as_type<uint>(tint_ftoi(arr2_vec3_f32[0][0]))))) + as_type<uint>(int(arr2_mat4x2_f16[0][0][0]))))) + as_type<uint>(struct_inner.scalar_i32)))) + as_type<uint>(array_struct_inner[0].scalar_i32))); |
| return; |
| } |
| |