summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-hlsl.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-06-22 15:07:31 -0400
committerGitHub <noreply@github.com>2023-06-22 15:07:31 -0400
commit769c7fdd19ea579770baac7b6d5e16d6406a8013 (patch)
treea0f04c668911a2b3b58e0fc89f5bb765540226bd /source/slang/slang-emit-hlsl.cpp
parentac541d45fafde340b141172cf76d003ff70d471e (diff)
[branch] and [flatten] support (#2928)
* #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes and improvements around reflection tool. * Make PrettyWriter printing a class. * Add HLSL output support for [flatten] and [branch] * Handle [branch] on switch.
Diffstat (limited to 'source/slang/slang-emit-hlsl.cpp')
-rw-r--r--source/slang/slang-emit-hlsl.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp
index 3f6e79f4a..76300c18b 100644
--- a/source/slang/slang-emit-hlsl.cpp
+++ b/source/slang/slang-emit-hlsl.cpp
@@ -766,6 +766,26 @@ static bool _canEmitExport(const Profile& profile)
Super::emitFuncDecorationsImpl(func);
}
+void HLSLSourceEmitter::emitIfDecorationsImpl(IRIfElse* ifInst)
+{
+ if (ifInst->findDecorationImpl(kIROp_BranchDecoration))
+ {
+ m_writer->emit("[branch]\n");
+ }
+ else if (ifInst->findDecorationImpl(kIROp_FlattenDecoration))
+ {
+ m_writer->emit("[flatten]\n");
+ }
+}
+
+void HLSLSourceEmitter::emitSwitchDecorationsImpl(IRSwitch* switchInst)
+{
+ if (switchInst->findDecorationImpl(kIROp_BranchDecoration))
+ {
+ m_writer->emit("[branch]\n");
+ }
+}
+
void HLSLSourceEmitter::emitFuncDecorationImpl(IRDecoration* decoration)
{
switch( decoration->getOp() )