yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
47715e625
master
1//DIAGNOSTIC_TEST:SIMPLE: 2 3float nonDiff(float x) 4{ 5 return x; 6} 7 8[ForwardDifferentiable] 9float f(float x) 10{ 11 float val = 0; 12 if (x > 5) 13 val = x + 1; 14 15 [MaxIters(2)] 16 for (int i = 0; i < (int)x; i++) // OK 17 { 18 } 19 20 for (int i = 0; i < 5; i++) // OK 21 { 22 } 23 24 return val; 25} 26 27[ForwardDifferentiable] 28float m(float x) 29{ 30 float x1 = no_diff x; // invalid use of no_diff here. 31 return no_diff f(x); // no_diff on a differentiable call has no meaning. 32} 33 34float n(float x) 35{ 36 return no_diff nonDiff(x); // no_diff in a non-differentiable function 37}