From 499b0253c224e68ceed6e5b6b1ee9cd7d65aad0f Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 30 Jan 2023 19:24:09 -0800 Subject: Make ArrayExpressionType a DeclRefType and define its autodiff extension in stdlib. (#2615) * Allow array parameters in forward diff. * Use type canonicalization instead of coersion. * Reimplement array type. * Fix. * Update test case. --------- Co-authored-by: Yong He --- source/slang/slang-parameter-binding.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source/slang/slang-parameter-binding.cpp') diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index db323ff6e..f3eabf613 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -1889,16 +1889,18 @@ static RefPtr processEntryPointVaryingParameter( // Note: Bad Things will happen if we have an array input // without a semantic already being enforced. - auto elementCount = (UInt) getIntVal(arrayType->arrayLength); + auto elementCount = (UInt) getIntVal(arrayType->getElementCount()); + if (arrayType->isUnsized()) + elementCount = 0; // We use the first element to derive the layout for the element type - auto elementTypeLayout = processEntryPointVaryingParameter(context, arrayType->baseType, state, varLayout); + auto elementTypeLayout = processEntryPointVaryingParameter(context, arrayType->getElementType(), state, varLayout); // We still walk over subsequent elements to make sure they consume resources // as needed for( UInt ii = 1; ii < elementCount; ++ii ) { - processEntryPointVaryingParameter(context, arrayType->baseType, state, nullptr); + processEntryPointVaryingParameter(context, arrayType->getElementType(), state, nullptr); } RefPtr arrayTypeLayout = new ArrayTypeLayout(); -- cgit v1.2.3