bryal / dxgcap-rs

Screen capturing with DXGI for Windows in Rust
GNU Affero General Public License v3.0
49 stars 15 forks source link

Addressed issues #3, #4 #7

Closed Kolsky closed 3 years ago

Kolsky commented 3 years ago

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.

Kolsky commented 3 years ago

3, #4

bryal commented 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.

Kolsky commented 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.

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.

bryal commented 3 years ago

Looks good to me!