Add a SPIR-V editor helper to insert a sequence of operations at once

This commit is contained in:
baldurk
2023-10-30 10:24:30 +00:00
parent 2b779038af
commit 84e61014a1
3 changed files with 13 additions and 7 deletions
@@ -472,6 +472,17 @@ Id Editor::AddOperation(Iter iter, const Operation &op)
return OpDecoder(iter).result;
}
Iter Editor::AddOperations(Iter iter, const OperationList &ops)
{
for(const rdcspv::Operation &op : ops)
{
AddOperation(iter, op);
++iter;
}
return iter;
}
void Editor::RegisterOp(Iter it)
{
Processor::RegisterOp(it);
@@ -76,6 +76,7 @@ public:
Id MakeId();
Id AddOperation(Iter iter, const Operation &op);
Iter AddOperations(Iter iter, const OperationList &ops);
// callbacks to allow us to update our internal structures over changes
@@ -975,13 +975,7 @@ void AnnotateShader(const ShaderReflection &refl, const SPIRVPatchData &patchDat
++it;
if(funcId == entryID)
{
for(const rdcspv::Operation &op : locationGather)
{
editor.AddOperation(it, op);
++it;
}
}
editor.AddOperations(it, locationGather);
// now patch accesses in the function body
for(; it; ++it)