* * @param {Kernel} Kernel
(Kernel)
| 44 | * @param {Kernel} Kernel |
| 45 | */ |
| 46 | function setUniform1fTest(Kernel) { |
| 47 | const canvas = {}; |
| 48 | const context = { |
| 49 | uniform1f: () => { |
| 50 | if (throws) new Error('This should not get called'); |
| 51 | }, |
| 52 | getUniformLocation: (name) => { |
| 53 | return name; |
| 54 | } |
| 55 | }; |
| 56 | const kernel = new Kernel('function() {}', { canvas, context, output: [1] }); |
| 57 | let throws = false; |
| 58 | kernel.setUniform1f('test', 1); |
| 59 | assert.equal(kernel.uniform1fCache['test'], 1); |
| 60 | |
| 61 | throws = true; |
| 62 | kernel.setUniform1f('test', 1); |
| 63 | assert.equal(kernel.uniform1fCache['test'], 1); |
| 64 | |
| 65 | throws = false; |
| 66 | kernel.setUniform1f('test', 2); |
| 67 | assert.equal(kernel.uniform1fCache['test'], 2); |
| 68 | kernel.destroy(); |
| 69 | } |
| 70 | |
| 71 | test('WebGLKernel.setUniform1f only calls context when values change', () => { |
| 72 | setUniform1fTest(WebGLKernel); |
no test coverage detected
searching dependent graphs…