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

Function SetHeader

source/text.cpp:848–860  ·  view source on GitHub ↗

Populates a binary stream's |header|. The target environment is specified via |env| and Id bound is via |bound|.

Source from the content-addressed store, hash-verified

846// Populates a binary stream's |header|. The target environment is specified via
847// |env| and Id bound is via |bound|.
848spv_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.

Callers 1

spvTextToBinaryInternalFunction · 0.85

Calls 1

spvVersionForTargetEnvFunction · 0.85

Tested by

no test coverage detected