From a549362ba7011562f123b52c35c875c2c02f4f40 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 16 Mar 2018 14:28:04 -0400 Subject: Small bug fixes. (#445) This commit contains two small bug fixes: 1. In `specializeProgramLayout`, we cannot assume the resourceInfo entries in a varLayout and its corresponding type layout has the same order. Should use `FindResourceLayout`. 2. When generating ir for a switch statement, make sure to remove the breakLabel from the shared context when done. For some reason if a switch statement is being lowered twice, the Dictionary::Add method will complain the statement key already exists. --- source/slang/parameter-binding.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/slang/parameter-binding.cpp') diff --git a/source/slang/parameter-binding.cpp b/source/slang/parameter-binding.cpp index b0d90d435..3ff2be61f 100644 --- a/source/slang/parameter-binding.cpp +++ b/source/slang/parameter-binding.cpp @@ -2492,14 +2492,14 @@ RefPtr specializeProgramLayout( for (UInt i = 0; i < varLayout->resourceInfos.Count(); i++) { auto resInfo = varLayout->resourceInfos[i]; - auto tresInfo = varLayout->typeLayout->resourceInfos[i]; - SLANG_ASSERT(resInfo.kind == tresInfo.kind); + auto tresInfo = varLayout->typeLayout->FindResourceInfo(resInfo.kind); + SLANG_ASSERT(tresInfo); auto usedRangeSet = findUsedRangeSetForSpace(&context, resInfo.space); markSpaceUsed(&context, resInfo.space); usedRangeSet->usedResourceRanges[(int)resInfo.kind].Add( nullptr, // we don't need to track parameter info here resInfo.index, - resInfo.index + tresInfo.count); + resInfo.index + tresInfo->count); } structLayout->fields[varId] = varLayout; varLayoutMapping[varLayout] = varLayout; -- cgit v1.2.3