Use entry point interface ID list if available over building our own

This commit is contained in:
baldurk
2020-12-19 12:47:52 +00:00
parent 56c7c47a73
commit 610dda70db
3 changed files with 16 additions and 2 deletions
@@ -524,7 +524,8 @@ void Processor::RegisterOp(Iter it)
else if(opdata.op == Op::EntryPoint)
{
OpEntryPoint decoded(it);
entries.push_back(EntryPoint(decoded.executionModel, decoded.entryPoint, decoded.name));
entries.push_back(
EntryPoint(decoded.executionModel, decoded.entryPoint, decoded.name, decoded.iface));
}
else if(opdata.op == Op::ExecutionMode)
{
@@ -418,11 +418,15 @@ struct ExecutionModes
struct EntryPoint
{
EntryPoint() = default;
EntryPoint(ExecutionModel e, Id i, rdcstr n) : executionModel(e), id(i), name(n) {}
EntryPoint(ExecutionModel e, Id i, rdcstr n, const rdcarray<Id> &ids)
: executionModel(e), id(i), name(n), usedIds(ids)
{
}
ExecutionModel executionModel;
Id id;
rdcstr name;
ExecutionModes executionModes;
rdcarray<Id> usedIds;
bool operator<(const EntryPoint &o) const
{
@@ -737,6 +737,15 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
}
}
if(m_MajorVersion > 1 || m_MinorVersion >= 4)
{
// from SPIR-V 1.4 onwards we can trust the entry point interface list to give us all used
// global variables. We still use the above heuristic so we can remove unused members of
// gl_PerVertex in structs.
usedIds.clear();
usedIds.insert(entry->usedIds.begin(), entry->usedIds.end());
}
// arrays of elements, which can be appended to in any order and then sorted
rdcarray<SigParameter> inputs;
rdcarray<SigParameter> outputs;