summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-spirv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
-rw-r--r--source/slang/slang-emit-spirv.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp
index dc5352041..52e8e3d65 100644
--- a/source/slang/slang-emit-spirv.cpp
+++ b/source/slang/slang-emit-spirv.cpp
@@ -5121,6 +5121,42 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex
}
}
break;
+ case kIROp_FpDenormalPreserveDecoration:
+ {
+ auto fpDenormalDecor = cast<IRFpDenormalPreserveDecoration>(decoration);
+ auto width = int32_t(getIntVal(fpDenormalDecor->getWidth()));
+ ensureExtensionDeclaration(UnownedStringSlice("SPV_KHR_float_controls"));
+ requireSPIRVCapability(SpvCapabilityDenormPreserve);
+ // emitInst is used instead of requireSPIRVExecutionMode because
+ // we need to be able to emit the same execution mode with different
+ // operands for different widths
+ emitInst(
+ getSection(SpvLogicalSectionID::ExecutionModes),
+ decoration,
+ SpvOpExecutionMode,
+ dstID,
+ SpvExecutionModeDenormPreserve,
+ SpvLiteralInteger::from32(width));
+ }
+ break;
+ case kIROp_FpDenormalFlushToZeroDecoration:
+ {
+ auto fpDenormalDecor = cast<IRFpDenormalFlushToZeroDecoration>(decoration);
+ auto width = int32_t(getIntVal(fpDenormalDecor->getWidth()));
+ ensureExtensionDeclaration(UnownedStringSlice("SPV_KHR_float_controls"));
+ requireSPIRVCapability(SpvCapabilityDenormFlushToZero);
+ // emitInst is used instead of requireSPIRVExecutionMode because
+ // we need to be able to emit the same execution mode with different
+ // operands for different widths
+ emitInst(
+ getSection(SpvLogicalSectionID::ExecutionModes),
+ decoration,
+ SpvOpExecutionMode,
+ dstID,
+ SpvExecutionModeDenormFlushToZero,
+ SpvLiteralInteger::from32(width));
+ }
+ break;
case kIROp_MaxVertexCountDecoration:
// Don't do anything here, instead wait until we see OutputTopologyDecoration
// and emit them together to ensure MaxVertexCount always appears before