]> git.tdb.fi Git - libs/gl.git/commitdiff
Add generator ID for the SPIR-V compiler
authorMikko Rasa <tdb@tdb.fi>
Wed, 14 Apr 2021 16:12:31 +0000 (19:12 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 14 Apr 2021 16:12:31 +0000 (19:12 +0300)
source/glsl/spirv.cpp
source/glsl/spirvconstants.h
source/glsl/spirvwriter.cpp
source/glsl/spirvwriter.h

index 799e31d6493aa652064bfe06885760a1b2b65dbd..be226b3c556ff67650146cb8de9fbcaa2bb188cf 100644 (file)
@@ -141,7 +141,7 @@ void SpirVGenerator::apply(Module &module)
                i->content.visit(*this);
        }
 
-       writer.finalize(next_id);
+       writer.finalize(SPIRV_GENERATOR_MSP, next_id);
 }
 
 SpirVGenerator::StorageClass SpirVGenerator::get_interface_storage(const string &iface, bool block)
index b981d191c0940d8f76fdcb3981907b891aab1be6..9e21b26973ea967b8c46581d5fedacb07450d3a5 100644 (file)
@@ -8,7 +8,8 @@ namespace SL {
 enum SpirVConstants
 {
        SPIRV_MAGIC = 0x07230203,
-       SPIRV_MAGIC_REVERSED = 0x03022307
+       SPIRV_MAGIC_REVERSED = 0x03022307,
+       SPIRV_GENERATOR_MSP = 29
 };
 
 enum SpirVOpcode
index 77ddbdb95c719442120873e809a73bb489ab4c49..30369f2c8fe4fd022434711f13b59732a74538db 100644 (file)
@@ -190,11 +190,11 @@ void SpirVWriter::end_function_body()
        content.function_body.clear();
 }
 
-void SpirVWriter::finalize(Id id_bound)
+void SpirVWriter::finalize(unsigned generator, Id id_bound)
 {
        content.code.push_back(SPIRV_MAGIC);
        content.code.push_back(0x00010500);
-       content.code.push_back(0);  // Generator
+       content.code.push_back(generator<<16);
        content.code.push_back(id_bound);
        content.code.push_back(0);  // Reserved
        append(content.code, content.capabilities);
index 94f44e8883971299e73bc0649791f0a52ef6f3a5..fb5ec644d6ee68ee45f3460217f05135d20e5381 100644 (file)
@@ -64,7 +64,7 @@ public:
        bool has_current_block() const { return current_block_id; }
        void begin_function_body(Id);
        void end_function_body();
-       void finalize(Id);
+       void finalize(unsigned, Id);
 };
 
 } // namespace SL