Commit 8e89866d by Olli Etuaho

Remove redundant index integer check from ValidateLimitations

Non-integer indices are already rejected in the parser, so the ValidateLimitations pass doesn't need to check for them. ESSL 1.00 spec is not actually terribly clear about whether the parser should do this check, but the language grammar in the spec only has indexing with "integer_expression" so it seems like ANGLE's interpretation of only allowing indexing with integers is correct. ESSL 3.00 makes this restriction explicitly clear in section 5.7. BUG=angleproject:1254 TEST=angle_unittests Change-Id: I02b2a6f4d9fa7801a98df63ed21bc990e1585eb8 Reviewed-on: https://chromium-review.googlesource.com/317741Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com>
parent 8a76dcc7
......@@ -482,13 +482,6 @@ bool ValidateLimitations::validateIndexing(TIntermBinary *node)
bool valid = true;
TIntermTyped *index = node->getRight();
// The index expression must have integral type.
if (!index->isScalarInt()) {
error(index->getLine(),
"Index expression must have integral type",
index->getCompleteString().c_str());
valid = false;
}
// The index expession must be a constant-index-expression unless
// the operand is a uniform in a vertex shader.
TIntermTyped *operand = node->getLeft();
......
......@@ -1436,3 +1436,21 @@ TEST_F(UnrollForLoopsTest, UnlimitedForLoop)
FAIL() << "Shader compilation failed, expecting success " << mInfoLog;
}
}
// Check that indices that are not integers are rejected.
// The check should be done even if ESSL 1.00 Appendix A limitations are not applied.
TEST_F(MalformedShaderTest, NonIntegerIndex)
{
const std::string &shaderString =
"precision mediump float;\n"
"void main()\n"
"{\n"
" float f[3];\n"
" const float i = 2.0;\n"
" gl_fragColor = vec4(f[i]);\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