MCPcopy Create free account
hub / github.com/gpujs/gpu.js / handleCastingBeforeReturn

Function handleCastingBeforeReturn

test/internal/casting.js:154–168  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

152
153
154function handleCastingBeforeReturn(mode) {
155 const gpu = new GPU({ mode });
156 function addOne(v) {
157 return v + v;
158 }
159 gpu.addFunction(addOne, {
160 argumentTypes: { v: 'Float' },
161 returnType: 'Integer',
162 });
163 const kernel = gpu.createKernel(function(v) {
164 return addOne(v);
165 }, { output: [1] });
166 assert.equal(kernel(1)[0], 2);
167 gpu.destroy();
168}
169
170(GPU.isWebGLSupported ? test : skip)('handle casting before return webgl', () => {
171 handleCastingBeforeReturn('webgl');

Callers 1

casting.jsFile · 0.85

Calls 5

addFunctionMethod · 0.95
createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
addOneFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…