Get magic number and version from spirv.h.
This is a part of the effort to clean up libspirv.h.
This commit is contained in:
Родитель
2119694775
Коммит
9049bb4877
|
@ -40,11 +40,6 @@ extern "C" {
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Magic numbers
|
||||
|
||||
#define SPV_MAGIC_NUMBER 0x07230203
|
||||
#define SPV_VERSION_NUMBER 99u
|
||||
|
||||
// Header indices
|
||||
|
||||
#define SPV_INDEX_MAGIC_NUMBER 0u
|
||||
|
|
|
@ -662,8 +662,8 @@ namespace {
|
|||
spv_result_t SetHeader(uint32_t* words, const uint32_t bound) {
|
||||
if (!words) return SPV_ERROR_INVALID_BINARY;
|
||||
|
||||
words[SPV_INDEX_MAGIC_NUMBER] = SPV_MAGIC_NUMBER;
|
||||
words[SPV_INDEX_VERSION_NUMBER] = SPV_VERSION_NUMBER;
|
||||
words[SPV_INDEX_MAGIC_NUMBER] = SpvMagicNumber;
|
||||
words[SPV_INDEX_VERSION_NUMBER] = SpvVersion;
|
||||
words[SPV_INDEX_GENERATOR_NUMBER] = SPV_GENERATOR_KHRONOS;
|
||||
words[SPV_INDEX_BOUND] = bound;
|
||||
words[SPV_INDEX_SCHEMA] = 0; // NOTE: Reserved
|
||||
|
|
|
@ -33,8 +33,8 @@ class BinaryHeaderGet : public ::testing::Test {
|
|||
BinaryHeaderGet() { memset(code, 0, sizeof(code)); }
|
||||
|
||||
virtual void SetUp() {
|
||||
code[0] = SPV_MAGIC_NUMBER;
|
||||
code[1] = SPV_VERSION_NUMBER;
|
||||
code[0] = SpvMagicNumber;
|
||||
code[1] = SpvVersion;
|
||||
code[2] = SPV_GENERATOR_CODEPLAY;
|
||||
code[3] = 1; // NOTE: Bound
|
||||
code[4] = 0; // NOTE: Schema; reserved
|
||||
|
@ -57,9 +57,9 @@ TEST_F(BinaryHeaderGet, Default) {
|
|||
spv_header_t header;
|
||||
ASSERT_EQ(SPV_SUCCESS, spvBinaryHeaderGet(&binary, endian, &header));
|
||||
|
||||
ASSERT_EQ((uint32_t)SPV_MAGIC_NUMBER, header.magic);
|
||||
ASSERT_EQ(static_cast<uint32_t>(SpvMagicNumber), header.magic);
|
||||
ASSERT_EQ(99u, header.version);
|
||||
ASSERT_EQ((uint32_t)SPV_GENERATOR_CODEPLAY, header.generator);
|
||||
ASSERT_EQ(static_cast<uint32_t>(SPV_GENERATOR_CODEPLAY), header.generator);
|
||||
ASSERT_EQ(1u, header.bound);
|
||||
ASSERT_EQ(0u, header.schema);
|
||||
ASSERT_EQ(&code[5], header.instructions);
|
||||
|
|
|
@ -189,8 +189,8 @@ TEST(TextToBinary, Default) {
|
|||
EXPECT_NE(0, binary->wordCount);
|
||||
|
||||
// TODO: Verify binary
|
||||
ASSERT_EQ(SPV_MAGIC_NUMBER, binary->code[SPV_INDEX_MAGIC_NUMBER]);
|
||||
ASSERT_EQ(SPV_VERSION_NUMBER, binary->code[SPV_INDEX_VERSION_NUMBER]);
|
||||
ASSERT_EQ(SpvMagicNumber, binary->code[SPV_INDEX_MAGIC_NUMBER]);
|
||||
ASSERT_EQ(SpvVersion, binary->code[SPV_INDEX_VERSION_NUMBER]);
|
||||
ASSERT_EQ(SPV_GENERATOR_KHRONOS, binary->code[SPV_INDEX_GENERATOR_NUMBER]);
|
||||
ASSERT_EQ(16, binary->code[SPV_INDEX_BOUND]); // TODO: Bound?
|
||||
ASSERT_EQ(0, binary->code[SPV_INDEX_SCHEMA]); // Reserved: schema
|
||||
|
|
Загрузка…
Ссылка в новой задаче