Commit e0619360 by Geoff Lang Committed by Commit Bot

Skip tracking non-preprocessor tokens in disabled if-blocks

ESSL1 states that it is an error to have a non-preprocessor token before an extension pragma but ANGLE would mark a non-preprocessor token as seen even if it was in a disabled if-block. Bug: b/161716126 Change-Id: I782224bee211bc7214a2d1d98d4829b4c94101bd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2547205Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent b47f6868
...@@ -170,7 +170,7 @@ void DirectiveParser::lex(Token *token) ...@@ -170,7 +170,7 @@ void DirectiveParser::lex(Token *token)
parseDirective(token); parseDirective(token);
mPastFirstStatement = true; mPastFirstStatement = true;
} }
else if (!isEOD(token)) else if (!isEOD(token) && !skipping())
{ {
mSeenNonPreprocessorToken = true; mSeenNonPreprocessorToken = true;
} }
......
...@@ -2333,6 +2333,26 @@ TEST_P(GLSLTest, ArrayOfStructContainingArrayOfSamplers) ...@@ -2333,6 +2333,26 @@ TEST_P(GLSLTest, ArrayOfStructContainingArrayOfSamplers)
EXPECT_PIXEL_COLOR_EQ(0, 0, expected); EXPECT_PIXEL_COLOR_EQ(0, 0, expected);
} }
// Test that if a non-preprocessor token is seen in a disabled if-block then it does not disallow
// extension pragmas later
TEST_P(GLSLTest, NonPreprocessorTokensInIfBlocks)
{
constexpr const char *kFS = R"(
#if __VERSION__ >= 300
inout mediump vec4 fragData;
#else
#extension GL_EXT_shader_texture_lod :enable
#endif
void main()
{
}
)";
GLuint shader = CompileShader(GL_FRAGMENT_SHADER, kFS);
EXPECT_NE(0u, shader);
}
// Test that two constructors which have vec4 and mat2 parameters get disambiguated (issue in // Test that two constructors which have vec4 and mat2 parameters get disambiguated (issue in
// HLSL). // HLSL).
TEST_P(GLSLTest_ES3, AmbiguousConstructorCall2x2) TEST_P(GLSLTest_ES3, AmbiguousConstructorCall2x2)
......
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