(mode)
| 47 | |
| 48 | |
| 49 | function rawSinglePrecisionRenderOutput(mode) { |
| 50 | const gpu = new GPU({ mode }); |
| 51 | const kernel = gpu.createKernel(function(v) { |
| 52 | return v[this.thread.x]; |
| 53 | }, { |
| 54 | output: [1], |
| 55 | precision: 'single', |
| 56 | }); |
| 57 | kernel.build([1]); |
| 58 | kernel.run([1]); |
| 59 | const result = kernel.renderRawOutput(); |
| 60 | assert.equal(result.constructor, Float32Array); |
| 61 | // TODO: there is an odd bug in headless gl that causes this to output: |
| 62 | // "0": 1, |
| 63 | // "1": 2097761, |
| 64 | // "2": 2.120494879387071e-36, |
| 65 | // "3": -814303.375 |
| 66 | // For the time being, just check the first value, until this is fixed |
| 67 | // assert.deepEqual(result, new Float32Array([1, 0, 0, 0])); |
| 68 | assert.deepEqual(result.length, 4); |
| 69 | assert.deepEqual(result[0], 1); |
| 70 | gpu.destroy(); |
| 71 | } |
| 72 | |
| 73 | (GPU.isSinglePrecisionSupported ? test : skip)('raw single precision render output auto', () => { |
| 74 | rawSinglePrecisionRenderOutput(); |
no test coverage detected
searching dependent graphs…