(mode)
| 53 | |
| 54 | describe('features: constants texture 2d'); |
| 55 | function test2D(mode) { |
| 56 | const gpu = new GPU({ mode }); |
| 57 | const createTexture = gpu |
| 58 | .createKernel(function() { |
| 59 | return 200; |
| 60 | }) |
| 61 | .setOutput([2, 2]) |
| 62 | .setPipeline(true); |
| 63 | const texture = createTexture(); |
| 64 | const tryConst = gpu.createKernel( |
| 65 | function() { |
| 66 | return this.constants.texture[this.thread.y][this.thread.x]; |
| 67 | }, |
| 68 | { |
| 69 | constants: { texture } |
| 70 | } |
| 71 | ).setOutput([2, 2]); |
| 72 | const result = tryConst(); |
| 73 | const expected = [new Float32Array([200, 200]), new Float32Array([200, 200])]; |
| 74 | assert.deepEqual(result, expected, 'texture constant passed test'); |
| 75 | gpu.destroy(); |
| 76 | } |
| 77 | |
| 78 | test('auto', () => { |
| 79 | test2D(null); |
no test coverage detected
searching dependent graphs…