Closed Bug 1083178 Opened 11 years ago Closed 11 years ago

Shader no longer compiles or links using ANGLE in Firefox 33.

Categories

(Core :: Graphics: CanvasWebGL, defect)

33 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: matt.amato, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0 Build ID: 20141011015303 Steps to reproduce: Visit "http://cesiumjs.org/cesium/Specs/SpecRunner.html?spec=Scene%2FImageryLayer%20reprojects%20web%20mercator%20images." (note the period is part of the URL) Also, http://cesiumjs.org/Cesium/Build/Apps/CesiumViewer/index.html crashes on start up. Actual results: It's a unit test for Cesium (http://cesiumjs.org) that verifies a particular shader works correctly (in this case, it reprojects imagery.). This test worked in Firefox 32, but no longer works in Firefox 33. It works in Chrome and IE 11 and on machines without ANGLE. It may be a D3D9 only issue, as I don't have a D11 back-end machine to test on. This is almost certainly a regression introduced in the recent ANGLE upgrade. We are also discussing this on our own Github issue for Cesium here: https://github.com/AnalyticalGraphicsInc/cesium/issues/2197 Expected results: The test should pass.
WFM with FF36 (Nightly). Could you download Nightly and confirm, please? https://nightly.mozilla.org/
Flags: needinfo?(matt.amato)
(In reply to Loic from comment #1) > WFM with FF36 (Nightly). > Could you download Nightly and confirm, please? > https://nightly.mozilla.org/ I can confirm that this works in Aurora, 35.0a2 (2014-10-15). Do you need me to try the Nightly, or is that good enough?
Flags: needinfo?(matt.amato)
It's enough, ty.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Since the crash is fixed in Aurora, but not beta. Do you think it would be possible to backport the fix so that our engine is not broken in two consecutive Firefox releases?
Depends on 1) being able to identify what exact changeset needs to be backported, and 2) that patch being small and unintrusive enough that we can feel good about taking it on beta. For 1), one could use the nightly builds archive to try to bisect which nightly (3 months ago) first had it fixed. http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/2014/ (take "mozilla-central" builds). Now if the outcome is that some wholesale update to our ANGLE copy is what fixed it, then that's going to be a huge patch that will be very difficult to accept on the beta channel. In that case, the only hope to backporting the fix would be to pinpoint what exact ANGLE change fixed it, and backport that. That would be a lot of work. It may still be worth bisecting with nightlies in the hope that the fix is NOT a huge ANGLE patch.
(In reply to Matthew Amato from comment #4) > Since the crash is fixed in Aurora, but not beta. Do you think it would be > possible to backport the fix so that our engine is not broken in two > consecutive Firefox releases? Please post the shader which doesn't link.
Here you go. I'm fairly certain it's the vertex shader; but I copied the fragment shader too for completeness. This is straight out of the Firefox debugger. Vertex Shader: // Comment replaced to prevent problems when determining dependencies on built-in functions // // // // // // // // // // // // // const float czm_pi = 3.141592653589793; // Comment replaced to prevent problems when determining dependencies on built-in functions // // // // // // // // // // // // // const float czm_piOverTwo = 1.5707963267948966; // Comment replaced to prevent problems when determining dependencies on built-in functions // vec2 cordic(float angle) { // Scale the vector by the appropriate factor for the 24 iterations to follow. vec2 vector = vec2(6.0725293500888267e-1, 0.0); // Iteration 1 float sense = (angle < 0.0) ? -1.0 : 1.0; // float factor = sense * 1.0; // 2^-0 mat2 rotation = mat2(1.0, sense, -sense, 1.0); vector = rotation * vector; angle -= sense * 7.8539816339744828e-1; // atan(2^-0) // Iteration 2 sense = (angle < 0.0) ? -1.0 : 1.0; float factor = sense * 5.0e-1; // 2^-1 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 4.6364760900080609e-1; // atan(2^-1) // Iteration 3 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 2.5e-1; // 2^-2 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 2.4497866312686414e-1; // atan(2^-2) // Iteration 4 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.25e-1; // 2^-3 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.2435499454676144e-1; // atan(2^-3) // Iteration 5 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 6.25e-2; // 2^-4 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 6.2418809995957350e-2; // atan(2^-4) // Iteration 6 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 3.125e-2; // 2^-5 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 3.1239833430268277e-2; // atan(2^-5) // Iteration 7 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.5625e-2; // 2^-6 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.5623728620476831e-2; // atan(2^-6) // Iteration 8 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 7.8125e-3; // 2^-7 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 7.8123410601011111e-3; // atan(2^-7) // Iteration 9 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 3.90625e-3; // 2^-8 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 3.9062301319669718e-3; // atan(2^-8) // Iteration 10 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.953125e-3; // 2^-9 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.9531225164788188e-3; // atan(2^-9) // Iteration 11 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 9.765625e-4; // 2^-10 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 9.7656218955931946e-4; // atan(2^-10) // Iteration 12 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 4.8828125e-4; // 2^-11 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 4.8828121119489829e-4; // atan(2^-11) // Iteration 13 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 2.44140625e-4; // 2^-12 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 2.4414062014936177e-4; // atan(2^-12) // Iteration 14 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.220703125e-4; // 2^-13 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.2207031189367021e-4; // atan(2^-13) // Iteration 15 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 6.103515625e-5; // 2^-14 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 6.1035156174208773e-5; // atan(2^-14) // Iteration 16 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 3.0517578125e-5; // 2^-15 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 3.0517578115526096e-5; // atan(2^-15) // Iteration 17 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.52587890625e-5; // 2^-16 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.5258789061315762e-5; // atan(2^-16) // Iteration 18 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 7.62939453125e-6; // 2^-17 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 7.6293945311019700e-6; // atan(2^-17) // Iteration 19 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 3.814697265625e-6; // 2^-18 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 3.8146972656064961e-6; // atan(2^-18) // Iteration 20 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.9073486328125e-6; // 2^-19 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 1.9073486328101870e-6; // atan(2^-19) // Iteration 21 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 9.5367431640625e-7; // 2^-20 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 9.5367431640596084e-7; // atan(2^-20) // Iteration 22 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 4.76837158203125e-7; // 2^-21 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 4.7683715820308884e-7; // atan(2^-21) // Iteration 23 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 2.384185791015625e-7; // 2^-22 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; angle -= sense * 2.3841857910155797e-7; // atan(2^-22) // Iteration 24 sense = (angle < 0.0) ? -1.0 : 1.0; factor = sense * 1.1920928955078125e-7; // 2^-23 rotation[0][1] = factor; rotation[1][0] = -factor; vector = rotation * vector; // angle -= sense * 1.1920928955078068e-7; // atan(2^-23) return vector; } // Comment replaced to prevent problems when determining dependencies on built-in functions // // // // // // // // // // // // // vec2 czm_cosineAndSine(float angle) { if (angle < -czm_piOverTwo || angle > czm_piOverTwo) { if (angle < 0.0) { return -cordic(angle + czm_pi); } else { return -cordic(angle - czm_pi); } } else { return cordic(angle); } } uniform mat4 czm_viewportOrthographic; // Comment replaced to prevent problems when determining dependencies on built-in functions // // // // // // // // // // // // // float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorYLow, float southMercatorYHigh, float oneOverMercatorHeight) { float sinLatitude = czm_cosineAndSine(latitude).y; float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude)); // mercatorY - southMercatorY in simulated double precision. float t1 = 0.0 - southMercatorYLow; float e = t1 - 0.0; float t2 = ((-southMercatorYLow - e) + (0.0 - (t1 - e))) + mercatorY - southMercatorYHigh; float highDifference = t1 + t2; float lowDifference = t2 - (highDifference - t1); return highDifference * oneOverMercatorHeight + lowDifference * oneOverMercatorHeight; } #line 0 attribute vec4 position; uniform vec2 u_textureDimensions; uniform float u_northLatitude; uniform float u_southLatitude; uniform float u_southMercatorYHigh; uniform float u_southMercatorYLow; uniform float u_oneOverMercatorHeight; varying vec2 v_textureCoordinates; void main() { float currentLatitude = mix(u_southLatitude, u_northLatitude, position.y); float fraction = czm_latitudeToWebMercatorFraction(currentLatitude, u_southMercatorYLow, u_southMercatorYHigh, u_oneOverMercatorHeight); v_textureCoordinates = vec2(position.x, fraction); gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0)); } Fragment Shader: #ifdef GL_FRAGMENT_PRECISION_HIGH precision highp float; #else precision mediump float; #endif #line 0 uniform sampler2D u_texture; varying vec2 v_textureCoordinates; void main() { gl_FragColor = texture2D(u_texture, v_textureCoordinates); }
Guys - some news. We now know exactly what's going on and what the fix is - it's an ANGLE bug that was long fixed upstream but we hadn't backported the fix. See bug 1088858. The only question at this point is what version(s) we'll backport this to. While Firefox 33 was officially released 1.5 week ago, it hasn't been unthrottled yet, meaning that only a minority of Firefox users have been upgraded to it so far, as we've been battling other issues in Firefox 33. So there's a glimmer of hope that we'll be able to backport the fix in Firefox 33 before the bulk of Firefox users are upgraded to it, but no promises.
You need to log in before you can comment on or make changes to this bug.