| #include <metal_stdlib> |
| using namespace metal; |
| |
| struct tint_module_vars_struct { |
| const constant uint* level; |
| const constant uint2* coords; |
| depth2d<float, access::sample> tex; |
| }; |
| |
| kernel void compute_main(const constant uint* level [[buffer(1)]], const constant uint2* coords [[buffer(0)]], depth2d<float, access::sample> tex [[texture(0)]]) { |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.level=level, .coords=coords, .tex=tex}; |
| uint2 const v = (*tint_module_vars.coords); |
| uint const v_1 = min((*tint_module_vars.level), (tint_module_vars.tex.get_num_mip_levels() - 1u)); |
| float res = tint_module_vars.tex.read(min(v, (uint2(tint_module_vars.tex.get_width(v_1), tint_module_vars.tex.get_height(v_1)) - uint2(1u))), v_1); |
| } |