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