Closed Kolsky closed 3 years ago
Thank you, this looks great! I'll take a closer look shortly, before merging. For now, I just have a couple of questions of clarification:
What's with the SharedPtr
? It doesn't seem to do anything.
Is all the pointer manipulation really necessary for the rotation stuff? I assume it's because you want to avoid bounds checking? If that's the only reason, seems to me we could just use slice::get_unchecked_mut
instead.
Thank you, this looks great! I'll take a closer look shortly, before merging. For now, I just have a couple of questions of clarification:
What's with the
SharedPtr
? It doesn't seem to do anything.
It's intended for rayon integration. Idk if it would benefit perf, so didn't included in deps. However if I import prelude, replacing chunks with par_chunks is enough.
Is all the pointer manipulation really necessary for the rotation stuff? I assume it's because you want to avoid bounds checking? If that's the only reason, seems to me we could just use
slice::get_unchecked_mut
instead.
I imitated memcpy-like copying, as std safe functions are slow, so no bounds-checking are required. Are you talking about mem::swap and forget? They're probably unnecessary, I'll try to rewrite it.
Also, index manipulation seems more costly to me, and we need to write unsafe code either way.
Looks good to me!
Added function for retrieving RGBA components. Heavily optimised rotations, but still on a CPU (enough for 60 fps). Possible to integrate rayon for further optimisations.