(mode)
| 3 | |
| 4 | describe('features: constants texture 1d'); |
| 5 | function test1D(mode) { |
| 6 | const gpu = new GPU({ mode }); |
| 7 | const createTexture = gpu |
| 8 | .createKernel(function() { |
| 9 | return 200; |
| 10 | }) |
| 11 | .setOutput([2]) |
| 12 | .setPipeline(true); |
| 13 | const texture = createTexture(); |
| 14 | const tryConst = gpu.createKernel( |
| 15 | function() { |
| 16 | return this.constants.texture[this.thread.x]; |
| 17 | }, |
| 18 | { |
| 19 | constants: { texture } |
| 20 | } |
| 21 | ).setOutput([2]); |
| 22 | const result = tryConst(); |
| 23 | const expected = new Float32Array([200, 200]); |
| 24 | assert.deepEqual(result, expected, 'texture constant passed test'); |
| 25 | gpu.destroy(); |
| 26 | } |
| 27 | |
| 28 | test('auto', () => { |
| 29 | test1D(null); |
no test coverage detected
searching dependent graphs…