(mode)
| 90 | |
| 91 | |
| 92 | function handleCastingMixedWithNativeFunctions(mode) { |
| 93 | const gpu = new GPU({ mode }); |
| 94 | gpu.addNativeFunction('add', ` |
| 95 | float add(float value1, int value2) { |
| 96 | return value1 + float(value2); |
| 97 | } |
| 98 | `); |
| 99 | const kernel = gpu.createKernel(function(value1, value2) { |
| 100 | return add(value1, value2); |
| 101 | }, { |
| 102 | output: [1], |
| 103 | strictIntegers: true, |
| 104 | }); |
| 105 | const result = kernel(1, 2.5); |
| 106 | assert.deepEqual(Array.from(result), [3]); |
| 107 | assert.deepEqual(kernel.argumentTypes, ['Integer', 'Float']); |
| 108 | gpu.destroy(); |
| 109 | } |
| 110 | |
| 111 | (GPU.isWebGLSupported ? test : skip)('handle casting mixed with native functions webgl', () => { |
| 112 | handleCastingMixedWithNativeFunctions('webgl'); |
no test coverage detected
searching dependent graphs…