afritz1 / OpenTESArena

Open-source re-implementation of The Elder Scrolls: Arena.
MIT License
988 stars 68 forks source link

SoftwareRenderer: Fix data race on flats.threadsDone #199

Closed Alucowie closed 3 years ago

Alucowie commented 3 years ago

When the last render thread notify that flats are drawn, the main thread have time to loop on and init flats again before others render threads have time to do their own checks and continue, so they stay waiting because flats.threadsDone was init to 0 again.

Remove the wait is safe because the first render threads to finish will wait on the threadData.go already to false.

Alucowie commented 3 years ago

I think this patch fixes issue #145 .

afritz1 commented 3 years ago

I tested this on Windows and Raspberry Pi OS and I don't see any issues. I thought it would feel more liberating having a two-year-old bug fixed but it essentially just brings the Linux performance up to where Windows has been, which is still pretty poor in the big picture.

Anyway, thanks a lot for fixing that.

Digital-Monk commented 3 years ago

Just wanted to put in another THANK YOU for this. I enjoy running around Tamriel as a break from work. My work machine has 12 cores, and being able to use all of them (as opposed to 1 before) makes a huge difference in performance for me. (As for "still pretty poor", well, I'm happy with anything around 20fps for these kinds of games, so maybe I'm easy to please.)