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

Function setUniform2fTest

test/internal/kernel.js:124–147  ·  view source on GitHub ↗

* * @param {Kernel} Kernel

(Kernel)

Source from the content-addressed store, hash-verified

122 * @param {Kernel} Kernel
123 */
124function setUniform2fTest(Kernel) {
125 const canvas = {};
126 const context = {
127 uniform2f: () => {
128 if (throws) new Error('This should not get called');
129 },
130 getUniformLocation: (name) => {
131 return name;
132 }
133 };
134 const kernel = new Kernel('function() {}', { canvas, context, output: [1] });
135 let throws = false;
136 kernel.setUniform2f('test', 1, 2);
137 assert.deepEqual(kernel.uniform2fCache['test'], [1, 2]);
138
139 throws = true;
140 kernel.setUniform2f('test', 1, 2);
141 assert.deepEqual(kernel.uniform2fCache['test'], [1, 2]);
142
143 throws = false;
144 kernel.setUniform2f('test', 3, 4);
145 assert.deepEqual(kernel.uniform2fCache['test'], [3, 4]);
146 kernel.destroy();
147}
148test('WebGLKernel.setUniform2f only calls context when values change', () => {
149 setUniform2fTest(WebGLKernel);
150});

Callers 1

kernel.jsFile · 0.85

Calls 2

destroyMethod · 0.95
setUniform2fMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…