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

Function threeArgumentLayerDeepFloat

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

Source from the content-addressed store, hash-verified

155});
156
157function threeArgumentLayerDeepFloat(mode) {
158 const gpu = new GPU({ mode });
159 function child1Function(child1FunctionArgument1) {
160 return child1FunctionArgument1 + 1;
161 }
162 function child2Function(child2FunctionArgument1) {
163 return child2FunctionArgument1 + 1;
164 }
165 function child3Function(child3FunctionArgument1) {
166 return child3FunctionArgument1 + 1;
167 }
168 gpu
169 .addFunction(child1Function)
170 .addFunction(child2Function)
171 .addFunction(child3Function);
172 const kernel = gpu.createKernel(function(kernelArgument1) {
173 return child1Function(child2Function(child3Function(kernelArgument1)));
174 }, { output: [1] });
175 sinon.spy(FunctionBuilder.prototype, 'lookupReturnType');
176 try {
177 const result = kernel(1.5);
178 assert.equal(result[0], 4.5);
179 assert.equal(FunctionBuilder.prototype.lookupReturnType.callCount, 5);
180 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[0][0], 'child3Function');
181 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[1][0], 'child2Function');
182 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[2][0], 'child1Function');
183 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[3][0], 'child2Function');
184 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[4][0], 'child3Function');
185 } finally {
186 FunctionBuilder.prototype.lookupReturnType.restore();
187 }
188}
189
190(GPU.isWebGLSupported ? test : skip)('three argument layer deep float WebGL', () => {
191 threeArgumentLayerDeepFloat('webgl');

Callers 1

deep-types.jsFile · 0.85

Calls 6

addFunctionMethod · 0.95
createKernelMethod · 0.95
child1FunctionFunction · 0.85
child2FunctionFunction · 0.85
child3FunctionFunction · 0.85
kernelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…