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

Function testOutputTextureIsClonedWhenRecompiling

test/internal/recycling.js:763–781  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

761});
762
763function testOutputTextureIsClonedWhenRecompiling(mode) {
764 const gpu = new GPU({ mode });
765 const kernel = gpu.createKernel(function(value) {
766 return value[this.thread.x] + 1;
767 }, { output: [1], immutable: true, pipeline: true });
768 const result1 = kernel([1]);
769 assert.equal(result1.toArray()[0], 2);
770 const result2 = kernel(result1);
771 result1.delete();
772 assert.equal(result2.toArray()[0], 3);
773 result2.delete();
774 const result3 = kernel([3]);
775 assert.equal(result3.toArray()[0], 4);
776 const result4 = kernel(result3);
777 result3.delete();
778 assert.equal(result4.toArray()[0], 5);
779 result4.delete();
780 gpu.destroy();
781}
782
783test('output texture is cloned when recompiling auto', () => {
784 testOutputTextureIsClonedWhenRecompiling();

Callers 1

recycling.jsFile · 0.85

Calls 5

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
toArrayMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…