mirror of
https://github.com/gpujs/gpu.js.git
synced 2025-12-08 20:35:56 +00:00
feat: Add cat demo feat: Type check even on CPU fix: ArrayTexture support as arguments for internal arrays fix: Typo from "Interger" to "Integer" feat: Bump and build version number
53 lines
1.0 KiB
JavaScript
53 lines
1.0 KiB
JavaScript
const { assert, skip, test, module: describe, only } = require('qunit');
|
|
const { GPU } = require('../../src');
|
|
|
|
describe('issue #410 - if statement when unsigned on NVidia');
|
|
|
|
function ifStatement(mode) {
|
|
const gpu = new GPU({ mode });
|
|
const kernel = gpu.createKernel(function(a) {
|
|
const paramDenom = a[this.thread.x][1] - a[this.thread.x][0];
|
|
if(paramDenom === 0) {
|
|
return 100;
|
|
}
|
|
return 200;
|
|
})
|
|
.setPrecision('unsigned')
|
|
.setOutput([2]);
|
|
|
|
const result =
|
|
kernel(
|
|
[
|
|
[0, 0],
|
|
[0, 2]
|
|
]
|
|
);
|
|
|
|
assert.deepEqual(Array.from(result), [100,200]);
|
|
gpu.destroy();
|
|
}
|
|
|
|
test('auto', () => {
|
|
ifStatement();
|
|
});
|
|
|
|
test('gpu', () => {
|
|
ifStatement('gpu');
|
|
});
|
|
|
|
(GPU.isWebGLSupported ? test : skip)('webgl', () => {
|
|
ifStatement('webgl');
|
|
});
|
|
|
|
(GPU.isWebGL2Supported ? test : skip)('webgl2', () => {
|
|
ifStatement('webgl2');
|
|
});
|
|
|
|
(GPU.isHeadlessGLSupported ? test : skip)('headlessgl', () => {
|
|
ifStatement('headlessgl');
|
|
});
|
|
|
|
test('cpu', () => {
|
|
ifStatement('cpu');
|
|
});
|