GBADotnet
GBADotnet copied to clipboard
Move the scanline renderer into a thread to improve performance
A large chunk of time is spent at the end of each scanline handling the scanline renderer. It seems plausible that it would be more performant to copy the relevant arrays/registers and run a lock free thread whilst the main one runs until the start of the next scanline. I've already got scheduler events for start/end hblank so I'm imagining an architecture where HBlank start copies the data into the thread (w/ mutex) and triggers the thread to start writing a scanline buffer and then hblank end blocks until that thread is finished with its work.
The risk is that the memcpy is slower than just doing this serially but we won't know without trying.