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

Function threeLayerDeepFloat

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

Source from the content-addressed store, hash-verified

112
113
114function threeLayerDeepFloat(mode) {
115 const gpu = new GPU({ mode });
116 function child1Function(child1FunctionArgument1) {
117 return child2Function(child1FunctionArgument1);
118 }
119 function child2Function(child2FunctionArgument1) {
120 return child3Function(child2FunctionArgument1 + 1);
121 }
122 function child3Function(child3FunctionArgument1) {
123 return child3FunctionArgument1 + 1;
124 }
125 gpu
126 .addFunction(child1Function)
127 .addFunction(child2Function)
128 .addFunction(child3Function);
129 const kernel = gpu.createKernel(function(kernelArgument1) {
130 return child1Function(kernelArgument1);
131 }, { output: [1] });
132 sinon.spy(FunctionBuilder.prototype, 'lookupReturnType');
133 try {
134 const result = kernel(1.5);
135 assert.equal(result[0], 3.5);
136 assert.equal(FunctionBuilder.prototype.lookupReturnType.callCount, 5);
137 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[0][0], 'child1Function');
138 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[1][0], 'child2Function');
139 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[2][0], 'child3Function');
140 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[3][0], 'child2Function');
141 assert.equal(FunctionBuilder.prototype.lookupReturnType.args[4][0], 'child3Function');
142 } finally {
143 FunctionBuilder.prototype.lookupReturnType.restore();
144 }
145}
146
147(GPU.isWebGLSupported ? test : skip)('three layer deep float WebGL', () => {
148 threeLayerDeepFloat('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…