The assembler should always make it 0.
The disassembler should ignore it.
Remove the macro support for supplying a value for it.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/6
spvGeneratorStr(SPV_GENERATOR_TOOL_PART(generator));
stream_ << "; SPIR-V\n"
<< "; Version: " << SPV_SPIRV_VERSION_MAJOR_PART(version) << "."
- << SPV_SPIRV_VERSION_MINOR_PART(version) << "."
- << SPV_SPIRV_VERSION_REVISION_PART(version) << "\n"
+ << SPV_SPIRV_VERSION_MINOR_PART(version) << "\n"
<< "; Generator: " << generator_tool;
// For unknown tools, print the numeric tool value.
if (0 == strcmp("Unknown", generator_tool)) {
// Version number macros.
// Evaluates to a well-formed version header word, given valid
-// SPIR-V version major, minor, and revision numbers.
-#define SPV_SPIRV_VERSION_WORD(MAJOR, MINOR, REVISION) \
- ((uint32_t(uint8_t(MAJOR)) << 16) | (uint32_t(uint8_t(MINOR)) << 8) | \
- uint8_t(REVISION))
+// SPIR-V version major and minor version numbers.
+#define SPV_SPIRV_VERSION_WORD(MAJOR, MINOR) \
+ ((uint32_t(uint8_t(MAJOR)) << 16) | (uint32_t(uint8_t(MINOR)) << 8))
// Returns the major version extracted from a version header word.
#define SPV_SPIRV_VERSION_MAJOR_PART(WORD) ((uint32_t(WORD) >> 16) & 0xff)
// Returns the minor version extracted from a version header word.
#define SPV_SPIRV_VERSION_MINOR_PART(WORD) ((uint32_t(WORD) >> 8) & 0xff)
-// Returns the revision number extracted from a version header word.
-#define SPV_SPIRV_VERSION_REVISION_PART(WORD) (uint32_t(WORD) & 0xff)
// Header indices
words[SPV_INDEX_MAGIC_NUMBER] = SpvMagicNumber;
words[SPV_INDEX_VERSION_NUMBER] =
- SPV_SPIRV_VERSION_WORD(SPV_SPIRV_VERSION_MAJOR, SPV_SPIRV_VERSION_MINOR,
- SPV_SPIRV_VERSION_REVISION);
+ SPV_SPIRV_VERSION_WORD(SPV_SPIRV_VERSION_MAJOR, SPV_SPIRV_VERSION_MINOR);
words[SPV_INDEX_GENERATOR_NUMBER] =
SPV_GENERATOR_WORD(SPV_GENERATOR_KHRONOS_ASSEMBLER, kAssemblerVersion);
words[SPV_INDEX_BOUND] = bound;
EXPECT_EQ(1, SPV_SPIRV_VERSION_MAJOR);
EXPECT_EQ(0, SPV_SPIRV_VERSION_MINOR);
- EXPECT_EQ(2, SPV_SPIRV_VERSION_REVISION);
- EXPECT_THAT(decoded_text->str, HasSubstr("Version: 1.0.2\n"))
+ EXPECT_THAT(decoded_text->str, HasSubstr("Version: 1.0\n"))
<< EncodeAndDecodeSuccessfully("");
spvTextDestroy(decoded_text);
}
)";
const std::string spirv_header =
R"(; SPIR-V
-; Version: 1.0.2
+; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 9
; Schema: 0)";