| 872 | } |
| 873 | |
| 874 | void 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 | |
| 891 | opt::Instruction* AddGlobalVariable(opt::IRContext* context, uint32_t result_id, |
| 892 | uint32_t type_id, |
no test coverage detected