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

Function castingOffsetByThreadXAndOutputX

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

Source from the content-addressed store, hash-verified

4describe('internal: casting');
5
6function castingOffsetByThreadXAndOutputX(mode) {
7 const gpu = new GPU({ mode });
8 const kernel = gpu.createKernel(function (value) {
9 // value will be a number
10 // this.thread.x is an integer
11 // this.output.x is treated as a literal, so can be either integer or float
12 // return value will be float
13 return this.thread.x + (this.output.x * value);
14 }, {
15 output: [1],
16 strictIntegers: true,
17 });
18 const result = kernel(1);
19 assert.equal(result[0], 1);
20 assert.deepEqual(kernel.argumentTypes, ['Integer']);
21 gpu.destroy();
22}
23
24(GPU.isWebGLSupported ? test : skip)('casting offset by this.thread.x and this.output.x webgl', () => {
25 castingOffsetByThreadXAndOutputX('webgl');

Callers 1

casting.jsFile · 0.85

Calls 3

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…