2022-11-09 19:58:59 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
|
|
|
|
using namespace metal;
|
2023-03-20 21:46:01 +00:00
|
|
|
struct tint_private_vars_struct {
|
|
|
|
bool tint_discarded;
|
|
|
|
};
|
|
|
|
|
|
|
|
void foo(thread tint_private_vars_struct* const tint_private_vars, device int* const tint_symbol_1) {
|
2022-11-09 19:58:59 +00:00
|
|
|
if ((*(tint_symbol_1) < 0)) {
|
2023-03-20 21:46:01 +00:00
|
|
|
(*(tint_private_vars)).tint_discarded = true;
|
2022-11-09 19:58:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-20 21:46:01 +00:00
|
|
|
void bar(thread tint_private_vars_struct* const tint_private_vars, device float* const tint_symbol_2) {
|
|
|
|
if (!((*(tint_private_vars)).tint_discarded)) {
|
|
|
|
*(tint_symbol_2) = dfdx(1.0f);
|
2022-11-09 19:58:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-20 21:46:01 +00:00
|
|
|
fragment void tint_symbol(device int* tint_symbol_3 [[buffer(0)]], device float* tint_symbol_4 [[buffer(1)]]) {
|
|
|
|
thread tint_private_vars_struct tint_private_vars = {};
|
|
|
|
tint_private_vars.tint_discarded = false;
|
|
|
|
foo(&(tint_private_vars), tint_symbol_3);
|
|
|
|
bar(&(tint_private_vars), tint_symbol_4);
|
|
|
|
if (tint_private_vars.tint_discarded) {
|
2022-11-09 19:58:59 +00:00
|
|
|
discard_fragment();
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|