Weekend toy
Don’t use this.
Render triangles with Futhark (install this
first). Run something like this (requires SDL2 and SDL2-ttf headers):
futhark pkg sync && make && ./lys
This works by being parallel in the number of triangles. Contrast to
raycasting which is parallel in the number of pixels. We use thereduce_by_index
Futhark construct.
A few workarounds are needed to make this work in a regular-arrays
setting. For instance, we need to have each triangle take up the same
amount of space in the output of its rendering computation, i.e., its
pixels and their indexes into the global frame. We solve this by
letting the user of our library pass a size along with the triangles; we
then check that all triangle renders can fit into this size. If this is
not the case, we forcefully split the offending triangles into smaller
sizes, and repeat the check. Do this until everything checks out. This
is not terribly efficient; maybe there’s a better way?
TODO (if someone finds this interesting):