mirror of
https://github.com/yuzu-emu/sirit
synced 2024-11-22 17:43:54 +00:00
Add OpExtension
This commit is contained in:
parent
2b0a59d890
commit
b23716087a
2 changed files with 16 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <optional>
|
||||
#include <set>
|
||||
#include <spirv/unified1/spirv.hpp11>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
|
@ -38,6 +39,9 @@ class Module {
|
|||
*/
|
||||
std::vector<std::uint8_t> Assemble() const;
|
||||
|
||||
/// Adds a SPIR-V extension.
|
||||
void AddExtension(const std::string& extension_name);
|
||||
|
||||
/// Adds a module capability.
|
||||
void AddCapability(spv::Capability capability);
|
||||
|
||||
|
@ -620,6 +624,7 @@ class Module {
|
|||
|
||||
std::uint32_t bound{1};
|
||||
|
||||
std::set<std::string> extensions;
|
||||
std::set<spv::Capability> capabilities;
|
||||
std::unique_ptr<Op> glsl_std_450;
|
||||
std::set<std::unique_ptr<Op>> ext_inst_import;
|
||||
|
|
|
@ -38,10 +38,16 @@ std::vector<u8> Module::Assemble() const {
|
|||
op.Add(static_cast<u32>(capability));
|
||||
op.Write(stream);
|
||||
}
|
||||
|
||||
for (const auto& extension_name : extensions) {
|
||||
Op op(spv::Op::OpExtension);
|
||||
op.Add(extension_name);
|
||||
op.Write(stream);
|
||||
}
|
||||
|
||||
if (glsl_std_450) {
|
||||
glsl_std_450->Write(stream);
|
||||
}
|
||||
// TODO write ext inst imports
|
||||
|
||||
Op memory_model_ref{spv::Op::OpMemoryModel};
|
||||
memory_model_ref.Add(static_cast<u32>(addressing_model));
|
||||
|
@ -59,6 +65,10 @@ std::vector<u8> Module::Assemble() const {
|
|||
return bytes;
|
||||
}
|
||||
|
||||
void Module::AddExtension(const std::string& extension_name) {
|
||||
extensions.insert(extension_name);
|
||||
}
|
||||
|
||||
void Module::AddCapability(spv::Capability capability) {
|
||||
capabilities.insert(capability);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue