()
| 45 | } |
| 46 | |
| 47 | getUserCode(): string { |
| 48 | const dtype = getCoordsDataType(this.rank); |
| 49 | const sourceCoords = getCoords(this.rank); |
| 50 | let coordSum; |
| 51 | if (this.start.length === 1) { |
| 52 | coordSum = this.outputShape.map((_, i) => { |
| 53 | return `sourceLoc = uniforms.start + coords;`; |
| 54 | }); |
| 55 | } else { |
| 56 | coordSum = this.outputShape.map((_, i) => { |
| 57 | return `sourceLoc.${coords[i]} = uniforms.start.${ |
| 58 | getCoordsXYZ(i)} + coords.${coords[i]};`; |
| 59 | }); |
| 60 | } |
| 61 | |
| 62 | const userCode = ` |
| 63 | ${main('index')} { |
| 64 | if (index < uniforms.size) { |
| 65 | var sourceLoc : ${dtype}; |
| 66 | let coords = getCoordsFromIndex(index); |
| 67 | ${coordSum.join('\n')} |
| 68 | setOutputAtIndex(index, getSource(${sourceCoords})); |
| 69 | } |
| 70 | } |
| 71 | `; |
| 72 | return userCode; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | const coords = ['x', 'y', 'z', 'w', 'u', 'v']; |
nothing calls this directly
no test coverage detected