| #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 packed; |
| /* 0x000c */ tint_array<int8_t, 4> tint_pad; |
| }; |
| |
| #define TINT_ISOLATE_UB(VOLATILE_NAME) \ |
| volatile bool VOLATILE_NAME = true; \ |
| if (VOLATILE_NAME) |
| |
| struct Inner_packed_vec3 { |
| /* 0x0000 */ float scalar_f32; |
| /* 0x0004 */ int scalar_i32; |
| /* 0x0008 */ uint scalar_u32; |
| /* 0x000c */ tint_array<int8_t, 4> tint_pad_1; |
| /* 0x0010 */ float2 vec2_f32; |
| /* 0x0018 */ int2 vec2_i32; |
| /* 0x0020 */ uint2 vec2_u32; |
| /* 0x0028 */ tint_array<int8_t, 8> tint_pad_2; |
| /* 0x0030 */ packed_float3 vec3_f32; |
| /* 0x003c */ tint_array<int8_t, 4> tint_pad_3; |
| /* 0x0040 */ packed_int3 vec3_i32; |
| /* 0x004c */ tint_array<int8_t, 4> tint_pad_4; |
| /* 0x0050 */ packed_uint3 vec3_u32; |
| /* 0x005c */ tint_array<int8_t, 4> tint_pad_5; |
| /* 0x0060 */ float4 vec4_f32; |
| /* 0x0070 */ int4 vec4_i32; |
| /* 0x0080 */ uint4 vec4_u32; |
| /* 0x0090 */ float2x2 mat2x2_f32; |
| /* 0x00a0 */ tint_array<tint_packed_vec3_f32_array_element, 2> mat2x3_f32; |
| /* 0x00c0 */ float2x4 mat2x4_f32; |
| /* 0x00e0 */ float3x2 mat3x2_f32; |
| /* 0x00f8 */ tint_array<int8_t, 8> tint_pad_6; |
| /* 0x0100 */ tint_array<tint_packed_vec3_f32_array_element, 3> mat3x3_f32; |
| /* 0x0130 */ float3x4 mat3x4_f32; |
| /* 0x0160 */ float4x2 mat4x2_f32; |
| /* 0x0180 */ tint_array<tint_packed_vec3_f32_array_element, 4> mat4x3_f32; |
| /* 0x01c0 */ float4x4 mat4x4_f32; |
| /* 0x0200 */ tint_array<tint_packed_vec3_f32_array_element, 2> arr2_vec3_f32; |
| }; |
| |
| struct S_packed_vec3 { |
| /* 0x0000 */ tint_array<Inner_packed_vec3, 1> arr; |
| }; |
| |
| struct tint_module_vars_struct { |
| device S_packed_vec3* sb; |
| }; |
| |
| void tint_store_and_preserve_padding_3(device tint_array<tint_packed_vec3_f32_array_element, 2>* const target, tint_array<float3, 2> value_param) { |
| { |
| uint v = 0u; |
| v = 0u; |
| TINT_ISOLATE_UB(tint_volatile_true) while(true) { |
| uint const v_1 = v; |
| if ((v_1 >= 2u)) { |
| break; |
| } |
| (*target)[v_1].packed = packed_float3(value_param[v_1]); |
| { |
| v = (v_1 + 1u); |
| } |
| continue; |
| } |
| } |
| } |
| |
| void tint_store_and_preserve_padding_2(device tint_array<tint_packed_vec3_f32_array_element, 4>* const target, float4x3 value_param) { |
| (*target)[0u].packed = packed_float3(value_param[0u]); |
| (*target)[1u].packed = packed_float3(value_param[1u]); |
| (*target)[2u].packed = packed_float3(value_param[2u]); |
| (*target)[3u].packed = packed_float3(value_param[3u]); |
| } |
| |
| void tint_store_and_preserve_padding_1(device tint_array<tint_packed_vec3_f32_array_element, 3>* const target, float3x3 value_param) { |
| (*target)[0u].packed = packed_float3(value_param[0u]); |
| (*target)[1u].packed = packed_float3(value_param[1u]); |
| (*target)[2u].packed = packed_float3(value_param[2u]); |
| } |
| |
| void tint_store_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const target, float2x3 value_param) { |
| (*target)[0u].packed = packed_float3(value_param[0u]); |
| (*target)[1u].packed = packed_float3(value_param[1u]); |
| } |
| |
| void tint_symbol_inner(uint idx, tint_module_vars_struct tint_module_vars) { |
| (*tint_module_vars.sb).arr[idx].scalar_f32 = 0.0f; |
| (*tint_module_vars.sb).arr[idx].scalar_i32 = 0; |
| (*tint_module_vars.sb).arr[idx].scalar_u32 = 0u; |
| (*tint_module_vars.sb).arr[idx].vec2_f32 = float2(0.0f); |
| (*tint_module_vars.sb).arr[idx].vec2_i32 = int2(0); |
| (*tint_module_vars.sb).arr[idx].vec2_u32 = uint2(0u); |
| (*tint_module_vars.sb).arr[idx].vec3_f32 = packed_float3(float3(0.0f)); |
| (*tint_module_vars.sb).arr[idx].vec3_i32 = packed_int3(int3(0)); |
| (*tint_module_vars.sb).arr[idx].vec3_u32 = packed_uint3(uint3(0u)); |
| (*tint_module_vars.sb).arr[idx].vec4_f32 = float4(0.0f); |
| (*tint_module_vars.sb).arr[idx].vec4_i32 = int4(0); |
| (*tint_module_vars.sb).arr[idx].vec4_u32 = uint4(0u); |
| (*tint_module_vars.sb).arr[idx].mat2x2_f32 = float2x2(float2(0.0f), float2(0.0f)); |
| tint_store_and_preserve_padding((&(*tint_module_vars.sb).arr[idx].mat2x3_f32), float2x3(float3(0.0f), float3(0.0f))); |
| (*tint_module_vars.sb).arr[idx].mat2x4_f32 = float2x4(float4(0.0f), float4(0.0f)); |
| (*tint_module_vars.sb).arr[idx].mat3x2_f32 = float3x2(float2(0.0f), float2(0.0f), float2(0.0f)); |
| tint_store_and_preserve_padding_1((&(*tint_module_vars.sb).arr[idx].mat3x3_f32), float3x3(float3(0.0f), float3(0.0f), float3(0.0f))); |
| (*tint_module_vars.sb).arr[idx].mat3x4_f32 = float3x4(float4(0.0f), float4(0.0f), float4(0.0f)); |
| (*tint_module_vars.sb).arr[idx].mat4x2_f32 = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f)); |
| tint_store_and_preserve_padding_2((&(*tint_module_vars.sb).arr[idx].mat4x3_f32), float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f))); |
| (*tint_module_vars.sb).arr[idx].mat4x4_f32 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f)); |
| tint_store_and_preserve_padding_3((&(*tint_module_vars.sb).arr[idx].arr2_vec3_f32), tint_array<float3, 2>{}); |
| } |
| |
| kernel void tint_symbol(uint idx [[thread_index_in_threadgroup]], device S_packed_vec3* sb [[buffer(0)]]) { |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.sb=sb}; |
| tint_symbol_inner(idx, tint_module_vars); |
| } |