MCPcopy Index your code
hub / github.com/gpujs/gpu.js / twoLayerDeepFloat

Function twoLayerDeepFloat

test/internal/deep-types.js:38–63  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

36});
37
38function twoLayerDeepFloat(mode) {
39 const gpu = new GPU({ mode });
40 function child1Function(child1FunctionArgument1) {
41 return child2Function(child1FunctionArgument1);
42 }
43 function child2Function(child2FunctionArgument1) {
44 return child2FunctionArgument1 + 1;
45 }
46 gpu
47 .addFunction(child1Function)
48 .addFunction(child2Function);
49 const kernel = gpu.createKernel(function(kernelArgument1) {
50 return child1Function(kernelArgument1);
51 }, { output: [1] });
52 sinon.spy(FunctionBuilder.prototype, 'lookupReturnType');
53 try {
54 const result = kernel(1.5);
55 assert.equal(result[0], 2.5);
56 assert.equal(FunctionBuilder.prototype.lookupReturnType.callCount, 3);
57 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[0][0], 'child1Function');
58 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[1][0], 'child2Function');
59 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[2][0], 'child2Function');
60 } finally {
61 FunctionBuilder.prototype.lookupReturnType.restore();
62 }
63}
64
65(GPU.isWebGLSupported ? test : skip)('two layer deep float WebGL', () => {
66 twoLayerDeepFloat('webgl');

Callers 1

deep-types.jsFile · 0.85

Calls 4

addFunctionMethod · 0.95
createKernelMethod · 0.95
child1FunctionFunction · 0.85
kernelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…