|
5 | 5 | * GPU Accelerated JavaScript |
6 | 6 | * |
7 | 7 | * @version 2.19.8 |
8 | | - * @date Mon Jul 27 2026 01:14:09 GMT+0800 (Singapore Standard Time) |
| 8 | + * @date Mon Jul 27 2026 10:18:00 GMT+0800 (Singapore Standard Time) |
9 | 9 | * |
10 | 10 | * @license MIT |
11 | 11 | * The MIT License |
@@ -2434,7 +2434,8 @@ class FunctionNode { |
2434 | 2434 | } |
2435 | 2435 |
|
2436 | 2436 | const ast = Object.freeze(inParser.parse(`const parser_${ this.name } = ${ this.source };`, { |
2437 | | - locations: true |
| 2437 | + locations: true, |
| 2438 | + ecmaVersion: 2020 |
2438 | 2439 | })); |
2439 | 2440 | const functionAST = ast.body[0].declarations[0].init; |
2440 | 2441 | this.traceFunctionAST(functionAST); |
@@ -10097,6 +10098,7 @@ class WebGLKernel extends GLKernel { |
10097 | 10098 | if (index !== -1) { |
10098 | 10099 | this.textureCache.splice(index, 1); |
10099 | 10100 | } |
| 10101 | + if (!this.context) return; |
10100 | 10102 | this.context.deleteTexture(texture); |
10101 | 10103 | } |
10102 | 10104 |
|
@@ -10240,11 +10242,15 @@ class WebGLKernel extends GLKernel { |
10240 | 10242 | gl.bufferSubData(gl.ARRAY_BUFFER, texCoordOffset, texCoords); |
10241 | 10243 |
|
10242 | 10244 | const aPosLoc = gl.getAttribLocation(this.program, 'aPos'); |
10243 | | - gl.enableVertexAttribArray(aPosLoc); |
10244 | | - gl.vertexAttribPointer(aPosLoc, 2, gl.FLOAT, false, 0, 0); |
| 10245 | + if (aPosLoc !== -1) { |
| 10246 | + gl.enableVertexAttribArray(aPosLoc); |
| 10247 | + gl.vertexAttribPointer(aPosLoc, 2, gl.FLOAT, false, 0, 0); |
| 10248 | + } |
10245 | 10249 | const aTexCoordLoc = gl.getAttribLocation(this.program, 'aTexCoord'); |
10246 | | - gl.enableVertexAttribArray(aTexCoordLoc); |
10247 | | - gl.vertexAttribPointer(aTexCoordLoc, 2, gl.FLOAT, false, 0, texCoordOffset); |
| 10250 | + if (aTexCoordLoc !== -1) { |
| 10251 | + gl.enableVertexAttribArray(aTexCoordLoc); |
| 10252 | + gl.vertexAttribPointer(aTexCoordLoc, 2, gl.FLOAT, false, 0, texCoordOffset); |
| 10253 | + } |
10248 | 10254 | gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer); |
10249 | 10255 |
|
10250 | 10256 | let i = 0; |
@@ -13578,10 +13584,11 @@ class GPU { |
13578 | 13584 | } |
13579 | 13585 | setTimeout(() => { |
13580 | 13586 | try { |
13581 | | - for (let i = 0; i < this.kernels.length; i++) { |
13582 | | - this.kernels[i].destroy(true); |
| 13587 | + const kernels = this.kernels.slice(); |
| 13588 | + for (let i = 0; i < kernels.length; i++) { |
| 13589 | + kernels[i].destroy(true); |
13583 | 13590 | } |
13584 | | - let firstKernel = this.kernels[0]; |
| 13591 | + let firstKernel = kernels[0]; |
13585 | 13592 | if (firstKernel) { |
13586 | 13593 | if (firstKernel.kernel) { |
13587 | 13594 | firstKernel = firstKernel.kernel; |
@@ -14451,7 +14458,7 @@ const utils = { |
14451 | 14458 | if (!flattened) { |
14452 | 14459 | flattened = settings.flattened = {}; |
14453 | 14460 | } |
14454 | | - const ast = acorn.parse(source); |
| 14461 | + const ast = acorn.parse(source, { ecmaVersion: 2020 }); |
14455 | 14462 | const functionDependencies = []; |
14456 | 14463 | let indent = 0; |
14457 | 14464 |
|
@@ -14790,7 +14797,7 @@ const utils = { |
14790 | 14797 |
|
14791 | 14798 | getMinifySafeName: (fn) => { |
14792 | 14799 | try { |
14793 | | - const ast = acorn.parse(`const value = ${fn.toString()}`); |
| 14800 | + const ast = acorn.parse(`const value = ${fn.toString()}`, { ecmaVersion: 2020 }); |
14794 | 14801 | const { init } = ast.body[0].declarations[0]; |
14795 | 14802 | return init.body.name || init.body.body[0].argument.name; |
14796 | 14803 | } catch (e) { |
|
0 commit comments