Skip to content

Commit f4114ec

Browse files
fix: Try getContext
1 parent 0b78a3b commit f4114ec

File tree

6 files changed

+55
-53
lines changed

6 files changed

+55
-53
lines changed

bin/gpu-browser-core.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 2.0.0-rc.10
8-
* @date Wed Apr 24 2019 08:10:18 GMT-0400 (Eastern Daylight Time)
7+
* @version 2.0.0-rc.11
8+
* @date Wed Apr 24 2019 17:53:53 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -3648,11 +3648,11 @@ class HeadlessGLKernel extends WebGLKernel {
36483648
testCanvas = null;
36493649
testExtensions = null;
36503650
if (typeof getContext !== 'function') return;
3651-
testContext = getContext(2, 2, {
3652-
preserveDrawingBuffer: true
3653-
});
3654-
if (!testContext || !testContext.getExtension) return;
36553651
try {
3652+
testContext = getContext(2, 2, {
3653+
preserveDrawingBuffer: true
3654+
});
3655+
if (!testContext || !testContext.getExtension) return;
36563656
testExtensions = {
36573657
STACKGL_resize_drawingbuffer: testContext.getExtension('STACKGL_resize_drawingbuffer'),
36583658
STACKGL_destroy_context: testContext.getExtension('STACKGL_destroy_context'),
@@ -3746,7 +3746,6 @@ class HeadlessGLKernel extends WebGLKernel {
37463746
module.exports = {
37473747
HeadlessGLKernel
37483748
};
3749-
37503749
},{"../web-gl/kernel":15,"gl":1}],11:[function(require,module,exports){
37513750
const {
37523751
utils

bin/gpu-browser-core.min.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 2.0.0-rc.9
8-
* @date Wed Apr 24 2019 07:46:45 GMT-0400 (Eastern Daylight Time)
7+
* @version 2.0.0-rc.11
8+
* @date Wed Apr 24 2019 17:53:56 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -17,8 +17,8 @@
1717
*
1818
* GPU Accelerated JavaScript
1919
*
20-
* @version 2.0.0-rc.9
21-
* @date Wed Apr 24 2019 07:46:43 GMT-0400 (Eastern Daylight Time)
20+
* @version 2.0.0-rc.11
21+
* @date Wed Apr 24 2019 17:53:53 GMT-0400 (Eastern Daylight Time)
2222
*
2323
* @license MIT
2424
* The MIT License
@@ -3661,19 +3661,21 @@ class HeadlessGLKernel extends WebGLKernel {
36613661
testCanvas = null;
36623662
testExtensions = null;
36633663
if (typeof getContext !== 'function') return;
3664-
testContext = getContext(2, 2, {
3665-
preserveDrawingBuffer: true
3666-
});
3667-
if (!testContext || !testContext.getExtension) return;
3668-
testExtensions = {
3669-
STACKGL_resize_drawingbuffer: testContext.getExtension('STACKGL_resize_drawingbuffer'),
3670-
STACKGL_destroy_context: testContext.getExtension('STACKGL_destroy_context'),
3671-
OES_texture_float: testContext.getExtension('OES_texture_float'),
3672-
OES_texture_float_linear: testContext.getExtension('OES_texture_float_linear'),
3673-
OES_element_index_uint: testContext.getExtension('OES_element_index_uint'),
3674-
WEBGL_draw_buffers: testContext.getExtension('WEBGL_draw_buffers'),
3675-
};
3676-
features = this.getFeatures();
3664+
try {
3665+
testContext = getContext(2, 2, {
3666+
preserveDrawingBuffer: true
3667+
});
3668+
if (!testContext || !testContext.getExtension) return;
3669+
testExtensions = {
3670+
STACKGL_resize_drawingbuffer: testContext.getExtension('STACKGL_resize_drawingbuffer'),
3671+
STACKGL_destroy_context: testContext.getExtension('STACKGL_destroy_context'),
3672+
OES_texture_float: testContext.getExtension('OES_texture_float'),
3673+
OES_texture_float_linear: testContext.getExtension('OES_texture_float_linear'),
3674+
OES_element_index_uint: testContext.getExtension('OES_element_index_uint'),
3675+
WEBGL_draw_buffers: testContext.getExtension('WEBGL_draw_buffers'),
3676+
};
3677+
features = this.getFeatures();
3678+
} catch (e) {}
36773679
}
36783680

36793681
static isContextMatch(context) {

bin/gpu-browser.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 2.0.0-rc.10
8-
* @date Wed Apr 24 2019 08:10:18 GMT-0400 (Eastern Daylight Time)
7+
* @version 2.0.0-rc.11
8+
* @date Wed Apr 24 2019 17:53:53 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -8412,11 +8412,11 @@ class HeadlessGLKernel extends WebGLKernel {
84128412
testCanvas = null;
84138413
testExtensions = null;
84148414
if (typeof getContext !== 'function') return;
8415-
testContext = getContext(2, 2, {
8416-
preserveDrawingBuffer: true
8417-
});
8418-
if (!testContext || !testContext.getExtension) return;
84198415
try {
8416+
testContext = getContext(2, 2, {
8417+
preserveDrawingBuffer: true
8418+
});
8419+
if (!testContext || !testContext.getExtension) return;
84208420
testExtensions = {
84218421
STACKGL_resize_drawingbuffer: testContext.getExtension('STACKGL_resize_drawingbuffer'),
84228422
STACKGL_destroy_context: testContext.getExtension('STACKGL_destroy_context'),
@@ -8510,7 +8510,6 @@ class HeadlessGLKernel extends WebGLKernel {
85108510
module.exports = {
85118511
HeadlessGLKernel
85128512
};
8513-
85148513
},{"../web-gl/kernel":16,"gl":2}],12:[function(require,module,exports){
85158514
const {
85168515
utils

bin/gpu-browser.min.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 2.0.0-rc.9
8-
* @date Wed Apr 24 2019 07:46:45 GMT-0400 (Eastern Daylight Time)
7+
* @version 2.0.0-rc.11
8+
* @date Wed Apr 24 2019 17:53:56 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -17,8 +17,8 @@
1717
*
1818
* GPU Accelerated JavaScript
1919
*
20-
* @version 2.0.0-rc.9
21-
* @date Wed Apr 24 2019 07:46:43 GMT-0400 (Eastern Daylight Time)
20+
* @version 2.0.0-rc.11
21+
* @date Wed Apr 24 2019 17:53:53 GMT-0400 (Eastern Daylight Time)
2222
*
2323
* @license MIT
2424
* The MIT License
@@ -8425,19 +8425,21 @@ class HeadlessGLKernel extends WebGLKernel {
84258425
testCanvas = null;
84268426
testExtensions = null;
84278427
if (typeof getContext !== 'function') return;
8428-
testContext = getContext(2, 2, {
8429-
preserveDrawingBuffer: true
8430-
});
8431-
if (!testContext || !testContext.getExtension) return;
8432-
testExtensions = {
8433-
STACKGL_resize_drawingbuffer: testContext.getExtension('STACKGL_resize_drawingbuffer'),
8434-
STACKGL_destroy_context: testContext.getExtension('STACKGL_destroy_context'),
8435-
OES_texture_float: testContext.getExtension('OES_texture_float'),
8436-
OES_texture_float_linear: testContext.getExtension('OES_texture_float_linear'),
8437-
OES_element_index_uint: testContext.getExtension('OES_element_index_uint'),
8438-
WEBGL_draw_buffers: testContext.getExtension('WEBGL_draw_buffers'),
8439-
};
8440-
features = this.getFeatures();
8428+
try {
8429+
testContext = getContext(2, 2, {
8430+
preserveDrawingBuffer: true
8431+
});
8432+
if (!testContext || !testContext.getExtension) return;
8433+
testExtensions = {
8434+
STACKGL_resize_drawingbuffer: testContext.getExtension('STACKGL_resize_drawingbuffer'),
8435+
STACKGL_destroy_context: testContext.getExtension('STACKGL_destroy_context'),
8436+
OES_texture_float: testContext.getExtension('OES_texture_float'),
8437+
OES_texture_float_linear: testContext.getExtension('OES_texture_float_linear'),
8438+
OES_element_index_uint: testContext.getExtension('OES_element_index_uint'),
8439+
WEBGL_draw_buffers: testContext.getExtension('WEBGL_draw_buffers'),
8440+
};
8441+
features = this.getFeatures();
8442+
} catch (e) {}
84418443
}
84428444

84438445
static isContextMatch(context) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gpu.js",
3-
"version": "2.0.0-rc.10",
3+
"version": "2.0.0-rc.11",
44
"description": "GPU Accelerated JavaScript",
55
"engines": {
66
"node": ">=10.0.0"

src/backend/headless-gl/kernel.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class HeadlessGLKernel extends WebGLKernel {
2121
testCanvas = null;
2222
testExtensions = null;
2323
if (typeof getContext !== 'function') return;
24-
testContext = getContext(2, 2, {
25-
preserveDrawingBuffer: true
26-
});
27-
if (!testContext || !testContext.getExtension) return;
2824
try { // just in case, edge cases
25+
testContext = getContext(2, 2, {
26+
preserveDrawingBuffer: true
27+
});
28+
if (!testContext || !testContext.getExtension) return;
2929
testExtensions = {
3030
STACKGL_resize_drawingbuffer: testContext.getExtension('STACKGL_resize_drawingbuffer'),
3131
STACKGL_destroy_context: testContext.getExtension('STACKGL_destroy_context'),

0 commit comments

Comments
 (0)