(mode)
| 73 | }); |
| 74 | |
| 75 | function twoArgumentLayerDeepFloat(mode) { |
| 76 | const gpu = new GPU({ mode }); |
| 77 | function child1Function(child1FunctionArgument1) { |
| 78 | return child1FunctionArgument1 + 1; |
| 79 | } |
| 80 | function child2Function(child2FunctionArgument1) { |
| 81 | return child2FunctionArgument1 + 1; |
| 82 | } |
| 83 | gpu |
| 84 | .addFunction(child1Function) |
| 85 | .addFunction(child2Function); |
| 86 | const kernel = gpu.createKernel(function(kernelArgument1) { |
| 87 | return child1Function(child2Function(kernelArgument1)); |
| 88 | }, { output: [1] }); |
| 89 | sinon.spy(FunctionBuilder.prototype, 'lookupReturnType'); |
| 90 | try { |
| 91 | const result = kernel(1.5); |
| 92 | assert.equal(kernel.returnType, 'Float'); |
| 93 | assert.equal(result[0], 3.5); |
| 94 | assert.equal(FunctionBuilder.prototype.lookupReturnType.callCount, 3); |
| 95 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[0][0], 'child2Function'); |
| 96 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[1][0], 'child1Function'); |
| 97 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[2][0], 'child2Function'); |
| 98 | } finally { |
| 99 | FunctionBuilder.prototype.lookupReturnType.restore(); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | (GPU.isWebGLSupported ? test : skip)('two argument layer deep float WebGL', () => { |
| 104 | twoArgumentLayerDeepFloat('webgl'); |
no test coverage detected
searching dependent graphs…