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

Function setUniform4fvTest

test/internal/kernel.js:276–299  ·  view source on GitHub ↗

* * @param {Kernel} Kernel

(Kernel)

Source from the content-addressed store, hash-verified

274 * @param {Kernel} Kernel
275 */
276function setUniform4fvTest(Kernel) {
277 const canvas = {};
278 const context = {
279 uniform4fv: () => {
280 if (throws) new Error('This should not get called');
281 },
282 getUniformLocation: (name) => {
283 return name;
284 }
285 };
286 const kernel = new Kernel('function() {}', { canvas, context, output: [1] });
287 let throws = false;
288 kernel.setUniform4fv('test', [1, 2, 3, 4]);
289 assert.deepEqual(kernel.uniform4fvCache['test'], [1, 2, 3, 4]);
290
291 throws = true;
292 kernel.setUniform4fv('test', [1, 2, 3, 4]);
293 assert.deepEqual(kernel.uniform4fvCache['test'], [1, 2, 3, 4]);
294
295 throws = false;
296 kernel.setUniform4fv('test', [2, 3, 4, 5]);
297 assert.deepEqual(kernel.uniform4fvCache['test'], [2, 3, 4, 5]);
298 kernel.destroy();
299}
300test('WebGLKernel.setUniform4fv only calls context when values change', () => {
301 setUniform4fvTest(WebGLKernel);
302});

Callers 1

kernel.jsFile · 0.85

Calls 2

destroyMethod · 0.95
setUniform4fvMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…