summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/autodiff/deduplicate-witness-table.slang33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/autodiff/deduplicate-witness-table.slang b/tests/autodiff/deduplicate-witness-table.slang
new file mode 100644
index 000000000..ea4c4e730
--- /dev/null
+++ b/tests/autodiff/deduplicate-witness-table.slang
@@ -0,0 +1,33 @@
+//TEST:SIMPLE(filecheck=CHK):-stage compute -entry computeMain -target hlsl
+
+//CHK: struct DiffPair_1
+//CHK-NOT: struct DiffPair_2
+
+RWTexture2D<float> gOutputColor;
+
+struct ShadingFrame : IDifferentiable
+{
+ float3 T;
+}
+
+[Differentiable]
+float computeRay()
+{
+ float3 dir = 1.f;
+ return dot(dir, dir);
+}
+
+[Differentiable]
+float paramRay()
+{
+ DifferentialPair<float> dpDir = fwd_diff(computeRay)();
+ return dpDir.p;
+}
+
+[Shader("compute")]
+[NumThreads(1, 1, 1)]
+void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
+{
+ DifferentialPair<float> dpColor = fwd_diff(paramRay)();
+ gOutputColor[0] = dpColor.p;
+}