2013-12-12

2013-12-12 Benchmarking Doom

I have put some benchmarking code into the Doom engine to count the number of ticks (each tick being 1/100th of a second currently) that it takes to render 20 frames and then writes it to the stdout.  It provides me with a way of getting a good FPS reading without needing to worry about floating point arithmetic.  Even though the screen is running in mode 0x12, I have wired up the kernel stdout to Bochs' "Port 0xE9 Hack" so that any text written by the kernel also appears in Bochs' separate console window.  This provides console output that works alongside the graphical output of Doom so I can get the benchmarks out without affecting the render code.

At Rich's suggestion, I also tested running Doom without the Parrot Dithering in the VGA driver, the results are:

Average with dithering is 158 ticks per frame = 1.58 seconds per frame = 0.6 FPS
Average without dithering is 115 ticks per frame = 0.87 FPS.

In order to try to work out where I can save time, I have tested a function which just pushes data into the VGA memory as fast as it can so I can see how fast this part can be (bearing in mind that it's a planar Mode 0x12 screen).  Using 32-bit writes (which may not work on all hardware) seems to allow me to paint all the planes in under one tick, so that's reasonable.

Moving on from this, I've created a planar back buffer in memory to store the data ready to be pushed to the VGA memory.  The plot and drawing routines now write to this buffer (which is faster because it can access all the planes without having to change any registers), and I've added a function to update the front buffer (the VGA hardware) from the back buffer.

All of these changes, and Doom now runs at a blistering ... 0.95 FPS ... Oh :(

It may be that the VGA card is not the slowdown here, I'll have to do some proper benchmarking ... maybe after Christmas.

No comments:

Post a Comment