MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / enterFunction

Method enterFunction

SPIRV/SpvBuilder.cpp:2881–2913  ·  view source on GitHub ↗

Comments in header

Source from the content-addressed store, hash-verified

2879
2880// Comments in header
2881void Builder::enterFunction(Function const* function)
2882{
2883 currentFunction = function;
2884
2885 // Save and disable debugInfo for HLSL entry point function. It is a wrapper
2886 // function with no user code in it.
2887 restoreNonSemanticShaderDebugInfo = emitNonSemanticShaderDebugInfo;
2888 if (sourceLang == spv::SourceLanguage::HLSL && function == entryPointFunction) {
2889 emitNonSemanticShaderDebugInfo = false;
2890 }
2891
2892 if (emitNonSemanticShaderDebugInfo) {
2893 // Initialize scope state
2894 Id funcId = function->getFuncId();
2895 Id debugFuncId = getDebugFunction(funcId);
2896 currentDebugScopeId.push(debugFuncId);
2897 // Create DebugFunctionDefinition
2898 spv::Id resultId = getUniqueId();
2899 Instruction* defInst = new Instruction(resultId, makeVoidType(), Op::OpExtInst);
2900 defInst->reserveOperands(4);
2901 defInst->addIdOperand(nonSemanticShaderDebugInfo);
2902 defInst->addImmediateOperand(NonSemanticShaderDebugInfoDebugFunctionDefinition);
2903 defInst->addIdOperand(debugFuncId);
2904 defInst->addIdOperand(funcId);
2905 addInstruction(std::unique_ptr<Instruction>(defInst));
2906 }
2907
2908 if (auto linkType = function->getLinkType(); linkType != LinkageType::Max) {
2909 Id funcId = function->getFuncId();
2910 addCapability(Capability::Linkage);
2911 addLinkageDecoration(funcId, function->getExportName(), linkType);
2912 }
2913}
2914
2915// Comments in header
2916void Builder::leaveFunction()

Callers 1

visitAggregateMethod · 0.80

Calls 7

getFuncIdMethod · 0.80
reserveOperandsMethod · 0.80
addIdOperandMethod · 0.80
addImmediateOperandMethod · 0.80
getExportNameMethod · 0.80
pushMethod · 0.45
getLinkTypeMethod · 0.45

Tested by

no test coverage detected