Make "bytheway.elf" work.
Posted on 2005-09-23 00:00:00
After studying the GS register trace, I found out how this demo what managing to do its double buffering.

The previous demos were working this way: Set the address of the back buffer in the FRAME_1 register, render some stuff, set the address contained in DISPFB2 (read circuit) to point at the same address as FRAME_1, flip the back buffer pointer, set FRAME_1 with the new back buffer pointer, render, etc.

The new demo works this way: Set the address of buffer 1 in FRAME_1, set the address of buffer 2 in FRAME_2, render some stuff with the back buffer context, set the address in DISPFB2 to point to the back buffer, flip back buffer pointer, render some stuff with the current back buffer context, set the address in DISPFB2 to point to the back buffer address.

This doesn't cause too many problems to implement with OpenGL since it's just another way to achieve double buffering and not some other nasty effect. It was just a matter of tweaking the renderer to be able to set the OpenGL state according to the rendering context of the primitives to be rendered. This fixed the blank frame we were getting one frame out of two. Some screen shots:


Screenshot #000026

Screenshot #000027


There's still a couple of problems with the rendering though. We can see some ugly purple outlines around the textures, probably due to broken alpha blending or something like that. And there's supposed to be two white star things rotating in the 2nd screen.

The demo is running awefully slow compared to how it does in nSX2. I don't know if that's due to some speed hack present in nSX2, but I'll have to investigate this too.