[dxvk] Don't remove private inpurs from interface list in SPIR-V 1.4+

And if we have to, exit after one iteration since otherwise our iterator
gets invalidated.
This commit is contained in:
Philip Rebohle 2022-07-17 03:53:40 +02:00
parent ff39819086
commit d898eff3be
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 21 additions and 11 deletions

View File

@ -171,6 +171,8 @@ namespace dxvk {
spv::StorageClass storageClass = spv::StorageClassMax;
};
uint32_t spirvVersion = code.data()[1];
std::unordered_map<uint32_t, SpirvTypeInfo> types;
std::unordered_map<uint32_t, uint32_t> constants;
std::unordered_set<uint32_t> candidates;
@ -214,6 +216,9 @@ namespace dxvk {
break;
}
}
if (ins.opCode() == spv::OpFunction)
break;
}
if (!inputVarId)
@ -292,21 +297,25 @@ namespace dxvk {
code.endInsertion();
// Remove variable from interface list
for (auto ins : code) {
if (ins.opCode() == spv::OpEntryPoint) {
uint32_t argIdx = 2 + code.strLen(ins.chr(2));
if (spirvVersion < spvVersion(1, 4)) {
for (auto ins : code) {
if (ins.opCode() == spv::OpEntryPoint) {
uint32_t argIdx = 2 + code.strLen(ins.chr(2));
while (argIdx < ins.length()) {
if (ins.arg(argIdx) == inputVarId) {
ins.setArg(0, spv::OpEntryPoint | ((ins.length() - 1) << spv::WordCountShift));
while (argIdx < ins.length()) {
if (ins.arg(argIdx) == inputVarId) {
ins.setArg(0, spv::OpEntryPoint | ((ins.length() - 1) << spv::WordCountShift));
code.beginInsertion(ins.offset() + argIdx);
code.erase(1);
code.endInsertion();
break;
code.beginInsertion(ins.offset() + argIdx);
code.erase(1);
code.endInsertion();
break;
}
argIdx += 1;
}
argIdx += 1;
break;
}
}
}

View File

@ -9,6 +9,7 @@
#include "../spirv/spirv_code_buffer.h"
#include "../spirv/spirv_compression.h"
#include "../spirv/spirv_module.h"
namespace dxvk {