| #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_resource_table_metadata_struct { |
| /* 0x0000 */ uint array_length; |
| /* 0x0004 */ tint_array<uint, 1> bindings; |
| }; |
| |
| struct tint_module_vars_struct { |
| sampler s; |
| const constant ulong* tint_resource_table; |
| const device tint_resource_table_metadata_struct* tint_resource_table_metadata; |
| }; |
| |
| struct tint_resource_table_struct_texture_2d_f32 { |
| texture2d<float, access::sample> resource; |
| }; |
| |
| struct fs_outputs { |
| float4 tint_symbol [[color(0)]]; |
| }; |
| |
| float4 fs_inner(tint_module_vars_struct tint_module_vars) { |
| bool v = false; |
| if ((0u < (*tint_module_vars.tint_resource_table_metadata).array_length)) { |
| v = any((uint3((*tint_module_vars.tint_resource_table_metadata).bindings[0u]) == uint3(6u, 7u, 34u))); |
| } else { |
| v = false; |
| } |
| bool const has_resource = v; |
| uint v_1 = 0u; |
| if (has_resource) { |
| v_1 = (*tint_module_vars.tint_resource_table_metadata).bindings[0u]; |
| } else { |
| v_1 = 6u; |
| } |
| uint v_2 = 0u; |
| if (has_resource) { |
| v_2 = 0u; |
| } else { |
| v_2 = (0u + (*tint_module_vars.tint_resource_table_metadata).array_length); |
| } |
| return reinterpret_cast<const constant tint_resource_table_struct_texture_2d_f32*>(tint_module_vars.tint_resource_table)[v_2].resource.sample(tint_module_vars.s, float2(0.0f)); |
| } |
| |
| fragment fs_outputs fs(sampler s [[sampler(0)]], const constant ulong* tint_resource_table [[buffer(28)]], const device tint_resource_table_metadata_struct* tint_resource_table_metadata [[buffer(29)]]) { |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.s=s, .tint_resource_table=tint_resource_table, .tint_resource_table_metadata=tint_resource_table_metadata}; |
| fs_outputs tint_wrapper_result = {}; |
| tint_wrapper_result.tint_symbol = fs_inner(tint_module_vars); |
| return tint_wrapper_result; |
| } |