Add begin/end iterators for each section to ease iteration

This commit is contained in:
baldurk
2018-01-08 15:56:53 +00:00
parent e59dea2142
commit 74ac75289b
2 changed files with 24 additions and 6 deletions
@@ -312,21 +312,36 @@ SPIRVIterator SPIRVEditor::GetEntry(SPIRVId id)
return SPIRVIterator();
}
SPIRVIterator SPIRVEditor::GetDebugInstructions()
SPIRVIterator SPIRVEditor::BeginDebug()
{
return SPIRVIterator(spirv, debugSection.startOffset);
}
SPIRVIterator SPIRVEditor::GetDecorationInstructions()
SPIRVIterator SPIRVEditor::BeginDecorations()
{
return SPIRVIterator(spirv, decorationSection.startOffset);
}
SPIRVIterator SPIRVEditor::GetTypeInstructions()
SPIRVIterator SPIRVEditor::BeginTypes()
{
return SPIRVIterator(spirv, typeVarSection.startOffset);
}
SPIRVIterator SPIRVEditor::EndDebug()
{
return SPIRVIterator(spirv, debugSection.endOffset);
}
SPIRVIterator SPIRVEditor::EndDecorations()
{
return SPIRVIterator(spirv, decorationSection.endOffset);
}
SPIRVIterator SPIRVEditor::EndTypes()
{
return SPIRVIterator(spirv, typeVarSection.endOffset);
}
SPIRVId SPIRVEditor::DeclareType(const SPIRVVoid &)
{
if(voidType)
@@ -326,9 +326,12 @@ public:
// the entry point has 'two' opcodes, the entrypoint declaration and the function.
// This returns the first, GetID returns the second.
SPIRVIterator GetEntry(SPIRVId id);
SPIRVIterator GetDebugInstructions();
SPIRVIterator GetDecorationInstructions();
SPIRVIterator GetTypeInstructions();
SPIRVIterator BeginDebug();
SPIRVIterator BeginDecorations();
SPIRVIterator BeginTypes();
SPIRVIterator EndDebug();
SPIRVIterator EndDecorations();
SPIRVIterator EndTypes();
// fetches the id of this type. If it exists already the old ID will be returned, otherwise it
// will be declared and the new ID returned