UNPKG

846 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5var constants = require('@pixi/constants');
6var settings = require('@pixi/settings');
7
8const unknownContext = {};
9let context = unknownContext;
10function 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
30exports.getTestContext = getTestContext;
31//# sourceMappingURL=getTestContext.js.map