I've finally made the switch to GPU coding and ported majority of features of my C code for the Road Rash prototype (that was in past running only under emulator) into GPU.
This build is obviously very early, but shows all the most performance-hungry engine features, like:
- 3D transformation (World+View+Projection)
- World Frustum culling
- Polygon clipping
- Texturing of buildings and road (texturing on GPU gives much higher quality/precision than via Blitter)
- Blitter : 0%
- DSP : 0%
- OP : ~10%
- GPU: ~65%
- 68000: 5%
- currently only 5 buildings, on a loop, as I don't want to waste time creating a mesh for big city manually, before I have working hills/curves
- Locked to 30 fps (e.g. stable, exact 30 fps, never less than 30)
- Without the lock, the framerate actually oscillates around ~42 fps. It's entirely within the reach to get it to run at 50 fps on PAL jaguar. Here are the reasons:
- 1. I am currently using very generic texturing functions, and all texture data gets fetched from slow main RAM.
- 2. I did some benchmarks with different versions of those routines (I wrote about 5 different versions), that had partial local caching from within GPU, and their performance jumped more than 25%, so 50 fps is entirely reachable (if I can be bothered to optimize it)
- 3. There is literally 0% use of DSP, and quite a few engine features could run in parallel from DSP. The Audio won't use more than 10-15% of DSP anyway, so it's free to help GPU.
- 4. Road texture is very high-res, gets sampled too much, which means it's hitting the bus more often than needed (as you can't even see all the texels even at closest camera position)
Binary has 175 KB:
- 78 KB : Textures
- 64 KB : Framebuffer
- 20 KB: 68000 Code (from initialization, through loading of textures, to handing over control to GPU)
- 5 KB : Data
- 4 KB : GPU code
- 0.5 KB : Level
Here's the YT link, captured on my $10 AV device (the capture quality obviously corresponds to price of the capture device).
- 2D Props (hydrant,trees)
- basic terrain layer
Since I just made the jump to GPU, I'm very curious about its various performance characteristics, so I'm going to get distracted by various experiments/effects (e.g. won't be working just on this).
Ultimately, I was always a huge NeedForSpeed / Screamer fan, so eventually I'd like to create one fully playable track with a proper 3D terrain, and I believe 3D textured cars are also within playable framerate (e.g. 20+).