MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / AddVariableIdToEntryPointInterfaces

Function AddVariableIdToEntryPointInterfaces

source/fuzz/fuzzer_util.cpp:874–889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

872}
873
874void AddVariableIdToEntryPointInterfaces(opt::IRContext* context, uint32_t id) {
875 if (GlobalVariablesMustBeDeclaredInEntryPointInterfaces(context)) {
876 // Conservatively add this global to the interface of every entry point in
877 // the module. This means that the global is available for other
878 // transformations to use.
879 //
880 // A downside of this is that the global will be in the interface even if it
881 // ends up never being used.
882 //
883 // TODO(https://github.com/KhronosGroup/SPIRV-Tools/issues/3111) revisit
884 // this if a more thorough approach to entry point interfaces is taken.
885 for (auto& entry_point : context->module()->entry_points()) {
886 entry_point.AddOperand({SPV_OPERAND_TYPE_ID, {id}});
887 }
888 }
889}
890
891opt::Instruction* AddGlobalVariable(opt::IRContext* context, uint32_t result_id,
892 uint32_t type_id,

Callers 1

AddGlobalVariableFunction · 0.85

Calls 4

entry_pointsMethod · 0.80
AddOperandMethod · 0.80
moduleMethod · 0.45

Tested by

no test coverage detected