From: Mikko Rasa Date: Wed, 14 Apr 2021 16:12:31 +0000 (+0300) Subject: Add generator ID for the SPIR-V compiler X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=677744faccc5d3ac14fd468267f622ba6187dc74;p=libs%2Fgl.git Add generator ID for the SPIR-V compiler --- diff --git a/source/glsl/spirv.cpp b/source/glsl/spirv.cpp index 799e31d6..be226b3c 100644 --- a/source/glsl/spirv.cpp +++ b/source/glsl/spirv.cpp @@ -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) diff --git a/source/glsl/spirvconstants.h b/source/glsl/spirvconstants.h index b981d191..9e21b269 100644 --- a/source/glsl/spirvconstants.h +++ b/source/glsl/spirvconstants.h @@ -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 diff --git a/source/glsl/spirvwriter.cpp b/source/glsl/spirvwriter.cpp index 77ddbdb9..30369f2c 100644 --- a/source/glsl/spirvwriter.cpp +++ b/source/glsl/spirvwriter.cpp @@ -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); diff --git a/source/glsl/spirvwriter.h b/source/glsl/spirvwriter.h index 94f44e88..fb5ec644 100644 --- a/source/glsl/spirvwriter.h +++ b/source/glsl/spirvwriter.h @@ -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