(mode)
| 123 | |
| 124 | |
| 125 | function float2DOutput(mode) { |
| 126 | const gpu = new GPU({ mode }); |
| 127 | const matrix = [ |
| 128 | [1,2,3,4,5], |
| 129 | [6,7,8,9,10], |
| 130 | [11,12,13,14,15], |
| 131 | ]; |
| 132 | const kernel = gpu.createKernel(function(matrix) { |
| 133 | return matrix[this.thread.y][this.thread.x]; |
| 134 | }, { |
| 135 | output: [5, 3], |
| 136 | optimizeFloatMemory: true, |
| 137 | precision: 'single', |
| 138 | }); |
| 139 | const result = kernel(matrix); |
| 140 | assert.deepEqual(result.map(row => Array.from(row)), matrix); |
| 141 | gpu.destroy(); |
| 142 | } |
| 143 | |
| 144 | (GPU.isSinglePrecisionSupported ? test : skip)('float 2d output auto', () => { |
| 145 | float2DOutput(); |
no test coverage detected
searching dependent graphs…