Exophase
Nothing good will ever come of Exophase.
Ayla said:Btw, is it possible to use 3D hardware to render sprites and backgrounds, or is the GBA architecture too different ?
I know it has been done in Megadrive/Genesis emulation.
Not in any kind of straightforward way, and probably not quickly enough. Quite large pixel shaders and multiple passes would have to be done to perform this.
Because of the way raster effects and rotation backgrounds work, it is not sufficient to draw a quad for each tile or sprite. Instead your shader would have to load from a tilemap texture and generate texture coordinates from it. Pixel shaders are not really good at bitwise math so it takes a good number of operations. Tiles themselves, and sprites, must be cached into a GPU friendly format, or you must spend even more pixel shader cycles doing tile loads; doing paletted textures this way isn't too bad if they're 8bpp but at 4bpp, the most common GBA tile format, it's shader murder. Since these tiles have transparency you must use the expensive discard function regularly, which hurts SGX performance. Updating the tile cache would be slow, especially if the game updates tiles/sprites a lot, and many do.
You must then render one scanline strip at a time for each layer. Then you encounter the other tricky part: blending. GBA has the capability to blend the top two "contributing" pixels in a scene - the only way to determine which two pixels those are in a 3D renderer is to perform depth pruning. You have to render the screen twice, writing the layer depth as a stencil value in the first pass and using it as a stencil restriction in the second pass. Then finally a third pass combines the results of the first two passes, uses further stencil bits to determine if blending should be performed, then combines them.
Unfortunately the above is not even possible on SGX because there's no way to preload stencil with values from a previous pass, or use any kind of depth or stencil textures. So I think the only way to do it is to use pre-passes to generate depth as a render target then reference it as another texture. I have a good feeling SGX won't be good at multiple passes (since it breaks down the deferred architecture) and I doubt it had the speed to keep up with this long before it even got this complex.
Mosaic would also be a problem, but to be fair I don't even bother with it in gpSP. Throwing away the lower bits of a texture address might suffice.
I know the Genesis emulator for Dreamcast uses the GPU, but I doubt the compatibility is top notch. Fortunately for it, Genesis games don't use raster effects nearly as heavily as Nintendo ones have, nor do they use shadow/highlight that much.
I guess I'm curious as to why you suggested this in the first place? Pandora is more than fast enough to do this in software.
Last edited by a moderator: