Fix segfault with atomic arg check
Makes sure that we have an l-value before checking the storage type of the mem argument passed to an atomic memory operation. Fixes #3332.
This commit is contained in:
parent
323836e46b
commit
efc33d1ee5
5 changed files with 30 additions and 6 deletions
|
|
@ -2514,11 +2514,18 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
|
|||
}
|
||||
|
||||
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 && qualifier.storage != EvqtaskPayloadSharedEXT)
|
||||
error(loc,"Atomic memory function can only be used for shader storage block member or shared variable.",
|
||||
fnCandidate.getName().c_str(), "");
|
||||
const char* errMsg = "Only l-values corresponding to shader block storage or shared variables can be used with "
|
||||
"atomic memory functions.";
|
||||
if (base) {
|
||||
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 &&
|
||||
qualifier.storage != EvqtaskPayloadSharedEXT)
|
||||
error(loc, errMsg, fnCandidate.getName().c_str(), "");
|
||||
} else {
|
||||
error(loc, errMsg, fnCandidate.getName().c_str(), "");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue