Atomic memory function can only be used for shader storage block member or shared variable.

Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
This commit is contained in:
ZhiqianXia 2021-07-12 16:57:25 +08:00
parent 4b7b86d568
commit cf52f73a0c
9 changed files with 478 additions and 2 deletions

View file

@ -2409,6 +2409,14 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
arg0->getType().isFloatingDomain()) {
requireExtensions(loc, 1, &E_GL_EXT_shader_atomic_float2, fnCandidate.getName().c_str());
}
const TIntermTyped* base = TIntermediate::findLValueBase(arg0, true , true);
const TType* refType = (base->getType().isReference()) ? base->getType().getReferentType() : nullptr;
const TQualifier& qualifier = (refType != nullptr) ? refType->getQualifier() : base->getType().getQualifier();
if (qualifier.storage != EvqShared && qualifier.storage != EvqBuffer)
error(loc,"Atomic memory function can only be used for shader storage block member or shared variable.",
fnCandidate.getName().c_str(), "");
break;
}