Implement atomic counter offset semantics.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27760 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
aa657c117e
commit
d78ca6297d
10 changed files with 207 additions and 66 deletions
|
|
@ -321,7 +321,8 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
symbol.getQualifier().layoutLocation != unitSymbol.getQualifier().layoutLocation ||
|
||||
symbol.getQualifier().layoutComponent != unitSymbol.getQualifier().layoutComponent ||
|
||||
symbol.getQualifier().layoutIndex != unitSymbol.getQualifier().layoutIndex ||
|
||||
symbol.getQualifier().layoutBinding != unitSymbol.getQualifier().layoutBinding) {
|
||||
symbol.getQualifier().layoutBinding != unitSymbol.getQualifier().layoutBinding ||
|
||||
(symbol.getQualifier().hasBinding() && (symbol.getQualifier().layoutOffset != unitSymbol.getQualifier().layoutOffset))) {
|
||||
error(infoSink, "Layout qualification must match:");
|
||||
writeTypeComparison = true;
|
||||
}
|
||||
|
|
@ -661,6 +662,30 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
|||
return -1; // no collision
|
||||
}
|
||||
|
||||
// Accumulate locations used for inputs, outputs, and uniforms, and check for collisions
|
||||
// as the accumulation is done.
|
||||
//
|
||||
// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
|
||||
//
|
||||
int TIntermediate::addUsedOffsets(int binding, int offset, int numOffsets)
|
||||
{
|
||||
TRange bindingRange(binding, binding);
|
||||
TRange offsetRange(offset, offset + numOffsets - 1);
|
||||
TOffsetRange range(bindingRange, offsetRange);
|
||||
|
||||
// check for collisions, except for vertex inputs on desktop
|
||||
for (size_t r = 0; r < usedAtomics.size(); ++r) {
|
||||
if (range.overlap(usedAtomics[r])) {
|
||||
// there is a collision; pick one
|
||||
return std::max(offset, usedAtomics[r].offset.start);
|
||||
}
|
||||
}
|
||||
|
||||
usedAtomics.push_back(range);
|
||||
|
||||
return -1; // no collision
|
||||
}
|
||||
|
||||
// Recursively figure out how many locations are used up by an input or output type.
|
||||
// Return the size of type, as measured by "locations".
|
||||
int TIntermediate::computeTypeLocationSize(const TType& type) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue