(mode)
| 405 | }); |
| 406 | |
| 407 | function arrayTexture4(mode) { |
| 408 | const gpu = new GPU({ mode }); |
| 409 | function addOne(functionValue) { |
| 410 | const declaredValue = functionValue[this.thread.x]; |
| 411 | return declaredValue[0] + 1 |
| 412 | + declaredValue[1] + 1 |
| 413 | + declaredValue[2] + 1 |
| 414 | + declaredValue[3] + 1; |
| 415 | } |
| 416 | gpu.addFunction(addOne); |
| 417 | const texture1 = gpu.createKernel(function() { |
| 418 | return [1,2,3,4]; |
| 419 | }, { |
| 420 | output: [1], |
| 421 | precision: 'single', |
| 422 | pipeline: true, |
| 423 | })(); |
| 424 | if (mode !== 'cpu') { |
| 425 | assert.equal(texture1.type, 'ArrayTexture(4)'); |
| 426 | } |
| 427 | |
| 428 | const kernel = gpu.createKernel(function(kernelValue) { |
| 429 | return addOne(kernelValue); |
| 430 | }, { output: [1] }); |
| 431 | const result = kernel(texture1); |
| 432 | assert.equal(result[0], 14); |
| 433 | gpu.destroy(); |
| 434 | } |
| 435 | |
| 436 | (GPU.isSinglePrecisionSupported ? test : skip)('ArrayTexture(4) auto', ()=> { |
| 437 | arrayTexture4(); |
no test coverage detected
searching dependent graphs…