* * @param {Kernel} Kernel
(Kernel)
| 122 | * @param {Kernel} Kernel |
| 123 | */ |
| 124 | function 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 | } |
| 148 | test('WebGLKernel.setUniform2f only calls context when values change', () => { |
| 149 | setUniform2fTest(WebGLKernel); |
| 150 | }); |
no test coverage detected
searching dependent graphs…