(mode)
| 403 | }); |
| 404 | |
| 405 | function testSingleArray1D3(mode) { |
| 406 | const gpu = new GPU({ mode }); |
| 407 | const kernel = gpu.createKernel(function(v) { |
| 408 | return v[this.thread.x]; |
| 409 | }, { |
| 410 | argumentTypes: { v: 'Array1D(3)' }, |
| 411 | dynamicArguments: true, |
| 412 | dynamicOutput: true |
| 413 | }); |
| 414 | const expected1 = [ |
| 415 | new Float32Array([1,2,3]), |
| 416 | new Float32Array([4,5,6]), |
| 417 | ]; |
| 418 | kernel.setOutput([expected1.length]); |
| 419 | assert.deepEqual(kernel(expected1), expected1); |
| 420 | const expected2 = [ |
| 421 | new Float32Array([1,2,3]), |
| 422 | new Float32Array([4,5,6]), |
| 423 | new Float32Array([7,8,9]), |
| 424 | new Float32Array([10,11,12]), |
| 425 | ]; |
| 426 | kernel.setOutput([expected2.length]); |
| 427 | assert.deepEqual(kernel(expected2), expected2); |
| 428 | gpu.destroy(); |
| 429 | } |
| 430 | |
| 431 | test('Single Array1D3 auto', () => { |
| 432 | testSingleArray1D3(); |
no test coverage detected
searching dependent graphs…