2021-07-13 12:18:13 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
|
|
|
|
using namespace metal;
|
2021-08-23 21:45:23 +00:00
|
|
|
|
2022-06-24 17:01:59 +00:00
|
|
|
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];
|
2021-07-13 12:18:13 +00:00
|
|
|
};
|
2022-02-09 23:55:51 +00:00
|
|
|
|
2023-02-27 20:21:03 +00:00
|
|
|
struct tint_packed_vec3_f32_array_element {
|
|
|
|
/* 0x0000 */ packed_float3 elements;
|
|
|
|
/* 0x000c */ tint_array<int8_t, 4> tint_pad;
|
|
|
|
};
|
|
|
|
|
2022-06-24 17:01:59 +00:00
|
|
|
struct Inner {
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x0000 */ int scalar_i32;
|
|
|
|
/* 0x0004 */ float scalar_f32;
|
2021-07-13 12:18:13 +00:00
|
|
|
};
|
2022-02-09 23:55:51 +00:00
|
|
|
|
2023-02-27 20:21:03 +00:00
|
|
|
struct S_tint_packed_vec3 {
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x0000 */ float scalar_f32;
|
|
|
|
/* 0x0004 */ int scalar_i32;
|
|
|
|
/* 0x0008 */ uint scalar_u32;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x000c */ tint_array<int8_t, 4> tint_pad_1;
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x0010 */ float2 vec2_f32;
|
|
|
|
/* 0x0018 */ int2 vec2_i32;
|
|
|
|
/* 0x0020 */ uint2 vec2_u32;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x0028 */ tint_array<int8_t, 8> tint_pad_2;
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x0030 */ packed_float3 vec3_f32;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x003c */ tint_array<int8_t, 4> tint_pad_3;
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x0040 */ packed_int3 vec3_i32;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x004c */ tint_array<int8_t, 4> tint_pad_4;
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x0050 */ packed_uint3 vec3_u32;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x005c */ tint_array<int8_t, 4> tint_pad_5;
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x0060 */ float4 vec4_f32;
|
|
|
|
/* 0x0070 */ int4 vec4_i32;
|
|
|
|
/* 0x0080 */ uint4 vec4_u32;
|
|
|
|
/* 0x0090 */ float2x2 mat2x2_f32;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x00a0 */ tint_array<tint_packed_vec3_f32_array_element, 2> mat2x3_f32;
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x00c0 */ float2x4 mat2x4_f32;
|
|
|
|
/* 0x00e0 */ float3x2 mat3x2_f32;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x00f8 */ tint_array<int8_t, 8> tint_pad_6;
|
|
|
|
/* 0x0100 */ tint_array<tint_packed_vec3_f32_array_element, 3> mat3x3_f32;
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x0130 */ float3x4 mat3x4_f32;
|
|
|
|
/* 0x0160 */ float4x2 mat4x2_f32;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x0180 */ tint_array<tint_packed_vec3_f32_array_element, 4> mat4x3_f32;
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x01c0 */ float4x4 mat4x4_f32;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x0200 */ tint_array<tint_packed_vec3_f32_array_element, 2> arr2_vec3_f32;
|
2022-11-30 02:47:27 +00:00
|
|
|
/* 0x0220 */ Inner struct_inner;
|
|
|
|
/* 0x0228 */ tint_array<Inner, 4> array_struct_inner;
|
2023-02-27 20:21:03 +00:00
|
|
|
/* 0x0248 */ tint_array<int8_t, 8> tint_pad_7;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct S {
|
|
|
|
float scalar_f32;
|
|
|
|
int scalar_i32;
|
|
|
|
uint scalar_u32;
|
|
|
|
float2 vec2_f32;
|
|
|
|
int2 vec2_i32;
|
|
|
|
uint2 vec2_u32;
|
|
|
|
float3 vec3_f32;
|
|
|
|
int3 vec3_i32;
|
|
|
|
uint3 vec3_u32;
|
|
|
|
float4 vec4_f32;
|
|
|
|
int4 vec4_i32;
|
|
|
|
uint4 vec4_u32;
|
|
|
|
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;
|
|
|
|
tint_array<float3, 2> arr2_vec3_f32;
|
|
|
|
Inner struct_inner;
|
|
|
|
tint_array<Inner, 4> array_struct_inner;
|
2021-07-13 12:18:13 +00:00
|
|
|
};
|
|
|
|
|
2023-02-27 20:21:03 +00:00
|
|
|
void assign_and_preserve_padding(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, float2x3 value) {
|
|
|
|
(*(dest))[0u].elements = packed_float3(value[0u]);
|
|
|
|
(*(dest))[1u].elements = packed_float3(value[1u]);
|
2023-02-27 16:06:54 +00:00
|
|
|
}
|
|
|
|
|
2023-02-27 20:21:03 +00:00
|
|
|
void assign_and_preserve_padding_1(device tint_array<tint_packed_vec3_f32_array_element, 3>* const dest, float3x3 value) {
|
|
|
|
(*(dest))[0u].elements = packed_float3(value[0u]);
|
|
|
|
(*(dest))[1u].elements = packed_float3(value[1u]);
|
|
|
|
(*(dest))[2u].elements = packed_float3(value[2u]);
|
2023-02-27 16:06:54 +00:00
|
|
|
}
|
|
|
|
|
2023-02-27 20:21:03 +00:00
|
|
|
void assign_and_preserve_padding_2(device tint_array<tint_packed_vec3_f32_array_element, 4>* const dest, float4x3 value) {
|
|
|
|
(*(dest))[0u].elements = packed_float3(value[0u]);
|
|
|
|
(*(dest))[1u].elements = packed_float3(value[1u]);
|
|
|
|
(*(dest))[2u].elements = packed_float3(value[2u]);
|
|
|
|
(*(dest))[3u].elements = packed_float3(value[3u]);
|
2023-02-27 16:06:54 +00:00
|
|
|
}
|
|
|
|
|
2023-02-27 20:21:03 +00:00
|
|
|
void assign_and_preserve_padding_3(device tint_array<tint_packed_vec3_f32_array_element, 2>* const dest, tint_array<float3, 2> value) {
|
2022-12-06 18:32:19 +00:00
|
|
|
for(uint i = 0u; (i < 2u); i = (i + 1u)) {
|
2023-02-27 20:21:03 +00:00
|
|
|
(*(dest))[i].elements = packed_float3(value[i]);
|
2022-12-06 18:32:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-27 20:21:03 +00:00
|
|
|
kernel void tint_symbol(device S_tint_packed_vec3* tint_symbol_4 [[buffer(0)]]) {
|
2022-11-30 02:47:27 +00:00
|
|
|
(*(tint_symbol_4)).scalar_f32 = 0.0f;
|
|
|
|
(*(tint_symbol_4)).scalar_i32 = 0;
|
|
|
|
(*(tint_symbol_4)).scalar_u32 = 0u;
|
|
|
|
(*(tint_symbol_4)).vec2_f32 = float2(0.0f);
|
|
|
|
(*(tint_symbol_4)).vec2_i32 = int2(0);
|
|
|
|
(*(tint_symbol_4)).vec2_u32 = uint2(0u);
|
2023-02-27 20:21:03 +00:00
|
|
|
(*(tint_symbol_4)).vec3_f32 = packed_float3(0.0f);
|
|
|
|
(*(tint_symbol_4)).vec3_i32 = packed_int3(0);
|
|
|
|
(*(tint_symbol_4)).vec3_u32 = packed_uint3(0u);
|
2022-11-30 02:47:27 +00:00
|
|
|
(*(tint_symbol_4)).vec4_f32 = float4(0.0f);
|
|
|
|
(*(tint_symbol_4)).vec4_i32 = int4(0);
|
|
|
|
(*(tint_symbol_4)).vec4_u32 = uint4(0u);
|
|
|
|
(*(tint_symbol_4)).mat2x2_f32 = float2x2(float2(0.0f), float2(0.0f));
|
2023-02-27 16:06:54 +00:00
|
|
|
assign_and_preserve_padding(&((*(tint_symbol_4)).mat2x3_f32), float2x3(float3(0.0f), float3(0.0f)));
|
2022-11-30 02:47:27 +00:00
|
|
|
(*(tint_symbol_4)).mat2x4_f32 = float2x4(float4(0.0f), float4(0.0f));
|
|
|
|
(*(tint_symbol_4)).mat3x2_f32 = float3x2(float2(0.0f), float2(0.0f), float2(0.0f));
|
2023-02-27 16:06:54 +00:00
|
|
|
assign_and_preserve_padding_1(&((*(tint_symbol_4)).mat3x3_f32), float3x3(float3(0.0f), float3(0.0f), float3(0.0f)));
|
2022-11-30 02:47:27 +00:00
|
|
|
(*(tint_symbol_4)).mat3x4_f32 = float3x4(float4(0.0f), float4(0.0f), float4(0.0f));
|
|
|
|
(*(tint_symbol_4)).mat4x2_f32 = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f));
|
2023-02-27 16:06:54 +00:00
|
|
|
assign_and_preserve_padding_2(&((*(tint_symbol_4)).mat4x3_f32), float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f)));
|
2022-11-30 02:47:27 +00:00
|
|
|
(*(tint_symbol_4)).mat4x4_f32 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f));
|
|
|
|
tint_array<float3, 2> const tint_symbol_1 = tint_array<float3, 2>{};
|
2023-02-27 16:06:54 +00:00
|
|
|
assign_and_preserve_padding_3(&((*(tint_symbol_4)).arr2_vec3_f32), tint_symbol_1);
|
2022-11-30 02:47:27 +00:00
|
|
|
Inner const tint_symbol_2 = Inner{};
|
|
|
|
(*(tint_symbol_4)).struct_inner = tint_symbol_2;
|
|
|
|
tint_array<Inner, 4> const tint_symbol_3 = tint_array<Inner, 4>{};
|
|
|
|
(*(tint_symbol_4)).array_struct_inner = tint_symbol_3;
|
2021-07-13 12:18:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|