summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-mangle.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/slang/slang-mangle.cpp b/source/slang/slang-mangle.cpp
index ad1a9caca..779a6f090 100644
--- a/source/slang/slang-mangle.cpp
+++ b/source/slang/slang-mangle.cpp
@@ -547,6 +547,33 @@ namespace Slang
for(auto paramDeclRef : parameters)
{
+ // parameter modifier makes big difference in the spirv code generation, for example
+ // "out"/"inout" parameter will be passed by pointer. Therefore, we need to
+ // distinguish them in the mangled name to avoid name collision.
+ ParameterDirection paramDirection = getParameterDirection(paramDeclRef.getDecl());
+ switch (paramDirection)
+ {
+ case kParameterDirection_Ref:
+ emitRaw(context, "r_");
+ break;
+ case kParameterDirection_ConstRef:
+ emitRaw(context, "c_");
+ break;
+ case kParameterDirection_Out:
+ emitRaw(context, "o_");
+ break;
+ case kParameterDirection_InOut:
+ emitRaw(context, "io_");
+ break;
+ case kParameterDirection_In:
+ emitRaw(context, "i_");
+ break;
+ default:
+ StringBuilder errMsg;
+ errMsg << "Unknown parameter direction: " << paramDirection;
+ SLANG_ABORT_COMPILATION(errMsg.toString().begin());
+ break;
+ }
emitType(context, getType(context->astBuilder, paramDeclRef));
}