From 2c8b983cf20ba662e351813f3f432b65eef3530c Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 29 Jan 2020 10:06:45 -0500 Subject: Feature/fix cuda function preamble (#1187) * Fix tests/compute/global-init.slang by handling some other cases where functions are emitted. * Fix comment. --- source/slang/slang-emit-c-like.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/slang/slang-emit-c-like.cpp') diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index 8e0c64d1a..d630d18c9 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -2579,6 +2579,8 @@ void CLikeSourceEmitter::emitSimpleFuncImpl(IRFunc* func) emitEntryPointAttributes(func, entryPointDecor); } + emitFunctionPreambleImpl(func); + auto name = getName(func); emitType(resultType, name); @@ -2963,6 +2965,8 @@ void CLikeSourceEmitter::emitGlobalVar(IRGlobalVar* varDecl) String initFuncName; if (varDecl->getFirstBlock()) { + emitFunctionPreambleImpl(varDecl); + // A global variable with code means it has an initializer // associated with it. Eventually we'd like to emit that // initializer directly as an expression here, but for -- cgit v1.2.3