[glslang] Refine implicit array size interfaces. (#3074)

* [glslang] Refine implicit array size interfaces.

Help to check builtin and other variables if across stages.
This commit is contained in:
Chow 2022-12-14 02:20:28 +08:00 committed by GitHub
parent c6b3f279a7
commit f9b760e6c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 528 additions and 7 deletions

View file

@ -608,6 +608,15 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
#ifndef GLSLANG_WEB
if (base->getType().isUnsizedArray()) {
base->getWritableType().updateImplicitArraySize(indexValue + 1);
base->getWritableType().setImplicitlySized(true);
if (base->getQualifier().builtIn == EbvClipDistance &&
indexValue >= resources.maxClipDistances) {
error(loc, "gl_ClipDistance", "[", "array index out of range '%d'", indexValue);
}
else if (base->getQualifier().builtIn == EbvCullDistance &&
indexValue >= resources.maxCullDistances) {
error(loc, "gl_CullDistance", "[", "array index out of range '%d'", indexValue);
}
// For 2D per-view builtin arrays, update the inner dimension size in parent type
if (base->getQualifier().isPerView() && base->getQualifier().builtIn != EbvNone) {
TIntermBinary* binaryNode = base->getAsBinaryNode();