mirror of
https://github.com/gpujs/gpu.js.git
synced 2025-12-08 20:35:56 +00:00
feat: Consolidate subKernels rendering code as part of the renderStrategy fix: remove tabs, replace with spaces fix: make FunctionBuilder.fromKernel typing static fix: Add missing FunctionBuilder.getPrototypeString definition fix: Move building logic to kernelRunShortcut as well as exec method
40 lines
992 B
JavaScript
40 lines
992 B
JavaScript
const { assert, skip, test, module: describe } = require('qunit');
|
|
const { GPU } = require('../../src');
|
|
|
|
describe('issue #359');
|
|
|
|
function testAddFunctionKernel(mode) {
|
|
const gpu = new GPU({mode});
|
|
function clcC(xx) {
|
|
return Math.abs(xx);
|
|
}
|
|
function intermediate(c1) {
|
|
return clcC(c1);
|
|
}
|
|
|
|
gpu.addFunction(clcC);
|
|
gpu.addFunction(intermediate);
|
|
|
|
const nestFunctionsKernel = gpu.createKernel(function() {
|
|
return intermediate(-1);
|
|
}, {
|
|
output: [1]
|
|
});
|
|
|
|
assert.equal(nestFunctionsKernel()[0], 1);
|
|
|
|
gpu.destroy();
|
|
}
|
|
|
|
(GPU.isWebGLSupported ? test : skip)('Issue #359 - addFunction calls addFunction issue webgl', () => {
|
|
testAddFunctionKernel('webgl')
|
|
});
|
|
|
|
(GPU.isWebGL2Supported ? test : skip)('Issue #359 - addFunction calls addFunction issue webgl2', () => {
|
|
testAddFunctionKernel('webgl2')
|
|
});
|
|
|
|
(GPU.isHeadlessGLSupported ? test : skip)('Issue #359 - addFunction calls addFunction issue headlessgl', () => {
|
|
testAddFunctionKernel('headlessgl')
|
|
});
|