index outside gl_SampleMask range, compiler need report error. (#3556)

This commit is contained in:
jimihem 2024-04-18 08:14:26 +08:00 committed by GitHub
parent 593dbafd0d
commit 68df223056
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 0 deletions

View file

@ -598,6 +598,10 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
indexValue >= resources.maxCullDistances) {
error(loc, "gl_CullDistance", "[", "array index out of range '%d'", indexValue);
}
else if (base->getQualifier().builtIn == EbvSampleMask &&
indexValue >= (resources.maxSamples + 31) / 32) {
error(loc, "gl_SampleMask", "[", "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();