mirror of
https://github.com/yuzu-emu/sirit.git
synced 2024-12-22 19:05:31 +00:00
Fix OpExtension.
There were two issues: - The word0 was omitted entirely. - The word count didn't account for the nul terminator.
This commit is contained in:
parent
13396c96ac
commit
63c5b548c5
|
@ -42,8 +42,10 @@ std::vector<u32> Module::Assemble() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const std::string_view extension_name : extensions) {
|
for (const std::string_view extension_name : extensions) {
|
||||||
|
size_t count = WordsInString(extension_name);
|
||||||
|
words.push_back(MakeWord0(spv::Op::OpExtension, count + 1));
|
||||||
size_t insert_index = words.size();
|
size_t insert_index = words.size();
|
||||||
words.resize(words.size() + WordsInString(extension_name));
|
words.resize(words.size() + count);
|
||||||
InsertStringView(words, insert_index, extension_name);
|
InsertStringView(words, insert_index, extension_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct OpId {
|
||||||
struct EndOp {};
|
struct EndOp {};
|
||||||
|
|
||||||
constexpr size_t WordsInString(std::string_view string) {
|
constexpr size_t WordsInString(std::string_view string) {
|
||||||
return string.size() / sizeof(u32);
|
return string.size() / sizeof(u32) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void InsertStringView(std::vector<u32>& words, size_t& insert_index,
|
inline void InsertStringView(std::vector<u32>& words, size_t& insert_index,
|
||||||
|
|
Loading…
Reference in a new issue