(mode)
| 353 | }); |
| 354 | |
| 355 | function testSingleArray1D2(mode) { |
| 356 | const gpu = new GPU({ mode }); |
| 357 | const kernel = gpu.createKernel(function(v) { |
| 358 | return v[this.thread.x]; |
| 359 | }, { |
| 360 | argumentTypes: { v: 'Array1D(2)' }, |
| 361 | dynamicArguments: true, |
| 362 | dynamicOutput: true |
| 363 | }); |
| 364 | const expected1 = [ |
| 365 | new Float32Array([1,2]), |
| 366 | new Float32Array([3,4]), |
| 367 | ]; |
| 368 | kernel.setOutput([expected1.length]); |
| 369 | assert.deepEqual(kernel(expected1), expected1); |
| 370 | const expected2 = [ |
| 371 | new Float32Array([1,2]), |
| 372 | new Float32Array([3,4]), |
| 373 | new Float32Array([5,6]), |
| 374 | new Float32Array([7,8]), |
| 375 | ]; |
| 376 | kernel.setOutput([expected2.length]); |
| 377 | assert.deepEqual(kernel(expected2), expected2); |
| 378 | gpu.destroy(); |
| 379 | } |
| 380 | |
| 381 | test('Single Array1D2 auto', () => { |
| 382 | testSingleArray1D2(); |
no test coverage detected
searching dependent graphs…