mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
fix: Framebuffer loss after texture is deleted fix: Split up array and primitive (index.js) types of KernelValues and introduce .setup() * This was needed to handle .toArray() from the fix from #553 fix: Performance fix, define texture types in `kernelValue.setup()`, rather than on every `kernelValue.updateValue()`
67 lines
1.7 KiB
JavaScript
67 lines
1.7 KiB
JavaScript
const { assert, skip, test, module: describe, only } = require('qunit');
|
|
const { GPU } = require('../../src');
|
|
|
|
describe('issue #553 - permanent flip');
|
|
|
|
function testFixPermanentFlip(precision, mode) {
|
|
const gpu = new GPU({ mode });
|
|
const kernel = gpu.createKernel(function(a1, a2, a3, a4) {
|
|
return a2[this.thread.x];
|
|
}, {
|
|
precision,
|
|
output: [4]
|
|
});
|
|
const arr = [1, 2, 3, 4];
|
|
for (let i = 0; i < 4; i++) {
|
|
assert.deepEqual(kernel(
|
|
999,
|
|
arr,
|
|
new Image(2, 2),
|
|
999,
|
|
), new Float32Array(arr));
|
|
}
|
|
|
|
gpu.destroy();
|
|
}
|
|
|
|
// unsigned
|
|
(typeof Image === 'undefined' ? skip : test)('auto unsigned', () => {
|
|
testFixPermanentFlip('unsigned');
|
|
});
|
|
|
|
(typeof Image === 'undefined' ? skip : test)('gpu unsigned', () => {
|
|
testFixPermanentFlip('unsigned', 'gpu');
|
|
});
|
|
|
|
(GPU.isWebGLSupported ? test : skip)('webgl unsigned', () => {
|
|
testFixPermanentFlip('unsigned', 'webgl');
|
|
});
|
|
|
|
(GPU.isWebGL2Supported ? test : skip)('webgl2 unsigned', () => {
|
|
testFixPermanentFlip('unsigned', 'webgl2');
|
|
});
|
|
|
|
(typeof Image === 'undefined' ? skip : test)('cpu unsigned', () => {
|
|
testFixPermanentFlip('unsigned', 'cpu');
|
|
});
|
|
|
|
// single
|
|
(typeof Image === 'undefined' ? skip : test)('auto single', () => {
|
|
testFixPermanentFlip('single');
|
|
});
|
|
|
|
(typeof Image === 'undefined' ? skip : test)('gpu single', () => {
|
|
testFixPermanentFlip('single', 'gpu');
|
|
});
|
|
|
|
(GPU.isWebGLSupported ? test : skip)('webgl single', () => {
|
|
testFixPermanentFlip('single', 'webgl');
|
|
});
|
|
|
|
(GPU.isWebGL2Supported ? test : skip)('webgl2 single', () => {
|
|
testFixPermanentFlip('single', 'webgl2');
|
|
});
|
|
|
|
(typeof Image === 'undefined' ? skip : test)('cpu single', () => {
|
|
testFixPermanentFlip('single', 'cpu');
|
|
}); |