Commit 4b06c1e9 by Qin Jiajia Committed by Commit Bot

Add a test to expose boolean uniform bug on Intel windows

This test is ported from webgl conformance test WebglConformance_conformance2_glsl3_short_circuiting_in_loop_condition. Since HLSL and ESSL have different rules to process short-circuit evaluation, this patch will use the final flattened shader so that the translated HLSL is almost same with the current ES shader. BUG=843369 TEST=angle_end2end_tests Change-Id: Ibc742f8ac4592a83c4c7dad37a64a5563eb58bd5 Reviewed-on: https://chromium-review.googlesource.com/1090328 Commit-Queue: Jiajia Qin <jiajia.qin@intel.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 81970bc3
......@@ -1016,6 +1016,61 @@ TEST_P(UniformTestES3, ReturnsOnlyOneArrayElement)
}
}
// This test reproduces a regression when Intel windows driver upgrades to 4944. In some situation,
// when a boolean uniform with false value is used as the if and for condtions, the bug will be
// triggered. It seems that the shader doesn't get a right 'false' value from the uniform.
TEST_P(UniformTestES3, BooleanUniformAsIfAndForCondition)
{
ANGLE_SKIP_TEST_IF(IsIntel() && IsWindows());
const char kFragShader[] =
R"(#version 300 es
precision mediump float;
uniform bool u;
out vec4 result;
int sideEffectCounter;
bool foo() {
++sideEffectCounter;
return true;
}
void main() {
sideEffectCounter = 0;
bool condition = u;
if (condition)
{
condition = foo();
}
for(int iterations = 0; condition;) {
++iterations;
if (iterations >= 10) {
break;
}
if (condition)
{
condition = foo();
}
}
bool success = (!u && sideEffectCounter == 0);
result = (success) ? vec4(0, 1.0, 0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
})";
ANGLE_GL_PROGRAM(program, essl3_shaders::vs::Simple(), kFragShader);
glUseProgram(program.get());
GLint uniformLocation = glGetUniformLocation(program, "u");
ASSERT_NE(uniformLocation, -1);
glUniform1i(uniformLocation, GL_FALSE);
drawQuad(program.get(), essl3_shaders::PositionAttrib(), 0.0f);
ASSERT_GL_NO_ERROR();
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}
class UniformTestES31 : public ANGLETest
{
protected:
......
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