Commit e6256f87 by Jamie Madill

Fix the varying sort comparator in ShaderD3D.

The comparator was actually a <= operator, while sort requires a strict < operator. This was causing a potential assertion failure. Bug report from Kerim Borchaev. BUG=angle:742 Change-Id: I37c2925ab0b85e70ee1b2be3c72c6ddc062e8d28 Reviewed-on: https://chromium-review.googlesource.com/218506Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 87a93308
...@@ -348,7 +348,7 @@ bool ShaderD3D::compareVarying(const gl::PackedVarying &x, const gl::PackedVaryi ...@@ -348,7 +348,7 @@ bool ShaderD3D::compareVarying(const gl::PackedVarying &x, const gl::PackedVaryi
return true; return true;
} }
return gl::VariableSortOrder(x.type) <= gl::VariableSortOrder(y.type); return gl::VariableSortOrder(x.type) < gl::VariableSortOrder(y.type);
} }
unsigned int ShaderD3D::getUniformRegister(const std::string &uniformName) const unsigned int ShaderD3D::getUniformRegister(const std::string &uniformName) const
......
...@@ -226,6 +226,43 @@ TEST_F(GLSLTest, InvariantVaryingOut) ...@@ -226,6 +226,43 @@ TEST_F(GLSLTest, InvariantVaryingOut)
EXPECT_NE(0u, program); EXPECT_NE(0u, program);
} }
TEST_F(GLSLTest, FrontFacingAndVarying)
{
const std::string vertexShaderSource = SHADER_SOURCE
(
attribute vec4 a_position;
varying float v_varying;
void main()
{
v_varying = a_position.x;
gl_Position = a_position;
}
);
const std::string fragmentShaderSource = SHADER_SOURCE
(
precision mediump float;
varying float v_varying;
void main()
{
vec4 c;
if (gl_FrontFacing)
{
c = vec4(v_varying, 0, 0, 1.0);
}
else
{
c = vec4(0, v_varying, 0, 1.0);
}
gl_FragColor = c;
}
);
GLuint program = CompileProgram(vertexShaderSource, fragmentShaderSource);
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, InvariantVaryingIn) TEST_F(GLSLTest, InvariantVaryingIn)
{ {
const std::string fragmentShaderSource = SHADER_SOURCE const std::string fragmentShaderSource = SHADER_SOURCE
......
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