summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-glsl.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-03-25 16:45:56 -0400
committerGitHub <noreply@github.com>2020-03-25 16:45:56 -0400
commitb3e6f1b2cffa8def593e97a00576eeba0f947ebc (patch)
treef953b64922bb3fe69ef1ac26bef0eda2741626d3 /source/slang/slang-emit-glsl.cpp
parent28a0ca96a1ad2a3f0e09cc97b866f3b6338a09fa (diff)
Unroll target improvements (#1291)
* Add unroll support for CUDA, and preliminary for C++. Document [unroll] support. * Fix loop-unroll to run on CPU, and test on CPU and elsewhere. Fix bug in emitting loop unroll condition. * Improved comment. * Added support for vk/glsl loop unrolling.
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
-rw-r--r--source/slang/slang-emit-glsl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index b433b4d94..af1cfd897 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -668,6 +668,16 @@ void GLSLSourceEmitter::_maybeEmitGLSLFlatModifier(IRType* valueType)
}
}
+void GLSLSourceEmitter::emitLoopControlDecorationImpl(IRLoopControlDecoration* decl)
+{
+ if (decl->getMode() == kIRLoopControl_Unroll)
+ {
+ // https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GL_EXT_control_flow_attributes.txt
+ m_glslExtensionTracker->requireExtension(UnownedStringSlice::fromLiteral("GL_EXT_control_flow_attributes"));
+ m_writer->emit("[[unroll]]\n");
+ }
+}
+
void GLSLSourceEmitter::emitSimpleValueImpl(IRInst* inst)
{
switch (inst->op)