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

Function testSameSourceDestinationFromMappedResultThrows

test/internal/recycling.js:694–713  ·  view source on GitHub ↗
(error, precision, mode)

Source from the content-addressed store, hash-verified

692});
693
694function testSameSourceDestinationFromMappedResultThrows(error, precision, mode) {
695 const gpu = new GPU({ mode });
696 const kernel = gpu.createKernelMap({
697 mappedResult: function map(v) {
698 return v;
699 }
700 }, function(value) {
701 return map(value[this.thread.x] + 1);
702 }, {
703 output: [1],
704 pipeline: true,
705 immutable: false,
706 precision,
707 });
708 let { result, mappedResult } = kernel([0]);
709 assert.equal((mappedResult.toArray ? mappedResult.toArray() : mappedResult)[0], 1);
710 assert.throws(() => kernel(mappedResult), error);
711 assert.throws(() => kernel(result), error);
712 gpu.destroy();
713}
714
715test('single precision same source and destination from mapped result mutable throws auto', () => {
716 testSameSourceDestinationFromMappedResultThrows(gpuError, 'single');

Callers 1

recycling.jsFile · 0.85

Calls 4

createKernelMapMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
toArrayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…