mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
fix: Move `make` cli command to gulp so it runs in parallel fix: Add official support for `Array1D(2|3|4)`, `Array2D(2|3|4)`, and `Array3D(2|3|4)` and unit tests fix: Add offical support for `Array(2)`, `Array(3)`, and `Array(4)` and unit tests fix: Mandelbulb constant used a constant, so moved to appropriate location fix: Failing unit test for Safari fix: When not falling back in HeadlessGL, call `STACKGL_resize_drawingbuffer` fix: Remove `xyz` variable from glsl fix: Add `uniform4fv` and `uniform4iv` to WebGL implementation fix: Check for kernel settings `constantTypes` and `argumentTypes` fix: Inherit type from kernel in KernelValue constructors fix: Add some typescript details for `GPUVariableType`, `IKernelSettings`, and `ITypesList` fix: Add support for 4d array in `utils.getMemoryOptimizedFloatTextureSize` for the special use case of `Array3D(2|3|4)` fix: Add `utils.flatten4dArrayTo` for the special use case of `Array3D(2|3|4)` fix: Add support for 4d array in `utils.flattenTo` fix: Bump and build
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
const { assert, skip, test, module: describe, only } = require('qunit');
|
|
const { GPU } = require('../../../../../../src');
|
|
|
|
describe('feature: to-string unsigned precision arguments Integer');
|
|
|
|
function testArgument(mode, context, canvas) {
|
|
const gpu = new GPU({ mode });
|
|
const originalKernel = gpu.createKernel(function(a) {
|
|
return Math.floor(a) === 100 ? 42 : -42;
|
|
}, {
|
|
canvas,
|
|
context,
|
|
output: [1],
|
|
precision: 'unsigned',
|
|
argumentTypes: { a: 'Integer' },
|
|
});
|
|
assert.equal(originalKernel.argumentTypes[0], 'Integer');
|
|
assert.deepEqual(originalKernel(100)[0], 42);
|
|
assert.deepEqual(originalKernel(10)[0], -42);
|
|
const kernelString = originalKernel.toString(100);
|
|
const newKernel = new Function('return ' + kernelString)()({ context });
|
|
assert.deepEqual(newKernel(100)[0], 42);
|
|
assert.deepEqual(newKernel(10)[0], -42);
|
|
gpu.destroy();
|
|
}
|
|
|
|
(GPU.isWebGLSupported ? test : skip)('webgl', () => {
|
|
const canvas = document.createElement('canvas');
|
|
const context = canvas.getContext('webgl');
|
|
testArgument('webgl', context, canvas);
|
|
});
|
|
|
|
(GPU.isWebGL2Supported ? test : skip)('webgl2', () => {
|
|
const canvas = document.createElement('canvas');
|
|
const context = canvas.getContext('webgl2');
|
|
testArgument('webgl2', context, canvas);
|
|
});
|
|
|
|
(GPU.isHeadlessGLSupported ? test : skip)('headlessgl', () => {
|
|
testArgument('headlessgl', require('gl')(1, 1), null);
|
|
});
|
|
|
|
test('cpu', () => {
|
|
testArgument('cpu');
|
|
});
|