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:
comex
2020-11-24 18:24:28 -05:00
committed by Rodrigo Locatti
parent 13396c96ac
commit 63c5b548c5
2 changed files with 4 additions and 2 deletions

View File

@@ -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);
}