summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-autodiff.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2024-11-18 16:34:03 -0500
committerGitHub <noreply@github.com>2024-11-18 13:34:03 -0800
commitec5e019fa9732b99b75b2a3ca4f2ff5a7a3d2f33 (patch)
treef314f5b16ad18dd3325a7c3a4228242d6d448752 /source/slang/slang-ir-autodiff.cpp
parent05903f708856a70d68bf41bbfb2b06620508dee0 (diff)
Add `IDifferentiablePtrType` support for arrays (#5576)
* Add `IDifferentiablePtrType` support for arrays - Also fixes an issue with spirv-emit of constructors that contain references to global params * Fix GLSL legalization for arrays of resource types
Diffstat (limited to 'source/slang/slang-ir-autodiff.cpp')
-rw-r--r--source/slang/slang-ir-autodiff.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp
index cb37b6242..5c05b0811 100644
--- a/source/slang/slang-ir-autodiff.cpp
+++ b/source/slang/slang-ir-autodiff.cpp
@@ -1275,7 +1275,9 @@ IRInst* DifferentiableTypeConformanceContext::buildArrayWitness(
IRWitnessTable* table = nullptr;
if (target == DiffConformanceKind::Value)
{
- SLANG_ASSERT(isDifferentiableValueType((IRType*)arrayType));
+ if (!isDifferentiableValueType((IRType*)arrayType))
+ return nullptr;
+
auto innerWitness = tryGetDifferentiableWitness(
builder,
as<IRArrayTypeBase>(arrayType)->getElementType(),
@@ -1360,7 +1362,8 @@ IRInst* DifferentiableTypeConformanceContext::buildArrayWitness(
}
else if (target == DiffConformanceKind::Ptr)
{
- SLANG_ASSERT(isDifferentiablePtrType((IRType*)arrayType));
+ if (!isDifferentiablePtrType((IRType*)arrayType))
+ return nullptr;
table = builder->createWitnessTable(
sharedContext->differentiablePtrInterfaceType,