Commit e29324ff by Olli Etuaho Committed by Commit Bot

Don't allow returning a struct containing an array in ESSL 1.00

ESSL 1.00.17 section 6.1 forbids this. Returning arrays was already covered by the checks that disallow declaring array types in ESSL 1.00. BUG=angleproject:1015 TEST=dEQP-GLES2.functional.shaders.functions.* (2 new tests pass) dEQP-GLES3.functional.shaders.functions.* (no regression) Change-Id: Iaffa1631c0c940afb57819221e7e8603b2305021 Reviewed-on: https://chromium-review.googlesource.com/352920Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 51f40ecd
......@@ -2198,6 +2198,20 @@ TFunction *TParseContext::parseFunctionHeader(const TPublicType &type,
{
recover();
}
if (mShaderVersion < 300)
{
// Array return values are forbidden, but there's also no valid syntax for declaring array
// return values in ESSL 1.00.
ASSERT(type.arraySize == 0 || mDiagnostics.numErrors() > 0);
if (type.isStructureContainingArrays())
{
// ESSL 1.00.17 section 6.1 Function Definitions
error(location, "structures containing arrays can't be function return values",
TType(type).getCompleteString().c_str());
recover();
}
}
// Add the function as a prototype after parsing it (we do not support recursion)
return new TFunction(name, new TType(type));
......
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