| // |
| // vertex_main |
| // |
| #include <metal_stdlib> |
| |
| using namespace metal; |
| int2 tint_clamp(int2 e, int2 low, int2 high) { |
| return min(max(e, low), high); |
| } |
| |
| int4 textureLoad2d(texture2d<int, access::sample> tint_symbol, int2 coords, int level) { |
| uint const level_idx = min(uint(level), (tint_symbol.get_num_mip_levels() - 1u)); |
| return tint_symbol.read(uint2(tint_clamp(coords, int2(0), int2((uint2(tint_symbol.get_width(level_idx), tint_symbol.get_height(level_idx)) - uint2(1u))))), level_idx); |
| } |
| |
| void doTextureLoad(texture2d<int, access::sample> tint_symbol_2) { |
| int4 res = textureLoad2d(tint_symbol_2, int2(0), 0); |
| } |
| |
| struct tint_symbol_1 { |
| float4 value [[position]]; |
| }; |
| |
| float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_3) { |
| doTextureLoad(tint_symbol_3); |
| return float4(0.0f); |
| } |
| |
| vertex tint_symbol_1 vertex_main(texture2d<int, access::sample> tint_symbol_4 [[texture(0)]]) { |
| float4 const inner_result = vertex_main_inner(tint_symbol_4); |
| tint_symbol_1 wrapper_result = {}; |
| wrapper_result.value = inner_result; |
| return wrapper_result; |
| } |
| |
| // |
| // fragment_main |
| // |
| #include <metal_stdlib> |
| |
| using namespace metal; |
| int2 tint_clamp(int2 e, int2 low, int2 high) { |
| return min(max(e, low), high); |
| } |
| |
| int4 textureLoad2d(texture2d<int, access::sample> tint_symbol, int2 coords, int level) { |
| uint const level_idx = min(uint(level), (tint_symbol.get_num_mip_levels() - 1u)); |
| return tint_symbol.read(uint2(tint_clamp(coords, int2(0), int2((uint2(tint_symbol.get_width(level_idx), tint_symbol.get_height(level_idx)) - uint2(1u))))), level_idx); |
| } |
| |
| void doTextureLoad(texture2d<int, access::sample> tint_symbol_1) { |
| int4 res = textureLoad2d(tint_symbol_1, int2(0), 0); |
| } |
| |
| fragment void fragment_main(texture2d<int, access::sample> tint_symbol_2 [[texture(0)]]) { |
| doTextureLoad(tint_symbol_2); |
| return; |
| } |
| |
| // |
| // compute_main |
| // |
| #include <metal_stdlib> |
| |
| using namespace metal; |
| int2 tint_clamp(int2 e, int2 low, int2 high) { |
| return min(max(e, low), high); |
| } |
| |
| int4 textureLoad2d(texture2d<int, access::sample> tint_symbol, int2 coords, int level) { |
| uint const level_idx = min(uint(level), (tint_symbol.get_num_mip_levels() - 1u)); |
| return tint_symbol.read(uint2(tint_clamp(coords, int2(0), int2((uint2(tint_symbol.get_width(level_idx), tint_symbol.get_height(level_idx)) - uint2(1u))))), level_idx); |
| } |
| |
| void doTextureLoad(texture2d<int, access::sample> tint_symbol_1) { |
| int4 res = textureLoad2d(tint_symbol_1, int2(0), 0); |
| } |
| |
| kernel void compute_main(texture2d<int, access::sample> tint_symbol_2 [[texture(0)]]) { |
| doTextureLoad(tint_symbol_2); |
| return; |
| } |
| |