Add reflection queries for thread local size and ssbo auto-binding
New command line option --shift-ssbo-binding mirrors --shift-ubo-binding, etc. New reflection query getLocalSize(int dim) queries local size, e.g, CS threads.
This commit is contained in:
parent
5da1f038d8
commit
932bb5cc4e
11 changed files with 265 additions and 15 deletions
|
|
@ -122,7 +122,7 @@ public:
|
|||
|
||||
virtual void visitSymbol(TIntermSymbol* base)
|
||||
{
|
||||
if (base->getQualifier().storage == EvqUniform) {
|
||||
if (base->getType().getQualifier().isUniformOrBuffer()) {
|
||||
TVarEntryInfo ent = { base->getId(), base, !traverseAll };
|
||||
TVarLiveMap::iterator at = std::lower_bound(varLiveList.begin(), varLiveList.end(), ent, TVarEntryInfo::TOrderById());
|
||||
if (at != varLiveList.end() && at->id == ent.id)
|
||||
|
|
@ -227,6 +227,7 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
|
|||
int baseTextureBinding;
|
||||
int baseImageBinding;
|
||||
int baseUboBinding;
|
||||
int baseSsboBinding;
|
||||
bool doAutoMapping;
|
||||
typedef std::vector<int> TSlotSet;
|
||||
typedef std::unordered_map<int, TSlotSet> TSlotSetMap;
|
||||
|
|
@ -281,8 +282,11 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
|
|||
return checkEmpty(set, baseTextureBinding + type.getQualifier().layoutBinding);
|
||||
}
|
||||
|
||||
if (type.getQualifier().isUniformOrBuffer())
|
||||
if (type.getQualifier().storage == EvqUniform)
|
||||
return checkEmpty(set, baseUboBinding + type.getQualifier().layoutBinding);
|
||||
|
||||
if (type.getQualifier().storage == EvqBuffer)
|
||||
return checkEmpty(set, baseSsboBinding + type.getQualifier().layoutBinding);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -308,8 +312,11 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
|
|||
return reserveSlot(set, baseTextureBinding + type.getQualifier().layoutBinding);
|
||||
}
|
||||
|
||||
if (type.getQualifier().isUniformOrBuffer())
|
||||
if (type.getQualifier().storage == EvqUniform)
|
||||
return reserveSlot(set, baseUboBinding + type.getQualifier().layoutBinding);
|
||||
|
||||
if (type.getQualifier().storage == EvqBuffer)
|
||||
return reserveSlot(set, baseSsboBinding + type.getQualifier().layoutBinding);
|
||||
} else if (is_live && doAutoMapping) {
|
||||
// find free slot, the caller did make sure it passes all vars with binding
|
||||
// first and now all are passed that do not have a binding and needs one
|
||||
|
|
@ -325,8 +332,11 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
|
|||
return getFreeSlot(set, baseTextureBinding);
|
||||
}
|
||||
|
||||
if (type.getQualifier().isUniformOrBuffer())
|
||||
if (type.getQualifier().storage == EvqUniform)
|
||||
return getFreeSlot(set, baseUboBinding);
|
||||
|
||||
if (type.getQualifier().storage == EvqBuffer)
|
||||
return getFreeSlot(set, baseSsboBinding);
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
|
@ -351,6 +361,7 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
|
|||
intermediate.getShiftTextureBinding() == 0 &&
|
||||
intermediate.getShiftImageBinding() == 0 &&
|
||||
intermediate.getShiftUboBinding() == 0 &&
|
||||
intermediate.getShiftSsboBinding() == 0 &&
|
||||
intermediate.getAutoMapBindings() == false &&
|
||||
resolver == nullptr)
|
||||
return true;
|
||||
|
|
@ -369,6 +380,7 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
|
|||
defaultResolver.baseTextureBinding = intermediate.getShiftTextureBinding();
|
||||
defaultResolver.baseImageBinding = intermediate.getShiftImageBinding();
|
||||
defaultResolver.baseUboBinding = intermediate.getShiftUboBinding();
|
||||
defaultResolver.baseSsboBinding = intermediate.getShiftSsboBinding();
|
||||
defaultResolver.doAutoMapping = intermediate.getAutoMapBindings();
|
||||
|
||||
resolver = &defaultResolver;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue