diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 6ddb14b18f8c8eccb57e7eb12cbcb8321b0a2882..0000000000000000000000000000000000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,18 +0,0 @@ -on: - push: - pull_request: - -jobs: - eslint: - name: eslint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: install node v14 - uses: actions/setup-node@v1 - with: - node-version: 14 - - name: yarn install - run: yarn install - - name: eslint - uses: icrawl/action-eslint@v1 \ No newline at end of file diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml new file mode 100644 index 0000000000000000000000000000000000000000..06804964684ba711aa7b3e0ed6d9d11d9a6a7092 --- /dev/null +++ b/.github/workflows/node.yml @@ -0,0 +1,20 @@ +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + - run: npm ci + - run: sudo apt-get install xvfb + - name: Lint + run: npm run lint + - name: Test + run: xvfb-run --auto-servernum npm run jest + - name: Build + run: npm run build diff --git a/package-lock.json b/package-lock.json index c5ced1fd9ca1bdff83888b8b2206d48fee639edc..caba2a2488e5c99cfcb24cca61cd47a3c6e6f921 100644 Binary files a/package-lock.json and b/package-lock.json differ diff --git a/package.json b/package.json index 4d3ffe04fce9d1a53438ac80f304562b6c81e7b9..811c6aa53863504d3a8c7a078a528a6f889949d4 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "@graphql-codegen/typescript-graphql-request": "^4.1.4", "@graphql-codegen/typescript-operations": "^2.1.6", "@types/cors": "^2.8.12", + "@types/gl": "^4.1.0", "@typescript-eslint/eslint-plugin": "^4.32.0", "@typescript-eslint/parser": "^4.32.0", "benchmark": "^2.1.4", @@ -151,5 +152,8 @@ "tslib": "^2.3.1", "util.promisify": "^1.1.1", "xhr2": "^0.2.1" + }, + "optionalDependencies": { + "gl": "^4.9.2" } } diff --git a/src/mol-gl/_spec/cylinders.spec.ts b/src/mol-gl/_spec/cylinders.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b1f0fc8d72d648a24b45438da37a8b37ab0280b --- /dev/null +++ b/src/mol-gl/_spec/cylinders.spec.ts @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createRenderObject } from '../render-object'; +import { Scene } from '../scene'; +import { getGLContext, tryGetGLContext } from './gl'; +import { setDebugMode } from '../../mol-util/debug'; +import { ColorNames } from '../../mol-util/color/names'; +import { ParamDefinition as PD } from '../../mol-util/param-definition'; +import { Cylinders } from '../../mol-geo/geometry/cylinders/cylinders'; + +export function createCylinders() { + const cylinders = Cylinders.createEmpty(); + const props = PD.getDefaultValues(Cylinders.Params); + const values = Cylinders.Utils.createValuesSimple(cylinders, props, ColorNames.orange, 1); + const state = Cylinders.Utils.createRenderableState(props); + return createRenderObject('cylinders', values, state, -1); +} + +describe('cylinders', () => { + const ctx = tryGetGLContext(32, 32, { fragDepth: true }); + + (ctx ? it : it.skip)('basic', async () => { + const ctx = getGLContext(32, 32); + const scene = Scene.create(ctx); + const cylinders = createCylinders(); + scene.add(cylinders); + setDebugMode(true); + expect(() => scene.commit()).not.toThrow(); + setDebugMode(false); + ctx.destroy(); + }); +}); \ No newline at end of file diff --git a/src/mol-gl/_spec/direct-volume.spec.ts b/src/mol-gl/_spec/direct-volume.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ae6e8092980e33f985530e1abdbcdac7a4aac41 --- /dev/null +++ b/src/mol-gl/_spec/direct-volume.spec.ts @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createRenderObject } from '../render-object'; +import { Scene } from '../scene'; +import { getGLContext, tryGetGLContext } from './gl'; +import { setDebugMode } from '../../mol-util/debug'; +import { ColorNames } from '../../mol-util/color/names'; +import { ParamDefinition as PD } from '../../mol-util/param-definition'; +import { DirectVolume } from '../../mol-geo/geometry/direct-volume/direct-volume'; + +export function createDirectVolume() { + const directVolume = DirectVolume.createEmpty(); + const props = PD.getDefaultValues(DirectVolume.Params); + const values = DirectVolume.Utils.createValuesSimple(directVolume, props, ColorNames.orange, 1); + const state = DirectVolume.Utils.createRenderableState(props); + return createRenderObject('direct-volume', values, state, -1); +} + +describe('direct-volume', () => { + const ctx = tryGetGLContext(32, 32); + + (ctx ? it : it.skip)('basic', async () => { + const ctx = getGLContext(32, 32); + const scene = Scene.create(ctx); + const directVolume = createDirectVolume(); + scene.add(directVolume); + setDebugMode(true); + expect(() => scene.commit()).not.toThrow(); + setDebugMode(false); + ctx.destroy(); + }); +}); \ No newline at end of file diff --git a/src/mol-gl/_spec/gl.shim.ts b/src/mol-gl/_spec/gl.shim.ts index 049a3a3e57f9c558413c27adb4de2431ac145571..5c07826ac49b6cf8369fa7f5ceba357164ad3a8e 100644 --- a/src/mol-gl/_spec/gl.shim.ts +++ b/src/mol-gl/_spec/gl.shim.ts @@ -760,8 +760,8 @@ export function createGl(width: number, height: number, contextAttributes: WebGL validateProgram: function () { }, generateMipmap: function () { }, isContextLost: function () { return false; }, - drawingBufferWidth: 1024, - drawingBufferHeight: 1024, + drawingBufferWidth: width, + drawingBufferHeight: height, blendColor: function () { }, blendEquation: function () { }, blendEquationSeparate: function () { }, diff --git a/src/mol-gl/_spec/gl.ts b/src/mol-gl/_spec/gl.ts new file mode 100644 index 0000000000000000000000000000000000000000..eadedd99817cde64b2e399ef74fcbde1ab2318cb --- /dev/null +++ b/src/mol-gl/_spec/gl.ts @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createContext } from '../webgl/context'; + +export function getGLContext(width: number, height: number) { + const gl = require('gl')(width, height, { + alpha: true, + depth: true, + premultipliedAlpha: true, + preserveDrawingBuffer: true, + antialias: true, + }); + return createContext(gl); +} + +export function tryGetGLContext(width: number, height: number, requiredExtensions?: { fragDepth?: boolean }) { + try { + const ctx = getGLContext(width, height); + if (requiredExtensions?.fragDepth && !ctx.extensions.fragDepth) return; + return ctx; + } catch (e) { + return; + } +} \ No newline at end of file diff --git a/src/mol-gl/_spec/image.spec.ts b/src/mol-gl/_spec/image.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..aee29d4213a035a079ce3d679dd5c0df16eb074a --- /dev/null +++ b/src/mol-gl/_spec/image.spec.ts @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createRenderObject } from '../render-object'; +import { Scene } from '../scene'; +import { getGLContext, tryGetGLContext } from './gl'; +import { setDebugMode } from '../../mol-util/debug'; +import { ColorNames } from '../../mol-util/color/names'; +import { ParamDefinition as PD } from '../../mol-util/param-definition'; +import { Image } from '../../mol-geo/geometry/image/image'; + +export function createImage() { + const image = Image.createEmpty(); + const props = PD.getDefaultValues(Image.Params); + const values = Image.Utils.createValuesSimple(image, props, ColorNames.orange, 1); + const state = Image.Utils.createRenderableState(props); + return createRenderObject('image', values, state, -1); +} + +describe('image', () => { + const ctx = tryGetGLContext(32, 32); + + (ctx ? it : it.skip)('basic', async () => { + const ctx = getGLContext(32, 32); + const scene = Scene.create(ctx); + const image = createImage(); + scene.add(image); + setDebugMode(true); + expect(() => scene.commit()).not.toThrow(); + setDebugMode(false); + ctx.destroy(); + }); +}); \ No newline at end of file diff --git a/src/mol-gl/_spec/lines.spec.ts b/src/mol-gl/_spec/lines.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1f88f8d9650e548cee9bb32909de11047734df5 --- /dev/null +++ b/src/mol-gl/_spec/lines.spec.ts @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createRenderObject } from '../render-object'; +import { Scene } from '../scene'; +import { getGLContext, tryGetGLContext } from './gl'; +import { setDebugMode } from '../../mol-util/debug'; +import { ColorNames } from '../../mol-util/color/names'; +import { ParamDefinition as PD } from '../../mol-util/param-definition'; +import { Lines } from '../../mol-geo/geometry/lines/lines'; + +export function createLines() { + const lines = Lines.createEmpty(); + const props = PD.getDefaultValues(Lines.Params); + const values = Lines.Utils.createValuesSimple(lines, props, ColorNames.orange, 1); + const state = Lines.Utils.createRenderableState(props); + return createRenderObject('lines', values, state, -1); +} + +describe('lines', () => { + const ctx = tryGetGLContext(32, 32); + + (ctx ? it : it.skip)('basic', async () => { + const ctx = getGLContext(32, 32); + const scene = Scene.create(ctx); + const lines = createLines(); + scene.add(lines); + setDebugMode(true); + expect(() => scene.commit()).not.toThrow(); + setDebugMode(false); + ctx.destroy(); + }); +}); \ No newline at end of file diff --git a/src/mol-gl/_spec/mesh.spec.ts b/src/mol-gl/_spec/mesh.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1b00f14f11b9f0a87c3bec67464c9bcec8f3b19 --- /dev/null +++ b/src/mol-gl/_spec/mesh.spec.ts @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createRenderObject } from '../render-object'; +import { Scene } from '../scene'; +import { getGLContext, tryGetGLContext } from './gl'; +import { setDebugMode } from '../../mol-util/debug'; +import { ColorNames } from '../../mol-util/color/names'; +import { ParamDefinition as PD } from '../../mol-util/param-definition'; +import { Mesh } from '../../mol-geo/geometry/mesh/mesh'; + +export function createMesh() { + const mesh = Mesh.createEmpty(); + const props = PD.getDefaultValues(Mesh.Params); + const values = Mesh.Utils.createValuesSimple(mesh, props, ColorNames.orange, 1); + const state = Mesh.Utils.createRenderableState(props); + return createRenderObject('mesh', values, state, -1); +} + +describe('mesh', () => { + const ctx = tryGetGLContext(32, 32); + + (ctx ? it : it.skip)('basic', async () => { + const ctx = getGLContext(32, 32); + const scene = Scene.create(ctx); + const mesh = createMesh(); + scene.add(mesh); + setDebugMode(true); + expect(() => scene.commit()).not.toThrow(); + setDebugMode(false); + ctx.destroy(); + }); +}); \ No newline at end of file diff --git a/src/mol-gl/_spec/points.spec.ts b/src/mol-gl/_spec/points.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..358b3094d90b09565d2bae1aa1dcbbaff729e9dd --- /dev/null +++ b/src/mol-gl/_spec/points.spec.ts @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createRenderObject } from '../render-object'; +import { Scene } from '../scene'; +import { getGLContext, tryGetGLContext } from './gl'; +import { setDebugMode } from '../../mol-util/debug'; +import { ColorNames } from '../../mol-util/color/names'; +import { ParamDefinition as PD } from '../../mol-util/param-definition'; +import { Points } from '../../mol-geo/geometry/points/points'; + +export function createPoints() { + const points = Points.createEmpty(); + const props = PD.getDefaultValues(Points.Params); + const values = Points.Utils.createValuesSimple(points, props, ColorNames.orange, 1); + const state = Points.Utils.createRenderableState(props); + return createRenderObject('points', values, state, -1); +} + +describe('points', () => { + const ctx = tryGetGLContext(32, 32); + + (ctx ? it : it.skip)('basic', async () => { + const ctx = getGLContext(32, 32); + const scene = Scene.create(ctx); + const points = createPoints(); + scene.add(points); + setDebugMode(true); + expect(() => scene.commit()).not.toThrow(); + setDebugMode(false); + ctx.destroy(); + }); +}); \ No newline at end of file diff --git a/src/mol-gl/_spec/renderer.spec.ts b/src/mol-gl/_spec/renderer.spec.ts index c07e61bc5a9d490ba34cae3e20a6f04188af0ee1..6cad18dc71f3fa3960af36b7a21ba686d80fa0e3 100644 --- a/src/mol-gl/_spec/renderer.spec.ts +++ b/src/mol-gl/_spec/renderer.spec.ts @@ -5,28 +5,14 @@ */ import { createGl } from './gl.shim'; - import { Camera } from '../../mol-canvas3d/camera'; -import { Vec3, Mat4, Vec4 } from '../../mol-math/linear-algebra'; -import { ValueCell } from '../../mol-util'; - +import { Vec3 } from '../../mol-math/linear-algebra'; import { Renderer } from '../renderer'; -import { createValueColor } from '../../mol-geo/geometry/color-data'; -import { createValueSize } from '../../mol-geo/geometry/size-data'; import { createContext } from '../webgl/context'; -import { RenderableState } from '../renderable'; -import { createRenderObject } from '../render-object'; -import { PointsValues } from '../renderable/points'; import { Scene } from '../scene'; -import { createEmptyMarkers } from '../../mol-geo/geometry/marker-data'; -import { fillSerial } from '../../mol-util/array'; -import { Color } from '../../mol-util/color'; -import { Sphere3D } from '../../mol-math/geometry'; -import { createEmptyOverpaint } from '../../mol-geo/geometry/overpaint-data'; -import { createEmptyTransparency } from '../../mol-geo/geometry/transparency-data'; -import { createEmptyClipping } from '../../mol-geo/geometry/clipping-data'; +import { createPoints } from './points.spec'; -function createRenderer(gl: WebGLRenderingContext) { +export function createRenderer(gl: WebGLRenderingContext) { const ctx = createContext(gl); const camera = new Camera({ position: Vec3.create(0, 0, 50) @@ -35,80 +21,14 @@ function createRenderer(gl: WebGLRenderingContext) { return { ctx, camera, renderer }; } -function createPoints() { - const aPosition = ValueCell.create(new Float32Array([0, -1, 0, -1, 0, 0, 1, 1, 0])); - const aGroup = ValueCell.create(fillSerial(new Float32Array(3))); - const aInstance = ValueCell.create(fillSerial(new Float32Array(1))); - const color = createValueColor(Color(0xFF0000)); - const size = createValueSize(1); - const marker = createEmptyMarkers(); - const overpaint = createEmptyOverpaint(); - const transparency = createEmptyTransparency(); - const clipping = createEmptyClipping(); - - const aTransform = ValueCell.create(new Float32Array(16)); - const m4 = Mat4.identity(); - Mat4.toArray(m4, aTransform.ref.value, 0); - const transform = ValueCell.create(new Float32Array(aTransform.ref.value)); - const extraTransform = ValueCell.create(new Float32Array(aTransform.ref.value)); - - const boundingSphere = ValueCell.create(Sphere3D.create(Vec3.zero(), 2)); - const invariantBoundingSphere = ValueCell.create(Sphere3D.create(Vec3.zero(), 2)); - - const values: PointsValues = { - aPosition, - aGroup, - aTransform, - aInstance, - ...color, - ...marker, - ...size, - ...overpaint, - ...transparency, - ...clipping, - - uAlpha: ValueCell.create(1.0), - uVertexCount: ValueCell.create(3), - uInstanceCount: ValueCell.create(1), - uGroupCount: ValueCell.create(3), - uInvariantBoundingSphere: ValueCell.create(Vec4.ofSphere(invariantBoundingSphere.ref.value)), - - alpha: ValueCell.create(1.0), - drawCount: ValueCell.create(3), - instanceCount: ValueCell.create(1), - matrix: ValueCell.create(m4), - transform, - extraTransform, - hasReflection: ValueCell.create(false), - boundingSphere, - invariantBoundingSphere, - - uSizeFactor: ValueCell.create(1), - dPointSizeAttenuation: ValueCell.create(true), - dPointStyle: ValueCell.create('square'), - }; - const state: RenderableState = { - disposed: false, - visible: true, - alphaFactor: 1, - pickable: true, - colorOnly: false, - opaque: true, - writeDepth: true, - noClip: false, - }; - - return createRenderObject('points', values, state, -1); -} - describe('renderer', () => { it('basic', () => { const [width, height] = [32, 32]; const gl = createGl(width, height, { preserveDrawingBuffer: true }); const { ctx, renderer } = createRenderer(gl); - expect(ctx.gl.canvas.width).toBe(32); - expect(ctx.gl.canvas.height).toBe(32); + expect(ctx.gl.drawingBufferWidth).toBe(32); + expect(ctx.gl.drawingBufferHeight).toBe(32); expect(ctx.stats.resourceCounts.attribute).toBe(0); expect(ctx.stats.resourceCounts.texture).toBe(0); diff --git a/src/mol-gl/_spec/spheres.spec.ts b/src/mol-gl/_spec/spheres.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecf721aaf719e0b00f25d8014e0d48385804e674 --- /dev/null +++ b/src/mol-gl/_spec/spheres.spec.ts @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createRenderObject } from '../render-object'; +import { Scene } from '../scene'; +import { getGLContext, tryGetGLContext } from './gl'; +import { setDebugMode } from '../../mol-util/debug'; +import { ColorNames } from '../../mol-util/color/names'; +import { ParamDefinition as PD } from '../../mol-util/param-definition'; +import { Spheres } from '../../mol-geo/geometry/spheres/spheres'; + +export function createSpheres() { + const spheres = Spheres.createEmpty(); + const props = PD.getDefaultValues(Spheres.Params); + const values = Spheres.Utils.createValuesSimple(spheres, props, ColorNames.orange, 1); + const state = Spheres.Utils.createRenderableState(props); + return createRenderObject('spheres', values, state, -1); +} + +describe('spheres', () => { + const ctx = tryGetGLContext(32, 32, { fragDepth: true }); + + (ctx ? it : it.skip)('basic', async () => { + const ctx = getGLContext(32, 32); + const scene = Scene.create(ctx); + const spheres = createSpheres(); + scene.add(spheres); + setDebugMode(true); + expect(() => scene.commit()).not.toThrow(); + setDebugMode(false); + ctx.destroy(); + }); +}); \ No newline at end of file diff --git a/src/mol-gl/_spec/text.spec.ts b/src/mol-gl/_spec/text.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..c808110eb02f0ce17b05c13c8343c2cce306d2fa --- /dev/null +++ b/src/mol-gl/_spec/text.spec.ts @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createRenderObject } from '../render-object'; +import { Scene } from '../scene'; +import { getGLContext, tryGetGLContext } from './gl'; +import { setDebugMode } from '../../mol-util/debug'; +import { ColorNames } from '../../mol-util/color/names'; +import { ParamDefinition as PD } from '../../mol-util/param-definition'; +import { Text } from '../../mol-geo/geometry/text/text'; + +export function createText() { + const text = Text.createEmpty(); + const props = PD.getDefaultValues(Text.Params); + const values = Text.Utils.createValuesSimple(text, props, ColorNames.orange, 1); + const state = Text.Utils.createRenderableState(props); + return createRenderObject('text', values, state, -1); +} + +describe('text', () => { + const ctx = tryGetGLContext(32, 32); + + (ctx ? it : it.skip)('basic', async () => { + const ctx = getGLContext(32, 32); + const scene = Scene.create(ctx); + const text = createText(); + scene.add(text); + setDebugMode(true); + expect(() => scene.commit()).not.toThrow(); + setDebugMode(false); + ctx.destroy(); + }); +}); \ No newline at end of file diff --git a/src/mol-gl/_spec/texture-mesh.spec.ts b/src/mol-gl/_spec/texture-mesh.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..d30cd59e630a643991be00f9c0b197eb55e1dd3a --- /dev/null +++ b/src/mol-gl/_spec/texture-mesh.spec.ts @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2021 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { createRenderObject } from '../render-object'; +import { Scene } from '../scene'; +import { getGLContext, tryGetGLContext } from './gl'; +import { setDebugMode } from '../../mol-util/debug'; +import { ColorNames } from '../../mol-util/color/names'; +import { ParamDefinition as PD } from '../../mol-util/param-definition'; +import { TextureMesh } from '../../mol-geo/geometry/texture-mesh/texture-mesh'; + +export function createTextureMesh() { + const textureMesh = TextureMesh.createEmpty(); + const props = PD.getDefaultValues(TextureMesh.Params); + const values = TextureMesh.Utils.createValuesSimple(textureMesh, props, ColorNames.orange, 1); + const state = TextureMesh.Utils.createRenderableState(props); + return createRenderObject('texture-mesh', values, state, -1); +} + +describe('texture-mesh', () => { + const ctx = tryGetGLContext(32, 32); + + (ctx ? it : it.skip)('basic', async () => { + const ctx = getGLContext(32, 32); + const scene = Scene.create(ctx); + const textureMesh = createTextureMesh(); + scene.add(textureMesh); + setDebugMode(true); + expect(() => scene.commit()).not.toThrow(); + setDebugMode(false); + ctx.destroy(); + }); +}); \ No newline at end of file diff --git a/src/mol-gl/webgl/context.ts b/src/mol-gl/webgl/context.ts index 5ce242b2aa25b81dfebe4beb48376d0a3ac582c5..e094bb149bdd69aa3e226ec579793ba17c96e81a 100644 --- a/src/mol-gl/webgl/context.ts +++ b/src/mol-gl/webgl/context.ts @@ -358,7 +358,10 @@ export function createContext(gl: GLRenderingContext, props: Partial<{ pixelScal unbindResources(gl); // to aid GC - if (!options?.doNotForceWebGLContextLoss) gl.getExtension('WEBGL_lose_context')?.loseContext(); + if (!options?.doNotForceWebGLContextLoss) { + gl.getExtension('WEBGL_lose_context')?.loseContext(); + gl.getExtension('STACKGL_destroy_context')?.destroy(); + } } }; } \ No newline at end of file diff --git a/tsconfig.commonjs.json b/tsconfig.commonjs.json index d5f4506c8729addb6e6610322071f0ec7d0dbba8..a50c6cfb679bb69ac7884d4d41e2bd530f6f018e 100644 --- a/tsconfig.commonjs.json +++ b/tsconfig.commonjs.json @@ -14,6 +14,7 @@ "moduleResolution": "node", "importHelpers": true, "noEmitHelpers": true, + "allowSyntheticDefaultImports": true, "jsx": "react-jsx", "lib": [ "es6", "dom", "esnext.asynciterable", "es2016" ], "rootDir": "src", diff --git a/tsconfig.json b/tsconfig.json index 2bbaf15110d0449aa3ea422d26c5a06bdf9c65d8..2bc1481639aa54b4182019788caf57b96d85ab83 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,6 +14,7 @@ "moduleResolution": "node", "importHelpers": true, "noEmitHelpers": true, + "allowSyntheticDefaultImports": true, "jsx": "react-jsx", "lib": [ "es6", "dom", "esnext.asynciterable", "es2016" ], "rootDir": "src",