Compile-time check on sampler binding size, link-time merging and checking of bindings.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24218 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
474b84bdcf
commit
1fbaa35ce7
5 changed files with 35 additions and 5 deletions
|
|
@ -2687,6 +2687,13 @@ void TParseContext::layoutTypeCheck(TSourceLoc loc, const TSymbol& symbol)
|
|||
if (type.getBasicType() != EbtSampler && type.getBasicType() != EbtBlock)
|
||||
error(loc, "requires block, or sampler/image, or atomic-counter type", "binding", "");
|
||||
// TODO: 4.2 functionality: atomic counter: include in test above
|
||||
if (type.getBasicType() == EbtSampler) {
|
||||
int lastBinding = qualifier.layoutBinding;
|
||||
if (type.isArray())
|
||||
lastBinding += type.getArraySize();
|
||||
if (lastBinding >= resources.maxCombinedTextureImageUnits)
|
||||
error(loc, "sampler binding not less than gl_MaxCombinedTextureImageUnits", "binding", type.isArray() ? "(using array)" : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3721,7 +3728,7 @@ TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression,
|
|||
return switchNode;
|
||||
}
|
||||
|
||||
// TODO: simplification: constant folding: these should use a follow a fully folded model now, and probably move to Constant.cpp scheme.
|
||||
// TODO: simplification: constant folding: these should use a fully folded model now, and probably move to Constant.cpp scheme.
|
||||
|
||||
//
|
||||
// Make a constant scalar or vector node, representing a given constant vector and constant swizzle into it.
|
||||
|
|
|
|||
|
|
@ -159,6 +159,10 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin
|
|||
// the initializer
|
||||
if (symbol->getConstArray().empty() && ! unitSymbol->getConstArray().empty())
|
||||
symbol->setConstArray(unitSymbol->getConstArray());
|
||||
|
||||
// Similarly for binding
|
||||
if (! symbol->getQualifier().hasBinding() && unitSymbol->getQualifier().hasBinding())
|
||||
symbol->getQualifier().layoutBinding = unitSymbol->getQualifier().layoutBinding;
|
||||
|
||||
// Check for consistent types/qualification/initializers etc.
|
||||
mergeErrorCheck(infoSink, *symbol, *unitSymbol, false);
|
||||
|
|
@ -230,7 +234,8 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
|||
// Layouts...
|
||||
if (symbol.getQualifier().layoutMatrix != unitSymbol.getQualifier().layoutMatrix ||
|
||||
symbol.getQualifier().layoutPacking != unitSymbol.getQualifier().layoutPacking ||
|
||||
symbol.getQualifier().layoutSlotLocation != unitSymbol.getQualifier().layoutSlotLocation) {
|
||||
symbol.getQualifier().layoutSlotLocation != unitSymbol.getQualifier().layoutSlotLocation ||
|
||||
symbol.getQualifier().layoutBinding != unitSymbol.getQualifier().layoutBinding) {
|
||||
error(infoSink, "Layout qualification must match:");
|
||||
writeTypeComparison = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue