summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-10-04 09:46:03 -0400
committerGitHub <noreply@github.com>2019-10-04 09:46:03 -0400
commit7c8527d20e433c3a10736136d31e4cd882a3baaa (patch)
tree44032051a4d76c8773b8a503dae14d9c8c9e786d /source/slang/slang-emit-c-like.cpp
parent0bc7d9b0aeb77c40befeb3618240a065374216a1 (diff)
IR types for subset of Attributes (#1067)
* IROutputControlPointsDecoration * IROutputTopologyDecoration * IRPartitioningDecoration * IRDomainDecoration * Use IRPatchConstantDecoration alone for hlsl output. * IRMaxVertexCountDecoration * IRInstanceDecoration * Removed _emitHLSLAttributeSingleString and _emitHLSLAttributeSingleInt Removed GLSLBindingAttribute and just use NumThreadsAttribute * Added IRNumThreadsDecoration. * Added IRNumThreadsDecoration * Fix build problem on x86. Improve diagnostic text based on review.
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index a19823055..281da3ef9 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -203,6 +203,17 @@ void CLikeSourceEmitter::emitSimpleType(IRType* type)
}
}
+
+/* static */IRNumThreadsDecoration* CLikeSourceEmitter::getComputeThreadGroupSize(IRFunc* func, Int outNumThreads[kThreadGroupAxisCount])
+{
+ IRNumThreadsDecoration* decor = func->findDecoration<IRNumThreadsDecoration>();
+ for (int i = 0; i < 3; ++i)
+ {
+ outNumThreads[i] = decor ? Int(GetIntVal(decor->getOperand(i))) : 1;
+ }
+ return decor;
+}
+
void CLikeSourceEmitter::_emitArrayType(IRArrayType* arrayType, EDeclarator* declarator)
{
EDeclarator arrayDeclarator;