Allow attribute linking for ES2
* Pipe webGL compatibility down to allow attribute aliasing.
* Reject aliasing if shader level is too high, or webGL is in use.
Bug: angleproject:3252
Change-Id: I3378fe707e3795a4b8a424989afccff42bc84344
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1556538
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
Commit-Queue: Cody Northrop <cnorthrop@google.com>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 16f6d30..a91e55a 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -1364,7 +1364,8 @@
data.getCaps().maxVaryingVectors, packMode, &mState.mUniformBlocks, &mState.mUniforms,
&mState.mShaderStorageBlocks, &mState.mBufferVariables, &mState.mAtomicCounterBuffers));
- if (!linkAttributes(context->getCaps(), mInfoLog))
+ if (!linkAttributes(context->getCaps(), mInfoLog,
+ context->getExtensions().webglCompatibility))
{
return angle::Result::Continue;
}
@@ -3132,7 +3133,7 @@
}
// Assigns locations to all attributes from the bindings and program locations.
-bool Program::linkAttributes(const Caps &caps, InfoLog &infoLog)
+bool Program::linkAttributes(const Caps &caps, InfoLog &infoLog, bool webglCompatibility)
{
Shader *vertexShader = mState.getAttachedShader(ShaderType::Vertex);
@@ -3196,10 +3197,10 @@
// In GLSL ES 3.00.6 and in WebGL, attribute aliasing produces a link error.
// In non-WebGL GLSL ES 1.00.17, attribute aliasing is allowed with some
// restrictions - see GLSL ES 1.00.17 section 2.10.4, but ANGLE currently has a bug.
+ // TODO: Remaining failures: http://anglebug.com/3252
if (linkedAttribute)
{
- // TODO(jmadill): fix aliasing on ES2
- // if (shaderVersion >= 300 && !webgl)
+ if (shaderVersion >= 300 || webglCompatibility)
{
infoLog << "Attribute '" << attribute.name << "' aliases attribute '"
<< linkedAttribute->name << "' at location " << regLocation;
diff --git a/src/libANGLE/Program.h b/src/libANGLE/Program.h
index 9571a4a..97461a9 100644
--- a/src/libANGLE/Program.h
+++ b/src/libANGLE/Program.h
@@ -910,7 +910,7 @@
void deleteSelf(const Context *context);
bool linkValidateShaders(InfoLog &infoLog);
- bool linkAttributes(const Caps &caps, InfoLog &infoLog);
+ bool linkAttributes(const Caps &caps, InfoLog &infoLog, bool webglCompatibility);
bool linkInterfaceBlocks(const Caps &caps,
const Version &version,
bool webglCompatibility,
diff --git a/src/tests/deqp_support/deqp_gles2_test_expectations.txt b/src/tests/deqp_support/deqp_gles2_test_expectations.txt
index 557b60d..9b85d72 100644
--- a/src/tests/deqp_support/deqp_gles2_test_expectations.txt
+++ b/src/tests/deqp_support/deqp_gles2_test_expectations.txt
@@ -74,9 +74,9 @@
1028 : dEQP-GLES2.functional.fbo.completeness.renderable.texture.stencil.srgb8 = FAIL
1028 : dEQP-GLES2.functional.fbo.completeness.renderable.texture.depth.srgb8 = FAIL
-// Bind aliasing is not working currently
-3252 : dEQP-GLES2.functional.attribute_location.bind_aliasing.cond* = FAIL
-3252 : dEQP-GLES2.functional.attribute_location.bind_aliasing.max_cond* = FAIL
+// Bind aliasing max_cond crashes on Windows, fails on other platforms.
+// TODO(cnorthrop): Narrow skip list or fix the test
+3252 : dEQP-GLES2.functional.attribute_location.bind_aliasing.max_cond* = SKIP
// Half float OES either has an implementation bug or a dEQP bug.
3283 : dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgba_half_float_oes = FAIL
@@ -250,6 +250,7 @@
2630 GLES ANDROID : dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_function_arg_* = FAIL
// Nexus 5x failures
+3309 NEXUS5X GLES : dEQP-GLES2.functional.attribute_location.bind_aliasing.cond* = FAIL
3309 NEXUS5X GLES : dEQP-GLES2.functional.fbo.render.texsubimage.after_render_tex2d_rgb = FAIL
3309 NEXUS5X GLES : dEQP-GLES2.functional.polygon_offset.default_result_depth_clamp = FAIL
3309 NEXUS5X GLES : dEQP-GLES2.functional.shaders.return.output_write_in_func_always_vertex = FAIL
diff --git a/src/tests/deqp_support/deqp_gles3_test_expectations.txt b/src/tests/deqp_support/deqp_gles3_test_expectations.txt
index 8fcbb3b..635bb92 100644
--- a/src/tests/deqp_support/deqp_gles3_test_expectations.txt
+++ b/src/tests/deqp_support/deqp_gles3_test_expectations.txt
@@ -110,9 +110,9 @@
// Failing everywhere
2322 : dEQP-GLES3.functional.shaders.metamorphic.* = FAIL
-// Bind aliasing is not working currently
-3252 : dEQP-GLES3.functional.attribute_location.bind_aliasing.cond* = FAIL
-3252 : dEQP-GLES3.functional.attribute_location.bind_aliasing.max_cond* = FAIL
+// Bind aliasing max_cond crashes on Windows, fails on other platforms.
+// TODO(cnorthrop): Narrow skip list or fix the test
+3252 : dEQP-GLES3.functional.attribute_location.bind_aliasing.max_cond* = SKIP
// Windows and Linux failures
1095 WIN : dEQP-GLES3.functional.texture.mipmap.2d.projected.* = FAIL
@@ -503,6 +503,7 @@
2567 ANDROID GLES : dEQP-GLES3.functional.fbo.completeness.renderable.texture.stencil.rg_unsigned_byte = FAIL
// Nexus 5x failures
+3308 NEXUS5X GLES : dEQP-GLES3.functional.attribute_location.bind_aliasing.cond* = FAIL
3308 NEXUS5X GLES : dEQP-GLES3.functional.polygon_offset.default_result_depth_clamp = FAIL
3308 NEXUS5X GLES : dEQP-GLES3.functional.polygon_offset.fixed24_result_depth_clamp = FAIL
3308 NEXUS5X GLES : dEQP-GLES3.functional.transform_feedback.random.interleaved.lines.3 = FAIL