1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | var constants = require('@pixi/constants');
|
6 | var settings = require('@pixi/settings');
|
7 |
|
8 | const unknownContext = {};
|
9 | let context = unknownContext;
|
10 | function getTestContext() {
|
11 | if (context === unknownContext || context?.isContextLost()) {
|
12 | const canvas = settings.settings.ADAPTER.createCanvas();
|
13 | let gl;
|
14 | if (settings.settings.PREFER_ENV >= constants.ENV.WEBGL2) {
|
15 | gl = canvas.getContext("webgl2", {});
|
16 | }
|
17 | if (!gl) {
|
18 | gl = canvas.getContext("webgl", {}) || canvas.getContext("experimental-webgl", {});
|
19 | if (!gl) {
|
20 | gl = null;
|
21 | } else {
|
22 | gl.getExtension("WEBGL_draw_buffers");
|
23 | }
|
24 | }
|
25 | context = gl;
|
26 | }
|
27 | return context;
|
28 | }
|
29 |
|
30 | exports.getTestContext = getTestContext;
|
31 |
|