summaryrefslogtreecommitdiffstats
path: root/tests/autodiff/material2/diff-falcor-material-system.slang
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2023-08-30 14:59:34 -0400
committerGitHub <noreply@github.com>2023-08-30 11:59:34 -0700
commit4261185764ecae96466d243b8ce376a6a69c118c (patch)
treea2b63617e9c05fc70306a58a05b9d33efe0ebda2 /tests/autodiff/material2/diff-falcor-material-system.slang
parentbb15f5b494b20e957127f0ffa6040c94349da0d0 (diff)
Fix subtle corner-case with vars getting hoisted out of the loop creating unnecessary loop state (#3165)
* Extend the unit tests for MxLayeredMaterial * Add breaking loop test * Fix subtle corner-case with vars getting hoisted out of the loop creating unnecessary loop state * remove whitespace changes * Create loop-init.slang.expected.txt * Add filecheck tests to ensure correct loop state * Update comment --------- Co-authored-by: winmad <winmad.wlf@gmail.com> Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/autodiff/material2/diff-falcor-material-system.slang')
-rw-r--r--tests/autodiff/material2/diff-falcor-material-system.slang13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/autodiff/material2/diff-falcor-material-system.slang b/tests/autodiff/material2/diff-falcor-material-system.slang
index 7b0f39ed1..3c7155ec2 100644
--- a/tests/autodiff/material2/diff-falcor-material-system.slang
+++ b/tests/autodiff/material2/diff-falcor-material-system.slang
@@ -2,16 +2,19 @@
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
// outputBuffer is defined in IBSDF.slang
-//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0], stride=4):out,name=outputBuffer
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
import MaterialSystem;
import DiffuseMaterial;
import DiffuseMaterialInstance;
import GlossyMaterial;
import GlossyMaterialInstance;
+import MxLayeredMaterial;
+import MxLayeredMaterialInstance;
//TEST_INPUT: type_conformance DiffuseMaterial:IMaterial = 0
//TEST_INPUT: type_conformance GlossyMaterial:IMaterial = 1
+//TEST_INPUT: type_conformance MxLayeredMaterial:IMaterial = 2
[BackwardDifferentiable]
float3 evalBSDF(int type)
@@ -44,4 +47,12 @@ void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
outputBuffer[4] = dp_f.d[1];
outputBuffer[5] = dp_f.d[2];
}
+
+ {
+ DifferentialPair<float3> dp_f = __fwd_diff(evalBSDF)(2);
+
+ outputBuffer[6] = dp_f.d[0];
+ outputBuffer[7] = dp_f.d[1];
+ outputBuffer[8] = dp_f.d[2];
+ }
}