GLSL: Fix #1591: Require the id in subgroupBroadcast to be constant.

This commit is contained in:
John Kessenich 2018-11-21 14:43:18 -07:00
parent d2a7b07a64
commit f2675d4d6c
6 changed files with 399 additions and 369 deletions

View file

@ -1998,6 +1998,10 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
case EOpSubgroupClusteredAnd:
case EOpSubgroupClusteredOr:
case EOpSubgroupClusteredXor:
// The <clusterSize> as used in the subgroupClustered<op>() operations must be:
// - An integral constant expression.
// - At least 1.
// - A power of 2.
if ((*argp)[1]->getAsConstantUnion() == nullptr)
error(loc, "argument must be compile-time constant", "cluster size", "");
else {
@ -2009,6 +2013,12 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
}
break;
case EOpSubgroupBroadcast:
// <id> must be an integral constant expression.
if ((*argp)[1]->getAsConstantUnion() == nullptr)
error(loc, "argument must be compile-time constant", "id", "");
break;
case EOpBarrier:
case EOpMemoryBarrier:
if (argp->size() > 0) {