(mode)
| 32 | }); |
| 33 | |
| 34 | function handleCastingIntsWithNativeFunctions(mode) { |
| 35 | const gpu = new GPU({ mode }); |
| 36 | gpu.addNativeFunction('add', ` |
| 37 | int add(int value1, int value2) { |
| 38 | return value1 + value2; |
| 39 | } |
| 40 | `); |
| 41 | const kernel = gpu.createKernel(function(value1, value2) { |
| 42 | return add(value1, value2); |
| 43 | }, { output: [1] }); |
| 44 | const result = kernel(0.5, 2.5); |
| 45 | assert.deepEqual(Array.from(result), [2]); |
| 46 | assert.deepEqual(kernel.argumentTypes, ['Float', 'Float']); |
| 47 | gpu.destroy(); |
| 48 | } |
| 49 | |
| 50 | (GPU.isWebGLSupported ? test : skip)('handle casting ints with native functions webgl', () => { |
| 51 | handleCastingIntsWithNativeFunctions('webgl'); |
no test coverage detected
searching dependent graphs…