(mode)
| 59 | |
| 60 | |
| 61 | function handleCastingFloatsWithNativeFunctions(mode) { |
| 62 | const gpu = new GPU({ mode }); |
| 63 | gpu.addNativeFunction('add', ` |
| 64 | float add(float value1, float value2) { |
| 65 | return value1 + value2; |
| 66 | } |
| 67 | `); |
| 68 | const kernel = gpu.createKernel(function(value1, value2) { |
| 69 | return add(value1, value2); |
| 70 | }, { |
| 71 | argumentTypes: ['Integer', 'Integer'], |
| 72 | output: [1], |
| 73 | strictIntegers: true, |
| 74 | }); |
| 75 | const result = kernel(1, 2); |
| 76 | assert.deepEqual(Array.from(result), [3]); |
| 77 | assert.deepEqual(kernel.argumentTypes, ['Integer', 'Integer']); |
| 78 | gpu.destroy(); |
| 79 | } |
| 80 | |
| 81 | (GPU.isWebGLSupported ? test : skip)('handle casting floats with native functions webgl', () => { |
| 82 | handleCastingFloatsWithNativeFunctions('webgl'); |
no test coverage detected
searching dependent graphs…