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

Function twoArgumentLayerDeepFloat

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

Source from the content-addressed store, hash-verified

73});
74
75function 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');

Callers 1

deep-types.jsFile · 0.85

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…