yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
cc8f6a241
master
1//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): 2 3 4[Differentiable] 5float f(__constref float3 val) 6{ 7 return val.x; 8} 9 10struct MyType : IDifferentiable 11{ 12 // Error: cannot use constref on a differentiable member method of a differentiable type. 13 [Differentiable] 14 [constref] float compute(float x) { return 0; } 15 16 // OK 17 [Differentiable] 18 float compute1(float x) { return 0; } 19 20 // OK 21 [constref] float compute2(float x) { return 0;} 22} 23 24struct MyType2 25{ 26 // OK. 27 [Differentiable] 28 [constref] float compute(float x) { return 0; } 29 30 // OK 31 [constref] 32 float compute1(float x) { return 0; } 33} 34 35// CHECK-DAG: {{.*}}(5): error 38034: cannot use 'borrow in' on a differentiable parameter. 36// CHECK-NOT {{.*}}error 37// CHECK-DAG: {{.*}}(14): error 38034: cannot use '[constref]' on a differentiable member method of a differentiable type. 38// CHECK-NOT {{.*}}error