@@ -233,6 +233,7 @@ class TGlslangToSpvTraverser : public glslang::TIntermTraverser {
233233 spv::SelectionControlMask TranslateSelectionControl(const glslang::TIntermSelection&) const;
234234 spv::SelectionControlMask TranslateSwitchControl(const glslang::TIntermSwitch&) const;
235235 spv::LoopControlMask TranslateLoopControl(const glslang::TIntermLoop&, std::vector<unsigned int>& operands) const;
236+ spv::FunctionControlMask TranslateFunctionControl(unsigned int) const;
236237 spv::StorageClass TranslateStorageClass(const glslang::TType&);
237238 void TranslateLiterals(const glslang::TVector<const glslang::TIntermConstantUnion*>&, std::vector<unsigned>&) const;
238239 void addIndirectionIndexCapabilities(const glslang::TType& baseType, const glslang::TType& indexType);
@@ -1428,6 +1429,18 @@ spv::SelectionControlMask TGlslangToSpvTraverser::TranslateSwitchControl(const g
14281429 return spv::SelectionControlMask::MaskNone;
14291430}
14301431
1432+ spv::FunctionControlMask TGlslangToSpvTraverser::TranslateFunctionControl(unsigned int functionControl) const
1433+ {
1434+ spv::FunctionControlMask control = spv::FunctionControlMask::MaskNone;
1435+
1436+ if (functionControl & glslang::EfcInline)
1437+ control = control | spv::FunctionControlMask::Inline;
1438+ if (functionControl & glslang::EfcDontInline)
1439+ control = control | spv::FunctionControlMask::DontInline;
1440+
1441+ return control;
1442+ }
1443+
14311444// return a non-0 dependency if the dependency argument must be set
14321445spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(const glslang::TIntermLoop& loopNode,
14331446 std::vector<unsigned int>& operands) const
@@ -7493,6 +7506,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
74937506 builder.setDebugSourceLocation(glslFunction->getLoc().line, glslFunction->getLoc().getFilename());
74947507
74957508 if (isShaderEntryPoint(glslFunction)) {
7509+ shaderEntry->setFunctionControl(TranslateFunctionControl(glslFunction->getFunctionControl()));
74967510 // For HLSL, the entry function is actually a compiler generated function to resolve the difference of
74977511 // entry function signature between HLSL and SPIR-V. So we don't emit debug information for that.
74987512 if (glslangIntermediate->getSource() != glslang::EShSourceHlsl) {
@@ -7551,6 +7565,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
75517565 TranslatePrecisionDecoration(glslFunction->getType()), convertGlslangToSpvType(glslFunction->getType()),
75527566 glslFunction->getName().c_str(), convertGlslangLinkageToSpv(glslFunction->getLinkType()), paramTypes,
75537567 paramDecorations, &functionBlock);
7568+ function->setFunctionControl(TranslateFunctionControl(glslFunction->getFunctionControl()));
75547569 builder.setupFunctionDebugInfo(function, glslFunction->getName().c_str(), paramTypes, paramNames);
75557570 if (implicitThis)
75567571 function->setImplicitThis();
0 commit comments