summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-01-29 10:06:45 -0500
committerGitHub <noreply@github.com>2020-01-29 10:06:45 -0500
commit2c8b983cf20ba662e351813f3f432b65eef3530c (patch)
tree61ee43c2d1db218f8f9deb91a83a7cee1a4340e7 /source/slang/slang-emit-c-like.cpp
parent58cea79d8622a08b0887dbfda8f8042e42679c8f (diff)
Feature/fix cuda function preamble (#1187)
* Fix tests/compute/global-init.slang by handling some other cases where functions are emitted. * Fix comment.
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp4
1 files changed, 4 insertions, 0 deletions
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