Improve error message for image/sampler functions for enhanced-msgs

For recent GLSL versions, if texture2D function call appears, the error
message reports an unsupported type constructor. Change message to
unsupported function. Likewise for other removed texture* function calls.
This commit is contained in:
Greg Fischer 2022-02-18 15:08:28 -07:00
parent 90d4bd05cd
commit bbe692e731
4 changed files with 22 additions and 1 deletions

View file

@ -2799,7 +2799,10 @@ TFunction* TParseContext::handleConstructorCall(const TSourceLoc& loc, const TPu
TOperator op = intermediate.mapTypeToConstructorOp(type);
if (op == EOpNull) {
error(loc, "cannot construct this type", type.getBasicString(), "");
if (intermediate.getEnhancedMsgs() && type.getBasicType() == EbtSampler)
error(loc, "function not supported in this version; use texture() instead", "texture*D*", "");
else
error(loc, "cannot construct this type", type.getBasicString(), "");
op = EOpConstructFloat;
TType errorType(EbtFloat);
type.shallowCopy(errorType);