Skip to content

Commit

Permalink
Merge pull request #2432 from AnalyticalGraphicsInc/fix-firefox
Browse files Browse the repository at this point in the history
Workaround issue in Firefox 35
  • Loading branch information
pjcozzi committed Jan 29, 2015
2 parents fb3df24 + c107a19 commit 8a43c4e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
10 changes: 10 additions & 0 deletions Source/Core/FeatureDetection.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ define([
return isFirefoxResult;
}

var isWindowsResult;
function isWindows() {
if (!defined(isWindowsResult)) {
isWindowsResult = /Windows/i.test(navigator.appVersion);
}
return isWindowsResult;
}


function firefoxVersion() {
return isFirefox() && firefoxVersionResult;
}
Expand All @@ -146,6 +155,7 @@ define([
internetExplorerVersion : internetExplorerVersion,
isFirefox : isFirefox,
firefoxVersion : firefoxVersion,
isWindows : isWindows,
hardwareConcurrency : defaultValue(navigator.hardwareConcurrency, 3)
};

Expand Down
14 changes: 12 additions & 2 deletions Source/Renderer/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([
'../Core/defineProperties',
'../Core/destroyObject',
'../Core/DeveloperError',
'../Core/FeatureDetection',
'../Core/Geometry',
'../Core/GeometryAttribute',
'../Core/IndexDatatype',
Expand Down Expand Up @@ -47,6 +48,7 @@ define([
defineProperties,
destroyObject,
DeveloperError,
FeatureDetection,
Geometry,
GeometryAttribute,
IndexDatatype,
Expand Down Expand Up @@ -208,10 +210,18 @@ define([

// Override select WebGL defaults
webglOptions.alpha = defaultValue(webglOptions.alpha, false); // WebGL default is true
// TODO: WebGL default is false. This works around a bug in Canary and can be removed when fixed: https://code.google.com/p/chromium/issues/detail?id=335273
webglOptions.stencil = defaultValue(webglOptions.stencil, false);
webglOptions.failIfMajorPerformanceCaveat = defaultValue(webglOptions.failIfMajorPerformanceCaveat, true); // WebGL default is false

// Firefox 35 with ANGLE has a regression that causes alpha : false to affect all framebuffers
// Since we can't detect for ANGLE without a context, we just detect for Windows.
// https://github.com/AnalyticalGraphicsInc/cesium/issues/2431
if (FeatureDetection.isFirefox() && FeatureDetection.isWindows()) {
var firefoxVersion = FeatureDetection.firefoxVersion();
if (firefoxVersion[0] === 35) {
webglOptions.alpha = true;
}
}

this._originalGLContext = canvas.getContext('webgl', webglOptions) || canvas.getContext('experimental-webgl', webglOptions) || undefined;

if (!defined(this._originalGLContext)) {
Expand Down
7 changes: 1 addition & 6 deletions Source/Shaders/Builtin/Functions/cosineAndSine.glsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Firefox 33-34 has a regression that prevents the CORDIC implementation from compiling
#ifndef DISABLE_CORDIC

/**
* @private
*/
Expand Down Expand Up @@ -211,6 +208,4 @@ vec2 czm_cosineAndSine(float angle)
{
return cordic(angle);
}
}

#endif
}

0 comments on commit 8a43c4e

Please sign in to comment.