summaryrefslogtreecommitdiffstats
path: root/source/slang/ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-10-23 10:44:08 -0400
committerYong He <yonghe@outlook.com>2017-10-23 10:44:08 -0400
commit4d6be3588ac5b5b62e19900b12de90ce1e1ff744 (patch)
tree43fb004d9283849c670dfd869d75b8f621036b9e /source/slang/ir.cpp
parentcc6184ebc4d0611be892eaff119de99f8b9e1ca6 (diff)
parent624d122a3a110922cd54aab7bbf13f1cac8fbbff (diff)
Merge https://github.com/shader-slang/slang
Diffstat (limited to 'source/slang/ir.cpp')
-rw-r--r--source/slang/ir.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp
index 4bf9de5d3..14639de7e 100644
--- a/source/slang/ir.cpp
+++ b/source/slang/ir.cpp
@@ -3094,6 +3094,31 @@ namespace Slang
clonedFunc,
entryPointLayout);
+ // We will also go on and attach layout information
+ // to the function parameters, so that we have it
+ // available directly on the parameters, rather
+ // than having to look it up on the original entry-point layout.
+ if( auto firstBlock = clonedFunc->getFirstBlock() )
+ {
+ UInt paramLayoutCount = entryPointLayout->fields.Count();
+ UInt paramCounter = 0;
+ for( auto pp = firstBlock->getFirstParam(); pp; pp = pp->getNextParam() )
+ {
+ UInt paramIndex = paramCounter++;
+ if( paramIndex < paramLayoutCount )
+ {
+ auto paramLayout = entryPointLayout->fields[paramIndex];
+ context->builder->addLayoutDecoration(
+ pp,
+ paramLayout);
+ }
+ else
+ {
+ SLANG_UNEXPECTED("too many parameters");
+ }
+ }
+ }
+
return clonedFunc;
}