Skip to content

Commit 1955ad3

Browse files
fix: #586
1 parent 61dfe8a commit 1955ad3

9 files changed

+70
-30
lines changed

dist/gpu-browser-core.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 2.9.0
8-
* @date Sun Mar 22 2020 17:17:39 GMT-0400 (Eastern Daylight Time)
7+
* @version 2.9.1
8+
* @date Tue Mar 24 2020 07:52:55 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -10378,9 +10378,7 @@ class WebGLKernel extends GLKernel {
1037810378
return failureResult;
1037910379
}
1038010380
const { texSize, context: gl, canvas } = this;
10381-
if (!this.pipeline) {
10382-
gl.enable(gl.SCISSOR_TEST);
10383-
}
10381+
gl.enable(gl.SCISSOR_TEST);
1038410382
if (this.pipeline && this.precision === 'single') {
1038510383
gl.viewport(0, 0, this.maxTexSize[0], this.maxTexSize[1]);
1038610384
canvas.width = this.maxTexSize[0];
@@ -10505,9 +10503,7 @@ class WebGLKernel extends GLKernel {
1050510503
const { kernelArguments, texSize, forceUploadKernelConstants, context: gl } = this;
1050610504

1050710505
gl.useProgram(this.program);
10508-
if (!this.pipeline) {
10509-
gl.scissor(0, 0, texSize[0], texSize[1]);
10510-
}
10506+
gl.scissor(0, 0, texSize[0], texSize[1]);
1051110507
if (this.dynamicOutput) {
1051210508
this.setUniform3iv('uOutputDim', new Int32Array(this.threadDim));
1051310509
this.setUniform2iv('uTexSize', texSize);

dist/gpu-browser-core.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/gpu-browser.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*
55
* GPU Accelerated JavaScript
66
*
7-
* @version 2.9.0
8-
* @date Sun Mar 22 2020 17:17:39 GMT-0400 (Eastern Daylight Time)
7+
* @version 2.9.1
8+
* @date Tue Mar 24 2020 07:52:55 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -14831,9 +14831,7 @@ class WebGLKernel extends GLKernel {
1483114831
return failureResult;
1483214832
}
1483314833
const { texSize, context: gl, canvas } = this;
14834-
if (!this.pipeline) {
14835-
gl.enable(gl.SCISSOR_TEST);
14836-
}
14834+
gl.enable(gl.SCISSOR_TEST);
1483714835
if (this.pipeline && this.precision === 'single') {
1483814836
gl.viewport(0, 0, this.maxTexSize[0], this.maxTexSize[1]);
1483914837
canvas.width = this.maxTexSize[0];
@@ -14958,9 +14956,7 @@ class WebGLKernel extends GLKernel {
1495814956
const { kernelArguments, texSize, forceUploadKernelConstants, context: gl } = this;
1495914957

1496014958
gl.useProgram(this.program);
14961-
if (!this.pipeline) {
14962-
gl.scissor(0, 0, texSize[0], texSize[1]);
14963-
}
14959+
gl.scissor(0, 0, texSize[0], texSize[1]);
1496414960
if (this.dynamicOutput) {
1496514961
this.setUniform3iv('uOutputDim', new Int32Array(this.threadDim));
1496614962
this.setUniform2iv('uTexSize', texSize);

dist/gpu-browser.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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.9.0",
3+
"version": "2.9.1",
44
"description": "GPU Accelerated JavaScript",
55
"engines": {
66
"node": ">=8.0.0"

src/backend/web-gl/kernel.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,7 @@ class WebGLKernel extends GLKernel {
483483
return failureResult;
484484
}
485485
const { texSize, context: gl, canvas } = this;
486-
if (!this.pipeline) {
487-
gl.enable(gl.SCISSOR_TEST);
488-
}
486+
gl.enable(gl.SCISSOR_TEST);
489487
if (this.pipeline && this.precision === 'single') {
490488
gl.viewport(0, 0, this.maxTexSize[0], this.maxTexSize[1]);
491489
canvas.width = this.maxTexSize[0];
@@ -610,9 +608,7 @@ class WebGLKernel extends GLKernel {
610608
const { kernelArguments, texSize, forceUploadKernelConstants, context: gl } = this;
611609

612610
gl.useProgram(this.program);
613-
if (!this.pipeline) {
614-
gl.scissor(0, 0, texSize[0], texSize[1]);
615-
}
611+
gl.scissor(0, 0, texSize[0], texSize[1]);
616612
if (this.dynamicOutput) {
617613
this.setUniform3iv('uOutputDim', new Int32Array(this.threadDim));
618614
this.setUniform2iv('uTexSize', texSize);

test/all.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
<script type="module" src="issues/560-minification-madness.js"></script>
178178
<script type="module" src="issues/564-boolean.js"></script>
179179
<script type="module" src="issues/567-wrong-modulus.js"></script>
180+
<script type="module" src="issues/586-unable-to-resize.js"></script>
180181
<script type="module" src="issues/91-create-kernel-map-array.js"></script>
181182
<script type="module" src="issues/96-param-names.js"></script>
182183
<script type="module" src="features/to-string/as-file.js"></script>

test/issues/586-unable-to-resize.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const { assert, skip, test, module: describe, only } = require('qunit');
2+
const { GPU } = require('../../src');
3+
4+
describe('issue #586 - unable to resize');
5+
6+
function testResize(convert, mode) {
7+
const gpu = new GPU({ mode });
8+
const createTexture1 = gpu.createKernel(function() {
9+
return 1;
10+
}, { output: [2, 2], pipeline: false});
11+
12+
const createTexture2 = gpu.createKernel(function() {
13+
return 1;
14+
}, { output: [4, 4], pipeline: true});
15+
16+
var t1 = createTexture1();
17+
var t2 = createTexture2();
18+
19+
assert.deepEqual(convert(t2), [
20+
new Float32Array([1,1,1,1]),
21+
new Float32Array([1,1,1,1]),
22+
new Float32Array([1,1,1,1]),
23+
new Float32Array([1,1,1,1]),
24+
]);
25+
26+
gpu.destroy();
27+
}
28+
29+
test('auto', () => {
30+
testResize(t => t.toArray());
31+
});
32+
33+
test('gpu', () => {
34+
testResize(t => t.toArray(), 'gpu');
35+
});
36+
37+
(GPU.isWebGLSupported ? test : skip)('webgl', () => {
38+
testResize(t => t.toArray(), 'webgl');
39+
});
40+
41+
(GPU.isWebGL2Supported ? test : skip)('webgl2', () => {
42+
testResize(t => t.toArray(), 'webgl2');
43+
});
44+
45+
(GPU.isHeadlessGLSupported ? test : skip)('headlessgl', () => {
46+
testResize(t => t.toArray(), 'headlessgl');
47+
});
48+
49+
test('cpu', () => {
50+
testResize(a => a, 'cpu');
51+
});

0 commit comments

Comments
 (0)