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

Function testMappedOutputTextureIsClonedWhenRecompiling

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

Source from the content-addressed store, hash-verified

801});
802
803function testMappedOutputTextureIsClonedWhenRecompiling(mode) {
804 const gpu = new GPU({ mode });
805 function setValue(value) {
806 return value * 10;
807 }
808 const kernel = gpu.createKernelMap({
809 value: setValue,
810 },function(value1, value2) {
811 setValue(value2[this.thread.x]);
812 return value1[this.thread.x] + 1;
813 }, { output: [1], immutable: true, pipeline: true });
814 const map1 = kernel([1], [1]);
815 assert.equal(map1.result.toArray()[0], 2);
816 assert.equal(map1.value.toArray()[0], 10);
817 const map2 = kernel(map1.result, map1.value);
818 map1.result.delete();
819 map1.value.delete();
820 assert.equal(map2.result.toArray()[0], 3);
821 assert.equal(map2.value.toArray()[0], 100);
822 map2.value.delete();
823 map2.result.delete();
824 const map3 = kernel([3], [3]);
825 assert.equal(map3.result.toArray()[0], 4);
826 assert.equal(map3.value.toArray()[0], 30);
827 const map4 = kernel(map3.result, map3.value);
828 map3.result.delete();
829 map3.value.delete();
830 assert.equal(map4.result.toArray()[0], 5);
831 assert.equal(map4.value.toArray()[0], 300);
832 map4.result.delete();
833 map4.value.delete();
834 gpu.destroy();
835}
836
837test('mapped output texture is cloned when recompiling auto', () => {
838 testMappedOutputTextureIsClonedWhenRecompiling();

Callers 1

recycling.jsFile · 0.85

Calls 6

createKernelMapMethod · 0.95
destroyMethod · 0.95
setValueFunction · 0.85
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…