MCPcopy Create free account
hub / github.com/gpujs/gpu.js / setUniform1fTest

Function setUniform1fTest

test/internal/kernel.js:46–69  ·  view source on GitHub ↗

* * @param {Kernel} Kernel

(Kernel)

Source from the content-addressed store, hash-verified

44 * @param {Kernel} Kernel
45 */
46function setUniform1fTest(Kernel) {
47 const canvas = {};
48 const context = {
49 uniform1f: () => {
50 if (throws) new Error('This should not get called');
51 },
52 getUniformLocation: (name) => {
53 return name;
54 }
55 };
56 const kernel = new Kernel('function() {}', { canvas, context, output: [1] });
57 let throws = false;
58 kernel.setUniform1f('test', 1);
59 assert.equal(kernel.uniform1fCache['test'], 1);
60
61 throws = true;
62 kernel.setUniform1f('test', 1);
63 assert.equal(kernel.uniform1fCache['test'], 1);
64
65 throws = false;
66 kernel.setUniform1f('test', 2);
67 assert.equal(kernel.uniform1fCache['test'], 2);
68 kernel.destroy();
69}
70
71test('WebGLKernel.setUniform1f only calls context when values change', () => {
72 setUniform1fTest(WebGLKernel);

Callers 1

kernel.jsFile · 0.85

Calls 2

destroyMethod · 0.95
setUniform1fMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…