A three-dimensional perspective

After a week of hard work, CorgiDS now renders wireframe polygons, both triangles and quads:

wireframe

A whole lot is going on under the hood here. Mainly, I replaced my hackish “run commands instantly” design with a proper GXFIFO implementation. This allows for far more sophisticated programs that can draw a whole lot more than a single primitive. If you’re curious, the GXFIFO is a 256-long command queue whose sole purpose is to provide a buffer for when the program overwhelms the tiny pipeline the GPU has. The GXFIFO has a lot of interesting properties: for instance, being able to request an IRQ if half-empty or empty and allowing for automatic DMA transfers when the queue becomes half-empty. While programs can directly feed commands and parameters into the GXFIFO using I/O transfers, the aforementioned DMA transfers are the most commonly used method for filling it. Because DMA transfers are, on average, faster than the time the GPU takes to execute its commands, care must be taken to make sure that the GXFIFO doesn’t overflow. Otherwise,¬†the CPUs and DMA are frozen for up to several seconds until the GPU has enough space for new commands! Of course… certain games don’t take that precaution into mind and blindly fill up the FIFO as they please. CorgiDS currently just executes commands instantly if the GXFIFO overflows, as emulating that “feature” is too costly for the time being.

Obviously, the next step for CorgiDS is to be able to fill in polygons. After that, however, an equally important step is being able to draw polygon strips. Currently CorgiDS can only handle separate polygons, which is great for test homebrew, but games will use strips in order to save time and space on vertex commands. Color interpolation also needs to be added, as well as fixing a lot of the quirks in the renderer. This needs to be handled one step at a time, so it will still be a while before I’m able to run Pokemon and the like. All the fancy stuff in 3D rendering like textures and lighting will come later, I promise. (The technical article I’m also writing has been delayed due to a combination of 3D work and real life work, but that’s also coming eventually.)

To wrap this up, let’s see how CorgiDS does with rendering the Utah Teapot:

teapot_fail

Better luck next time…

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s