yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Sai Praveen BangaruFix compiler crashing when `[BackwardDerivativeOf(fn)]` refers to an unresolved `fn` (#3191)5d078d962

master
589 B23 linesraw
1//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
2
3// Simple check to see that the compiler returns an error message if the
4// custom derivative definition points to an undefined function.
5//
6
7void __d_f(float x, float.Differential dout)
8{
9}
10
11[BackwardDerivative(__d_g)]
12float f(float x)
13{
14    // CHECK:      tests/diagnostics/autodiff-custom-diff-unresolved.slang([[@LINE-3]]): error 30015: undefined identifier '__d_g'.
15    // CHECK-NEXT:     [BackwardDerivative(__d_g)]
16    return x * x;
17}
18
19float main(float x)
20{
21    DifferentialPair<float> dpx = diffPair(x, 1.f);
22    bwd_diff(f)(dpx, 1.f);
23}