| #include <metal_stdlib> |
| using namespace metal; |
| |
| struct tint_module_vars_struct { |
| device int* non_uniform_global; |
| device float* output; |
| thread bool* continue_execution; |
| }; |
| |
| void foo(tint_module_vars_struct tint_module_vars) { |
| if (((*tint_module_vars.non_uniform_global) < 0)) { |
| (*tint_module_vars.continue_execution) = false; |
| } |
| } |
| |
| void bar(tint_module_vars_struct tint_module_vars) { |
| float const v = dfdx(1.0f); |
| if ((*tint_module_vars.continue_execution)) { |
| (*tint_module_vars.output) = v; |
| } |
| } |
| |
| fragment void tint_symbol(device int* non_uniform_global [[buffer(0)]], device float* output [[buffer(1)]]) { |
| thread bool continue_execution = true; |
| tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.non_uniform_global=non_uniform_global, .output=output, .continue_execution=(&continue_execution)}; |
| foo(tint_module_vars); |
| bar(tint_module_vars); |
| if (!((*tint_module_vars.continue_execution))) { |
| discard_fragment(); |
| } |
| } |