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

Function setUniform4ivTest

test/internal/kernel.js:238–261  ·  view source on GitHub ↗

* * @param {Kernel} Kernel

(Kernel)

Source from the content-addressed store, hash-verified

236 * @param {Kernel} Kernel
237 */
238function setUniform4ivTest(Kernel) {
239 const canvas = {};
240 const context = {
241 uniform4iv: () => {
242 if (throws) new Error('This should not get called');
243 },
244 getUniformLocation: (name) => {
245 return name;
246 }
247 };
248 const kernel = new Kernel('function() {}', { canvas, context, output: [1] });
249 let throws = false;
250 kernel.setUniform4iv('test', [1, 2, 3, 4]);
251 assert.deepEqual(kernel.uniform4ivCache['test'], [1, 2, 3, 4]);
252
253 throws = true;
254 kernel.setUniform4iv('test', [1, 2, 3, 4]);
255 assert.deepEqual(kernel.uniform4ivCache['test'], [1, 2, 3, 4]);
256
257 throws = false;
258 kernel.setUniform4iv('test', [2, 3, 4, 5]);
259 assert.deepEqual(kernel.uniform4ivCache['test'], [2, 3, 4, 5]);
260 kernel.destroy();
261}
262test('WebGLKernel.setUniform4iv only calls context when values change', () => {
263 setUniform4ivTest(WebGLKernel);
264});

Callers 1

kernel.jsFile · 0.85

Calls 2

destroyMethod · 0.95
setUniform4ivMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…