gpu.js/test/internal/constructor-features.js
Robert Plummer 20a9ed54c7 fix: #370 provide means of handling textures form CPU
fix: Add `Kernel.features.channelCount` to each kernel, and unit test
fix: Was curios for code relating to https://github.com/gpujs/gpu.js/wiki/Quick-Concepts and so added a unit tests for matrix-multiply-precision.js
2019-05-22 16:00:03 -04:00

35 lines
889 B
JavaScript

const { assert, test, module: describe, only, skip } = require('qunit');
const { GPU } = require('../../src');
describe('internal: constructor features');
function channelCount(mode) {
const gpu = new GPU({ mode });
const kernel = gpu.createKernel(function() {
return 1;
}, { output: [1] });
kernel();
assert.ok(kernel.kernel.constructor.features.channelCount >= 1);
gpu.destroy();
}
(GPU.isGPUSupported ? test : skip)('channelCount auto', () => {
channelCount();
});
(GPU.isGPUSupported ? test : skip)('channelCount gpu', () => {
channelCount('gpu');
});
(GPU.isWebGLSupported ? test : skip)('channelCount webgl', () => {
channelCount('webgl');
});
(GPU.isWebGL2Supported ? test : skip)('channelCount webgl2', () => {
channelCount('webgl2');
});
(GPU.isHeadlessGLSupported ? test : skip)('channelCount headlessgl', () => {
channelCount('headlessgl');
});