(mode)
| 198 | }); |
| 199 | |
| 200 | function threeArgumentLayerDeepNumberTexture1(mode) { |
| 201 | const gpu = new GPU({ mode }); |
| 202 | const texture = gpu.createKernel(function() { |
| 203 | return 1.5; |
| 204 | }, { output: [1], pipeline: true, precision: 'single' })(); |
| 205 | function child1Function(child1FunctionArgument1) { |
| 206 | return child1FunctionArgument1 + 1; |
| 207 | } |
| 208 | function child2Function(child2FunctionArgument1) { |
| 209 | return child2FunctionArgument1 + 1; |
| 210 | } |
| 211 | function child3Function(child3FunctionArgument1) { |
| 212 | return child3FunctionArgument1[this.thread.x] + 1; |
| 213 | } |
| 214 | gpu |
| 215 | .addFunction(child1Function) |
| 216 | .addFunction(child2Function) |
| 217 | .addFunction(child3Function); |
| 218 | const kernel = gpu.createKernel(function(kernelArgument1) { |
| 219 | return child1Function(child2Function(child3Function(kernelArgument1))); |
| 220 | }, { output: [1] }); |
| 221 | sinon.spy(FunctionBuilder.prototype, 'lookupReturnType'); |
| 222 | try { |
| 223 | const result = kernel(texture); |
| 224 | assert.equal(result[0], 4.5); |
| 225 | assert.equal(FunctionBuilder.prototype.lookupReturnType.callCount, 5); |
| 226 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[0][0], 'child3Function'); |
| 227 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[1][0], 'child2Function'); |
| 228 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[2][0], 'child1Function'); |
| 229 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[3][0], 'child2Function'); |
| 230 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[4][0], 'child3Function'); |
| 231 | } finally { |
| 232 | FunctionBuilder.prototype.lookupReturnType.restore(); |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | (GPU.isSinglePrecisionSupported && GPU.isWebGLSupported ? test : skip)('three argument layer deep NumberTexture(1) WebGL', () => { |
| 237 | threeArgumentLayerDeepNumberTexture1('webgl'); |
no test coverage detected
searching dependent graphs…