Bug 1264214 - WebGL check the conflict name when LinkProgram. r=jgilbert
authorEthan Lin <ethlin@mozilla.com>
Thu, 28 Apr 2016 06:10:00 -0400
changeset 295363 b4dfa9f7f63cd920d559bcb64934326c3a2c9bee
parent 295362 6cc094eba698eb8f9faa9d5eea6a3c5f22597b10
child 295364 af51821b2fc52323a8bbeae3efd2d49c77b1ea7e
push id30223
push userkwierso@gmail.com
push dateFri, 29 Apr 2016 21:57:49 +0000
treeherdermozilla-central@2b7c421063ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1264214
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264214 - WebGL check the conflict name when LinkProgram. r=jgilbert
dom/canvas/WebGLProgram.cpp
dom/canvas/test/webgl-conf/generated-mochitest.ini
dom/canvas/test/webgl-conf/mochitest-errata.ini
--- a/dom/canvas/WebGLProgram.cpp
+++ b/dom/canvas/WebGLProgram.cpp
@@ -950,17 +950,29 @@ WebGLProgram::LinkProgram()
         // This can't be done trivially, because we have to deal with mapped names too.
         mVertShader->ApplyTransformFeedbackVaryings(mGLName,
                                                     mTransformFeedbackVaryings,
                                                     mTransformFeedbackBufferMode,
                                                     &mTempMappedVaryings);
     }
 
     LinkAndUpdate();
-    if (IsLinked())
+    if (IsLinked()) {
+        // Check if the attrib name conflicting to uniform name
+        for (const auto& uniform : mMostRecentLinkInfo->uniformMap) {
+            if (mMostRecentLinkInfo->attribMap.find(uniform.first) != mMostRecentLinkInfo->attribMap.end()) {
+                mLinkLog = nsPrintfCString("The uniform name (%s) conflicts with attribute name.",
+                                           uniform.first.get());
+                mMostRecentLinkInfo = nullptr;
+                break;
+            }
+        }
+    }
+
+    if (mMostRecentLinkInfo)
         return;
 
     // Failed link.
     if (mContext->ShouldGenerateWarnings()) {
         // report shader/program infoLogs as warnings.
         // note that shader compilation errors can be deferred to linkProgram,
         // which is why we can't do anything in compileShader. In practice we could
         // report in compileShader the translation errors generated by ANGLE,
--- a/dom/canvas/test/webgl-conf/generated-mochitest.ini
+++ b/dom/canvas/test/webgl-conf/generated-mochitest.ini
@@ -2738,17 +2738,16 @@ fail-if = (os == 'android')
 [generated/test_conformance__glsl__misc__shader-without-precision.frag.html]
 [generated/test_conformance__glsl__misc__shaders-with-constant-expression-loop-conditions.html]
 [generated/test_conformance__glsl__misc__shaders-with-invariance.html]
 fail-if = 1
 [generated/test_conformance__glsl__misc__shaders-with-mis-matching-uniforms.html]
 [generated/test_conformance__glsl__misc__shaders-with-mis-matching-varyings.html]
 [generated/test_conformance__glsl__misc__shaders-with-missing-varyings.html]
 [generated/test_conformance__glsl__misc__shaders-with-name-conflicts.html]
-fail-if = 1
 [generated/test_conformance__glsl__misc__shaders-with-uniform-structs.html]
 [generated/test_conformance__glsl__misc__shaders-with-varyings.html]
 [generated/test_conformance__glsl__misc__shared.html]
 [generated/test_conformance__glsl__misc__struct-equals.html]
 [generated/test_conformance__glsl__misc__struct-mixed-array-declarators.html]
 [generated/test_conformance__glsl__misc__struct-nesting-exceeds-maximum.html]
 [generated/test_conformance__glsl__misc__struct-nesting-of-variable-names.html]
 fail-if = (os == 'mac' && os_version == '10.10')
--- a/dom/canvas/test/webgl-conf/mochitest-errata.ini
+++ b/dom/canvas/test/webgl-conf/mochitest-errata.ini
@@ -32,17 +32,16 @@ skip-if = os == 'b2g' || ((os == 'linux'
 
 [generated/test_..__always-fail.html]
 fail-if = 1
 [generated/test_conformance__context__context-lost.html]
 fail-if = 1
 [generated/test_conformance__glsl__misc__shaders-with-invariance.html]
 fail-if = 1
 [generated/test_conformance__glsl__misc__shaders-with-name-conflicts.html]
-fail-if = 1
 [generated/test_conformance__renderbuffers__feedback-loop.html]
 fail-if = 1
 [generated/test_conformance__textures__texture-copying-feedback-loops.html]
 fail-if = 1
 
 ####################
 # Tests requesting non-local network connections.