(mode)
| 102 | |
| 103 | describe('features: constants texture 3d'); |
| 104 | function test3D(mode) { |
| 105 | const gpu = new GPU({ mode }); |
| 106 | const createTexture = gpu |
| 107 | .createKernel(function() { |
| 108 | return 200; |
| 109 | }) |
| 110 | .setOutput([2, 2, 2]) |
| 111 | .setPipeline(true); |
| 112 | const texture = createTexture(); |
| 113 | const tryConst = gpu.createKernel( |
| 114 | function() { |
| 115 | return this.constants.texture[this.thread.z][this.thread.y][this.thread.x]; |
| 116 | }, |
| 117 | { |
| 118 | constants: { texture } |
| 119 | } |
| 120 | ).setOutput([2, 2, 2]); |
| 121 | const result = tryConst(); |
| 122 | const expected = [[new Float32Array([200, 200]), new Float32Array([200, 200])],[new Float32Array([200, 200]), new Float32Array([200, 200])]]; |
| 123 | assert.deepEqual(result, expected, 'texture constant passed test'); |
| 124 | gpu.destroy(); |
| 125 | } |
| 126 | |
| 127 | test('auto', () => { |
| 128 | test3D(null); |
no test coverage detected
searching dependent graphs…