Front-end: Fix issue #409, check for implicitly-sized binding arrays.

This commit is contained in:
John Kessenich 2016-07-27 14:43:01 -06:00
parent e15509e450
commit 414f735443
5 changed files with 15 additions and 5 deletions

View file

@ -4544,8 +4544,13 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
error(loc, "requires block, or sampler/image, or atomic-counter type", "binding", "");
if (type.getBasicType() == EbtSampler) {
int lastBinding = qualifier.layoutBinding;
if (type.isArray())
lastBinding += type.getCumulativeArraySize();
if (type.isArray()) {
if (type.isImplicitlySizedArray()) {
lastBinding += 1;
warn(loc, "assuming array size of one for compile-time checking of binding numbers for implicitly-sized array", "[]", "");
} else
lastBinding += type.getCumulativeArraySize();
}
if (lastBinding >= resources.maxCombinedTextureImageUnits)
error(loc, "sampler binding not less than gl_MaxCombinedTextureImageUnits", "binding", type.isArray() ? "(using array)" : "");
}