mirror of
https://github.com/shadps4-emu/sirit.git
synced 2024-12-05 01:36:49 +00:00
Fix declarations hashing
This commit is contained in:
parent
ae7c664016
commit
bb6a3421d2
@ -920,6 +920,15 @@ public:
|
|||||||
Id OpImageQuerySamples(Id result_type, Id image);
|
Id OpImageQuerySamples(Id result_type, Id image);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct HashOp {
|
||||||
|
std::size_t operator()(const std::unique_ptr<Op>& op) const noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct EqualOp {
|
||||||
|
bool operator()(const std::unique_ptr<Op>& lhs, const std::unique_ptr<Op>& rhs) const
|
||||||
|
noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
Id AddCode(std::unique_ptr<Op> op);
|
Id AddCode(std::unique_ptr<Op> op);
|
||||||
|
|
||||||
Id AddCode(spv::Op opcode, std::optional<std::uint32_t> id = {});
|
Id AddCode(spv::Op opcode, std::optional<std::uint32_t> id = {});
|
||||||
@ -945,7 +954,7 @@ private:
|
|||||||
std::vector<std::unique_ptr<Op>> execution_modes;
|
std::vector<std::unique_ptr<Op>> execution_modes;
|
||||||
std::vector<std::unique_ptr<Op>> debug;
|
std::vector<std::unique_ptr<Op>> debug;
|
||||||
std::vector<std::unique_ptr<Op>> annotations;
|
std::vector<std::unique_ptr<Op>> annotations;
|
||||||
std::unordered_set<std::unique_ptr<Op>> declarations;
|
std::unordered_set<std::unique_ptr<Op>, HashOp, EqualOp> declarations;
|
||||||
std::vector<Id> sorted_declarations;
|
std::vector<Id> sorted_declarations;
|
||||||
|
|
||||||
std::vector<Id> global_variables;
|
std::vector<Id> global_variables;
|
||||||
|
@ -20,6 +20,15 @@ static void WriteSet(Stream& stream, const T& set) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t Module::HashOp::operator()(const std::unique_ptr<Op>& op) const noexcept {
|
||||||
|
return op->Hash();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Module::EqualOp::operator()(const std::unique_ptr<Op>& lhs,
|
||||||
|
const std::unique_ptr<Op>& rhs) const noexcept {
|
||||||
|
return *lhs == *rhs;
|
||||||
|
}
|
||||||
|
|
||||||
Module::Module(u32 version) : version(version) {}
|
Module::Module(u32 version) : version(version) {}
|
||||||
|
|
||||||
Module::~Module() = default;
|
Module::~Module() = default;
|
||||||
|
Loading…
Reference in New Issue
Block a user