(shape: number[])
| 23 | outputShape: number[]; |
| 24 | |
| 25 | constructor(shape: number[]) { |
| 26 | this.outputShape = shape; |
| 27 | this.userCode = ` |
| 28 | void main() { |
| 29 | float re = abs(getRealAtOutCoords()); |
| 30 | float im = abs(getImagAtOutCoords()); |
| 31 | float mx = max(re, im); |
| 32 | |
| 33 | // sadly the length function in glsl is not underflow-safe |
| 34 | // (at least not on Intel GPUs). So the safe solution is |
| 35 | // to ensure underflow-safety in all cases. |
| 36 | setOutput( |
| 37 | mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx)) |
| 38 | ); |
| 39 | } |
| 40 | `; |
| 41 | } |
| 42 | } |
nothing calls this directly
no outgoing calls
no test coverage detected