viti95 / FastDoom

Doom port for DOS, optimized to be as fast as possible!
512 stars 33 forks source link

R_DrawSpanVBE2_386SX (And Probably others) crashes the game on certain newer platforms (686?) #160

Open dougvj opened 9 months ago

dougvj commented 9 months ago

I went down a rabbit hole thinking that there was a problem with the sound driver because when I changed the sound the game crashed, but FDSETUP wipes the rendering function setting whose default is 386SX

I am confident that the issue occurs with the Pentium II and the AMD Athlon. It does not appear to be a problem on early pentium, but I have not tested other CPUs or platforms. I will do more testing over the coming days.

I am also fairly confident that the issue is caused by the span function because sometimes a frame or two gets rendered before crashing and only the columns, which look correct, are on the frame.

One possible solution for now is to disable the 386 SX functions based on the processor type detection

0.9.8 is affected through Master

viti95 commented 8 months ago

The main difference in 386SX codepath is that CR2 register is used as scratchpad memory, read/write to this register is a bit faster compared to main memory (same goes for CR3). Maybe this is causing issues on Windows. I'll take a look.