Populates a binary stream's |header|. The target environment is specified via |env| and Id bound is via |bound|.
| 846 | // Populates a binary stream's |header|. The target environment is specified via |
| 847 | // |env| and Id bound is via |bound|. |
| 848 | spv_result_t SetHeader(spv_target_env env, const uint32_t bound, |
| 849 | uint32_t* header) { |
| 850 | if (!header) return SPV_ERROR_INVALID_BINARY; |
| 851 | |
| 852 | header[SPV_INDEX_MAGIC_NUMBER] = spv::MagicNumber; |
| 853 | header[SPV_INDEX_VERSION_NUMBER] = spvVersionForTargetEnv(env); |
| 854 | header[SPV_INDEX_GENERATOR_NUMBER] = |
| 855 | SPV_GENERATOR_WORD(SPV_GENERATOR_KHRONOS_ASSEMBLER, kAssemblerVersion); |
| 856 | header[SPV_INDEX_BOUND] = bound; |
| 857 | header[SPV_INDEX_SCHEMA] = 0; // NOTE: Reserved |
| 858 | |
| 859 | return SPV_SUCCESS; |
| 860 | } |
| 861 | |
| 862 | // Collects all numeric ids in the module source into |numeric_ids|. |
| 863 | // This function is essentially a dry-run of spvTextToBinary. |
no test coverage detected