2021-05-26 15:41:02 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
|
|
|
|
using namespace metal;
|
2023-03-20 21:46:01 +00:00
|
|
|
struct tint_private_vars_struct {
|
|
|
|
int a;
|
|
|
|
int b;
|
|
|
|
int c;
|
|
|
|
};
|
|
|
|
|
|
|
|
void uses_a(thread tint_private_vars_struct* const tint_private_vars) {
|
|
|
|
(*(tint_private_vars)).a = as_type<int>((as_type<uint>((*(tint_private_vars)).a) + as_type<uint>(1)));
|
2021-05-26 15:41:02 +00:00
|
|
|
}
|
|
|
|
|
2023-03-20 21:46:01 +00:00
|
|
|
void uses_b(thread tint_private_vars_struct* const tint_private_vars) {
|
|
|
|
(*(tint_private_vars)).b = as_type<int>((as_type<uint>((*(tint_private_vars)).b) * as_type<uint>(2)));
|
2021-05-26 15:41:02 +00:00
|
|
|
}
|
|
|
|
|
2023-03-20 21:46:01 +00:00
|
|
|
void uses_a_and_b(thread tint_private_vars_struct* const tint_private_vars) {
|
|
|
|
(*(tint_private_vars)).b = (*(tint_private_vars)).a;
|
2021-05-26 15:41:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void no_uses() {
|
|
|
|
}
|
|
|
|
|
2023-03-20 21:46:01 +00:00
|
|
|
void outer(thread tint_private_vars_struct* const tint_private_vars) {
|
|
|
|
(*(tint_private_vars)).a = 0;
|
|
|
|
uses_a(tint_private_vars);
|
|
|
|
uses_a_and_b(tint_private_vars);
|
|
|
|
uses_b(tint_private_vars);
|
2021-05-26 15:41:02 +00:00
|
|
|
no_uses();
|
|
|
|
}
|
|
|
|
|
|
|
|
kernel void main1() {
|
2023-03-20 21:46:01 +00:00
|
|
|
thread tint_private_vars_struct tint_private_vars = {};
|
|
|
|
tint_private_vars.a = 42;
|
|
|
|
uses_a(&(tint_private_vars));
|
2021-05-26 15:41:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
kernel void main2() {
|
2023-03-20 21:46:01 +00:00
|
|
|
thread tint_private_vars_struct tint_private_vars = {};
|
|
|
|
tint_private_vars.b = 7;
|
|
|
|
uses_b(&(tint_private_vars));
|
2021-05-26 15:41:02 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
kernel void main3() {
|
2023-03-20 21:46:01 +00:00
|
|
|
thread tint_private_vars_struct tint_private_vars = {};
|
|
|
|
outer(&(tint_private_vars));
|
2021-05-26 15:41:02 +00:00
|
|
|
no_uses();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
kernel void main4() {
|
|
|
|
no_uses();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|