(mode)
| 358 | }); |
| 359 | |
| 360 | function arrayTexture3(mode) { |
| 361 | const gpu = new GPU({ mode }); |
| 362 | function addOne(functionValue) { |
| 363 | const declaredValue = functionValue[this.thread.x]; |
| 364 | return declaredValue[0] + 1 |
| 365 | + declaredValue[1] + 1 |
| 366 | + declaredValue[2] + 1; |
| 367 | } |
| 368 | gpu.addFunction(addOne); |
| 369 | const texture1 = gpu.createKernel(function() { |
| 370 | return [1,2,3]; |
| 371 | }, { |
| 372 | output: [1], |
| 373 | precision: 'single', |
| 374 | pipeline: true, |
| 375 | })(); |
| 376 | if (mode !== 'cpu') { |
| 377 | assert.equal(texture1.type, 'ArrayTexture(3)'); |
| 378 | } |
| 379 | |
| 380 | const kernel = gpu.createKernel(function(kernelValue) { |
| 381 | return addOne(kernelValue); |
| 382 | }, { output: [1] }); |
| 383 | const result = kernel(texture1); |
| 384 | assert.equal(result[0], 9); |
| 385 | gpu.destroy(); |
| 386 | } |
| 387 | |
| 388 | (GPU.isSinglePrecisionSupported ? test : skip)('ArrayTexture(3) auto', ()=> { |
| 389 | arrayTexture3(); |
no test coverage detected
searching dependent graphs…