MCPcopy Index your code
hub / github.com/gpujs/gpu.js / testUnsignedPrecisionMatrix

Function testUnsignedPrecisionMatrix

test/features/dynamic-arguments.js:1037–1070  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

1035});
1036
1037function testUnsignedPrecisionMatrix(mode) {
1038 const gpu = new GPU({ mode });
1039 const kernel = gpu.createKernel(function(input) {
1040 return input[this.thread.y][this.thread.x];
1041 })
1042 .setPrecision('unsigned')
1043 .setDynamicArguments(true)
1044 .setDynamicOutput(true)
1045 .setOutput([4,4]);
1046
1047 let matrix = [
1048 [1,2,3,4],
1049 [5,6,7,8],
1050 [9,10,11,12],
1051 [13,14,15,16]
1052 ];
1053 assert.deepEqual(kernel(matrix), matrix.map(row => new Float32Array(row)));
1054
1055 kernel.setOutput([3,3]);
1056 matrix = [
1057 [1,2,3],
1058 [4,5,6],
1059 [7,8,9]
1060 ];
1061 assert.deepEqual(kernel(matrix), matrix.map(row => new Float32Array(row)));
1062
1063 kernel.setOutput([2,2]);
1064 matrix = [
1065 [1,2],
1066 [3,4]
1067 ];
1068 assert.deepEqual(kernel(matrix), matrix.map(row => new Float32Array(row)));
1069 gpu.destroy();
1070}
1071
1072test('unsigned precision Matrix auto', () => {
1073 testUnsignedPrecisionMatrix();

Callers 1

Calls 7

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
setDynamicOutputMethod · 0.80
setDynamicArgumentsMethod · 0.80
setOutputMethod · 0.45
setPrecisionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…