Skip to content

Commit b6c44ae

Browse files
committed
Fix chrome version test, and rename OLDEST_SUPPORTED_CHROME_VERSION to MIN_CHROME_VERSION
1 parent 5539718 commit b6c44ae

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/library_webgl.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,13 @@ var LibraryGL = {
526526
webGLContextAttributes['preserveDrawingBuffer'] = true;
527527
#endif
528528

529-
#if USE_WEBGL2 && OLDEST_SUPPORTED_CHROME_VERSION <= 57
529+
#if USE_WEBGL2 && MIN_CHROME_VERSION <= 57
530530
// BUG: Workaround Chrome WebGL 2 issue: the first shipped versions of WebGL 2 in Chrome did not actually implement the new WebGL 2 functions.
531531
// Those are supported only in Chrome 58 and newer. For Chrome 57 (and older), disable WebGL 2 support altogether.
532532
function getChromeVersion() {
533-
var raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
534-
return raw ? parseInt(raw[2], 10) : false;
533+
var chromeVersion = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
534+
if (chromeVersion) return chromeVersion[2]|0;
535+
// If not chrome, fall through to return undefined. (undefined <= integer will yield false)
535536
}
536537
if (getChromeVersion() <= 57) {
537538
WebGL2RenderingContext = undefined;

src/settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,11 @@ var WORKAROUND_IOS_9_RIGHT_SHIFT_BUG = 0;
488488
// https://stackoverflow.com/questions/54248633/cannot-create-half-float-oes-texture-from-uint16array-on-ipad
489489
var GL_DISABLE_HALF_FLOAT_EXTENSION_IF_BROKEN = 0;
490490

491-
// Specifies the oldest version of Chrome to target. E.g. a value -s OLDEST_SUPPORTED_CHROME_VERSION=58 would mean that Emscripten generates library code that would
491+
// Specifies the oldest version of Chrome to target. E.g. a value -s MIN_CHROME_VERSION=58 would mean that Emscripten generates library code that would
492492
// contain polyfills and backwards compatibility for Chrome >= 58 and newer. Set this to a small value to target old browsers, and to a high value to reduce code size
493493
// by dropping polyfill support for older browsers. Default to 0 to mean "all Chrome versions" (although in practice a large number of features require a specific much
494494
// newer Chrome version, e.g. Wasm or WebGL 2)
495-
var OLDEST_SUPPORTED_CHROME_VERSION = 0;
495+
var MIN_CHROME_VERSION = 0;
496496

497497
// If set, enables polyfilling for Math.clz32, Math.trunc, Math.imul, Math.fround.
498498
var POLYFILL_OLD_MATH_FUNCTIONS = 0;

tests/test_other.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9509,7 +9509,7 @@ def test_minimal_runtime_code_size(self):
95099509
'-s', 'GL_SUPPORT_EXPLICIT_SWAP_CONTROL=0',
95109510
'-s', 'GL_POOL_TEMP_BUFFERS=0',
95119511
'-s', 'FAST_UNROLLED_MEMCPY_AND_MEMSET=0',
9512-
'-s', 'OLDEST_SUPPORTED_CHROME_VERSION=58',
9512+
'-s', 'MIN_CHROME_VERSION=58',
95139513
'--output_eol', 'linux']
95149514

95159515
asmjs = ['-s', 'WASM=0', '--separate-asm', '-s', 'ELIMINATE_DUPLICATE_FUNCTIONS=1', '--memory-init-file', '1']

0 commit comments

Comments
 (0)