| 28 | constexpr auto kDefaultEnvironment = SPV_ENV_UNIVERSAL_1_6; |
| 29 | |
| 30 | std::pair<bool, std::unordered_map<std::string, std::string>> ExtractSource( |
| 31 | const std::string& spv_source) { |
| 32 | std::unique_ptr<spvtools::opt::IRContext> ctx = spvtools::BuildModule( |
| 33 | kDefaultEnvironment, spvtools::utils::CLIMessageConsumer, spv_source, |
| 34 | spvtools::SpirvTools::kDefaultAssembleOption | |
| 35 | SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); |
| 36 | std::vector<uint32_t> binary; |
| 37 | ctx->module()->ToBinary(&binary, /* skip_nop = */ false); |
| 38 | std::unordered_map<std::string, std::string> output; |
| 39 | bool result = ExtractSourceFromModule(binary, &output); |
| 40 | return std::make_pair(result, std::move(output)); |
| 41 | } |
| 42 | |
| 43 | } // namespace |
| 44 |
no test coverage detected