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

Function rawSinglePrecisionRenderOutput

test/features/raw-output.js:49–71  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

47
48
49function rawSinglePrecisionRenderOutput(mode) {
50 const gpu = new GPU({ mode });
51 const kernel = gpu.createKernel(function(v) {
52 return v[this.thread.x];
53 }, {
54 output: [1],
55 precision: 'single',
56 });
57 kernel.build([1]);
58 kernel.run([1]);
59 const result = kernel.renderRawOutput();
60 assert.equal(result.constructor, Float32Array);
61 // TODO: there is an odd bug in headless gl that causes this to output:
62 // "0": 1,
63 // "1": 2097761,
64 // "2": 2.120494879387071e-36,
65 // "3": -814303.375
66 // For the time being, just check the first value, until this is fixed
67 // assert.deepEqual(result, new Float32Array([1, 0, 0, 0]));
68 assert.deepEqual(result.length, 4);
69 assert.deepEqual(result[0], 1);
70 gpu.destroy();
71}
72
73(GPU.isSinglePrecisionSupported ? test : skip)('raw single precision render output auto', () => {
74 rawSinglePrecisionRenderOutput();

Callers 1

raw-output.jsFile · 0.85

Calls 5

createKernelMethod · 0.95
destroyMethod · 0.95
buildMethod · 0.45
runMethod · 0.45
renderRawOutputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…