Skip to content

Commit

Permalink
Workaround issue in Firefox 35
Browse files Browse the repository at this point in the history
In Firefox 35 we need to force the context alpha to true because setting
it to false affects all framebuffers. Fixes #2431

Also removed ancient workaround for a Chrome issue that was fixed in
Feb 2014 as well as an unused glsl #ifdef that was left over from an
older version of Firefox.
  • Loading branch information
mramato authored and kring committed Jan 29, 2015
1 parent 9a13cc6 commit cfc32a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
13 changes: 11 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,17 @@ 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 has a regression that causes alpha : false to affect all framebuffers
// https://github.com/AnalyticalGraphicsInc/cesium/issues/2431
if (FeatureDetection.isFirefox()) {
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 cfc32a7

Please sign in to comment.