Commit 9c010dd6 by Nicolas Capens Committed by Nicolas Capens

Allow length() method on any array expression.

GLSL ES 3.00 spec says that length is only allowed on "array names", but according to https://bugs.chromium.org/p/angleproject/issues/detail?id=2142 that was not intended to be interpreted strictly and it has been clarified in GLSL ES 3.20. Change-Id: Id8944346908e1c122230fd2f94c9a26cf389498b Reviewed-on: https://swiftshader-review.googlesource.com/15550Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 7cbb1de2
......@@ -3536,18 +3536,6 @@ TIntermTyped *TParseContext::addFunctionCallOrMethod(TFunction *fnCall, TIntermN
else
{
arraySize = typedThis->getArraySize();
if(typedThis->getAsSymbolNode() == nullptr)
{
// This code path can be hit with expressions like these:
// (a = b).length()
// (func()).length()
// (int[3](0, 1, 2)).length()
// ESSL 3.00 section 5.9 defines expressions so that this is not actually a valid expression.
// It allows "An array name with the length method applied" in contrast to GLSL 4.4 spec section 5.9
// which allows "An array, vector or matrix expression with the length method applied".
error(loc, "length can only be called on array names, not on array expressions", "length");
recover();
}
}
unionArray->setIConst(arraySize);
callNode = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), loc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment