* * @param {Kernel} Kernel
(Kernel)
| 83 | * @param {Kernel} Kernel |
| 84 | */ |
| 85 | function 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 | |
| 110 | test('WebGLKernel.setUniform1i only calls context when values change', () => { |
| 111 | setUniform1iTest(WebGLKernel); |
no test coverage detected
searching dependent graphs…