mirror of
https://git.suyu.dev/suyu/sirit.git
synced 2024-12-22 04:02:03 +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
2 changed files with 4 additions and 2 deletions
|
@ -42,8 +42,10 @@ std::vector<u32> Module::Assemble() const {
|
|||
}
|
||||
|
||||
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();
|
||||
words.resize(words.size() + WordsInString(extension_name));
|
||||
words.resize(words.size() + count);
|
||||
InsertStringView(words, insert_index, extension_name);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ struct OpId {
|
|||
struct EndOp {};
|
||||
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue