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

Function setUniform1iTest

test/internal/kernel.js:85–108  ·  view source on GitHub ↗

* * @param {Kernel} Kernel

(Kernel)

Source from the content-addressed store, hash-verified

83 * @param {Kernel} Kernel
84 */
85function setUniform1iTest(Kernel) {
86 const canvas = {};
87 const context = {
88 uniform1i: () => {
89 if (throws) new Error('This should not get called');
90 },
91 getUniformLocation: (name) => {
92 return name;
93 }
94 };
95 const kernel = new Kernel('function() {}', { canvas, context, output: [1] });
96 let throws = false;
97 kernel.setUniform1i('test', 1);
98 assert.equal(kernel.uniform1iCache['test'], 1);
99
100 throws = true;
101 kernel.setUniform1i('test', 1);
102 assert.equal(kernel.uniform1iCache['test'], 1);
103
104 throws = false;
105 kernel.setUniform1i('test', 2);
106 assert.equal(kernel.uniform1iCache['test'], 2);
107 kernel.destroy();
108}
109
110test('WebGLKernel.setUniform1i only calls context when values change', () => {
111 setUniform1iTest(WebGLKernel);

Callers 1

kernel.jsFile · 0.85

Calls 2

destroyMethod · 0.95
setUniform1iMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…