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

Function outputGraphicalMatrix

test/features/output.js:198–218  ·  view source on GitHub ↗
(mode, canvas, context)

Source from the content-addressed store, hash-verified

196});
197
198function outputGraphicalMatrix(mode, canvas, context) {
199 const gpu = new GPU({ mode });
200 const input = [
201 [0.25,.50],
202 [.75,1],
203 ];
204 const kernel = gpu.createKernel(function(input) {
205 const color = input[this.thread.y][this.thread.x];
206 this.color(color, color, color, color);
207 }, {
208 context,
209 canvas,
210 output: [2, 2],
211 graphical: true
212 });
213 const result = kernel(input);
214 assert.equal(result, undefined);
215 const pixels = Array.from(kernel.getPixels());
216 gpu.destroy();
217 return pixels;
218}
219
220(GPU.isWebGLSupported ? test : skip)('graphical output matrix webgl', () => {
221 const canvas = document.createElement('canvas');

Callers 1

output.jsFile · 0.85

Calls 5

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
colorMethod · 0.65
getPixelsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…