Commit 7142f6ce by Olli Etuaho Committed by Commit Bot

Prevent using gl_ViewID_OVR as an l-value

It's a shader input and as such should not be writable. BUG=angleproject:1669 TEST=angle_unittests Change-Id: I05cb5c63b7272dfa6e80cad57385da02504e4d8f Reviewed-on: https://chromium-review.googlesource.com/497408Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 62a416d5
...@@ -440,6 +440,9 @@ bool TParseContext::checkCanBeLValue(const TSourceLoc &line, const char *op, TIn ...@@ -440,6 +440,9 @@ bool TParseContext::checkCanBeLValue(const TSourceLoc &line, const char *op, TIn
case EvqLocalInvocationIndex: case EvqLocalInvocationIndex:
message = "can't modify gl_LocalInvocationIndex"; message = "can't modify gl_LocalInvocationIndex";
break; break;
case EvqViewIDOVR:
message = "can't modify gl_ViewID_OVR";
break;
case EvqComputeIn: case EvqComputeIn:
message = "can't modify work group size variable"; message = "can't modify work group size variable";
break; break;
......
...@@ -397,3 +397,24 @@ TEST_F(WEBGLMultiviewVertexShaderTest, AssignmentWithViewIDInsideAssignment) ...@@ -397,3 +397,24 @@ TEST_F(WEBGLMultiviewVertexShaderTest, AssignmentWithViewIDInsideAssignment)
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog; FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
} }
} }
// Test that gl_ViewID_OVR can't be used as an l-value.
TEST_F(WEBGLMultiviewVertexShaderTest, ViewIdAsLValue)
{
const std::string &shaderString =
"#version 300 es\n"
"#extension GL_OVR_multiview2 : require\n"
"void foo(out uint u)\n"
"{\n"
" u = 3u;\n"
"}\n"
"void main()\n"
"{\n"
" foo(gl_ViewID_OVR);\n"
" gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n"
"}\n";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << 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