diff options
| -rw-r--r-- | source/slang/slang-emit.cpp | 1 | ||||
| -rw-r--r-- | tests/compute/struct-autodiff-default-init.slang | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 243dd65e8..d3f6ebd8d 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -292,6 +292,7 @@ void calcRequiredLoweringPassSet(RequiredLoweringPassSet& result, CodeGenContext case kIROp_BackwardDifferentiate: case kIROp_ForwardDifferentiate: case kIROp_MakeDifferentialPairUserCode: + case kIROp_DerivativeMemberDecoration: result.autodiff = true; break; case kIROp_VerticesType: diff --git a/tests/compute/struct-autodiff-default-init.slang b/tests/compute/struct-autodiff-default-init.slang new file mode 100644 index 000000000..3d6548125 --- /dev/null +++ b/tests/compute/struct-autodiff-default-init.slang @@ -0,0 +1,25 @@ +// struct-default-init.slang +//TEST:SIMPLE(filecheck=HLSL): -target hlsl -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=GLSL): -target glsl -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=METAL): -target metal -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=CPP): -target cpp -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry computeMain -stage compute + +// HLSL: computeMain +// GLSL: main +// METAL: computeMain +// CPP: computeMain +// SPIRV: OpEntryPoint + +struct PowActivationEx : IDifferentiable +{ + float power; +} +RWStructuredBuffer<float> return_value; + +[numthreads(256, 1, 1)] +void computeMain() +{ + PowActivationEx args; + return_value[0] = args.power; +}
\ No newline at end of file |
