Skip to content

Commit

Permalink
Disable antialiasing when running in Windows Firefox due to possible …
Browse files Browse the repository at this point in the history
…Firefox bug (#5857)

* Disable antialiasing when running in Windows Firefox due to possible Firefox bug

* types

* only for firefox 120+

* updated to cover esr115 as well

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky committed Nov 28, 2023
1 parent e93c699 commit 4397824
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/platform.js
Expand Up @@ -52,6 +52,15 @@ const passiveEvents = detectPassiveEvents();
* }
*/
const platform = {
/**
* String identifying the current platform. Can be one of: android, ios, windows, osx, linux,
* cros or null.
*
* @type {'android' | 'ios' | 'windows' | 'osx' | 'linux' | 'cros' | null}
* @ignore
*/
name: platformName,

/**
* String identifying the current runtime environment. Either 'browser' or 'node'.
*
Expand Down
14 changes: 14 additions & 0 deletions src/platform/graphics/webgl/webgl-graphics-device.js
Expand Up @@ -354,6 +354,20 @@ class WebglGraphicsDevice extends GraphicsDevice {
Debug.log("Antialiasing has been turned off due to rendering issues on AppleWebKit 15.4");
}

// #5856 - turn off antialiasing on Windows Firefox
if (platform.browserName === 'firefox' && platform.name === 'windows') {
const ua = (typeof navigator !== 'undefined') ? navigator.userAgent : '';
const match = ua.match(/Firefox\/(\d+(\.\d+)*)/);
const firefoxVersion = match ? match[1] : null;
if (firefoxVersion) {
const version = parseFloat(firefoxVersion);
if (version >= 120 || version === 115) {
options.antialias = false;
Debug.log("Antialiasing has been turned off due to rendering issues on Windows Firefox esr115 and 120+. Current version: " + firefoxVersion);
}
}
}

let gl = null;

// we always allocate the default framebuffer without antialiasing, so remove that option
Expand Down

0 comments on commit 4397824

Please sign in to comment.