Commit 93a90fd0 by Olli Etuaho

Remove half-baked non-sized array support

ANGLE used to accept shaders with non-sized arrays in initializer lists. Fix this. Proper support for implicitly sized arrays will be implemented later for ESSL3. TEST=angle_unittests BUG=angleproject:941 Change-Id: I53c5ccf0f7ef09ad30e142f8350812959fc4846c Reviewed-on: https://chromium-review.googlesource.com/264360Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 5c60031e
......@@ -1462,7 +1462,7 @@ TIntermAggregate* TParseContext::parseArrayDeclarator(TPublicType &publicType, c
{
recover();
}
else if (indexExpression)
else
{
int size;
if (arraySizeErrorCheck(arrayLocation, indexExpression, size))
......@@ -1477,14 +1477,6 @@ TIntermAggregate* TParseContext::parseArrayDeclarator(TPublicType &publicType, c
return intermediate.growAggregate(declaratorList, intermediate.addSymbol(variable ? variable->getUniqueId() : 0, identifier, type, identifierLocation), identifierLocation);
}
else
{
TPublicType arrayType(publicType);
arrayType.setArray(true);
TVariable* variable = NULL;
if (arrayErrorCheck(arrayLocation, identifier, arrayType, variable))
recover();
}
return NULL;
}
......
......@@ -883,10 +883,6 @@ init_declarator_list
$$ = $1;
$$.intermAggregate = context->parseDeclarator($$.type, $1.intermAggregate, $3.symbol, @3, *$3.string);
}
| init_declarator_list COMMA identifier LEFT_BRACKET RIGHT_BRACKET {
$$ = $1;
context->parseArrayDeclarator($$.type, @3, *$3.string, @4, NULL, NULL);
}
| init_declarator_list COMMA identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
$$ = $1;
$$.intermAggregate = context->parseArrayDeclarator($$.type, @3, *$3.string, @4, $1.intermNode, $5);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -197,3 +197,19 @@ TEST_F(MalformedShaderTest, AssignStructsContainingSamplers)
FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
}
}
// This is a regression test for a particular bug that was in ANGLE.
// It also verifies that ESSL3 functionality doesn't leak to ESSL1.
TEST_F(MalformedShaderTest, ArrayWithNoSizeInInitializerList)
{
const std::string &shaderString =
"precision mediump float;\n"
"void main() {\n"
" float a[2], b[];\n"
" gl_FragColor = vec4(1.0);\n"
"}\n";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure " << mInfoLog;
}
}
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