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

Function handleCastingIntsWithNativeFunctions

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

Source from the content-addressed store, hash-verified

32});
33
34function handleCastingIntsWithNativeFunctions(mode) {
35 const gpu = new GPU({ mode });
36 gpu.addNativeFunction('add', `
37 int add(int value1, int value2) {
38 return value1 + value2;
39 }
40 `);
41 const kernel = gpu.createKernel(function(value1, value2) {
42 return add(value1, value2);
43 }, { output: [1] });
44 const result = kernel(0.5, 2.5);
45 assert.deepEqual(Array.from(result), [2]);
46 assert.deepEqual(kernel.argumentTypes, ['Float', 'Float']);
47 gpu.destroy();
48}
49
50(GPU.isWebGLSupported ? test : skip)('handle casting ints with native functions webgl', () => {
51 handleCastingIntsWithNativeFunctions('webgl');

Callers 1

casting.jsFile · 0.85

Calls 5

addNativeFunctionMethod · 0.95
createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
addFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…