SPIRV-Cross/reference/shaders-msl/comp/cfg-preserve-parameter.comp
2019-09-24 14:35:25 -04:00

83 lines
1.4 KiB
Plaintext

#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
static inline __attribute__((always_inline))
void out_test_0(thread const int& cond, thread int& i)
{
if (cond == 0)
{
i = 40;
}
else
{
i = 60;
}
}
static inline __attribute__((always_inline))
void out_test_1(thread const int& cond, thread int& i)
{
switch (cond)
{
case 40:
{
i = 40;
break;
}
default:
{
i = 70;
break;
}
}
}
static inline __attribute__((always_inline))
void inout_test_0(thread const int& cond, thread int& i)
{
if (cond == 0)
{
i = 40;
}
}
static inline __attribute__((always_inline))
void inout_test_1(thread const int& cond, thread int& i)
{
switch (cond)
{
case 40:
{
i = 40;
break;
}
}
}
kernel void main0()
{
int cond = 40;
int i = 50;
int param = cond;
int param_1 = i;
out_test_0(param, param_1);
i = param_1;
int param_2 = cond;
int param_3 = i;
out_test_1(param_2, param_3);
i = param_3;
int param_4 = cond;
int param_5 = i;
inout_test_0(param_4, param_5);
i = param_5;
int param_6 = cond;
int param_7 = i;
inout_test_1(param_6, param_7);
i = param_7;
}