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

Function handleCastingMixedWithNativeFunctions

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

Source from the content-addressed store, hash-verified

90
91
92function handleCastingMixedWithNativeFunctions(mode) {
93 const gpu = new GPU({ mode });
94 gpu.addNativeFunction('add', `
95 float add(float value1, int value2) {
96 return value1 + float(value2);
97 }
98 `);
99 const kernel = gpu.createKernel(function(value1, value2) {
100 return add(value1, value2);
101 }, {
102 output: [1],
103 strictIntegers: true,
104 });
105 const result = kernel(1, 2.5);
106 assert.deepEqual(Array.from(result), [3]);
107 assert.deepEqual(kernel.argumentTypes, ['Integer', 'Float']);
108 gpu.destroy();
109}
110
111(GPU.isWebGLSupported ? test : skip)('handle casting mixed with native functions webgl', () => {
112 handleCastingMixedWithNativeFunctions('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…