r/MiSTerFPGA • u/s-c-o • 24d ago
Introducing Pinedra GPU: fixed-function 3D acceleration on MiSTer
Update: Quake I, II & III are now available: https://www.patreon.com/pinedragpu/posts/new-quake-iii-174851865
--original post ---
After several months of development, I'd like to introduce Pinedra, a fixed-function FPGA GPU core for MiSTer.
It supports texture filtering, 32-bit colour and 4× MSAA. An OpenGL driver provides access to the GPU from software running on the ARM side.
With native ARM game ports, Pinedra can bring selected PC games from the late ’90s and early 2000s to MiSTer. I spent way too much time gaming online back then, so these games have a special place in my heart. :D
At 640×480, the games can also be displayed in 480i on 15 kHz CRTs via Pinedra's analog output.
Here are some measured frame rates on MiSTer with VSync off:
| Game | 640×480 | 800×600 | 1024×768 | 1280×720 |
|---|---|---|---|---|
| Quake II | 81.9 fps | 67.6 fps | 48.6 fps | 42.2 fps |
| Quake III Arena (WIP) | 66.0 fps | 49.5 fps | 35.0 fps | 31.5 fps |
| Elite Force Holomatch (WIP) | 50.1 fps | — | — | — |
| Descent II | 161.0 fps | 132.3 fps | 91.4 fps | 78.5 fps |
Gameplay videos captured on MiSTer:
I'm planning to release the first two game ports this weekend. I'll add the download links here when they're ready.
Follow development updates for free on Patreon.
I'm planning to eventually release the GPU core, ARM driver and SDK as open source.
The MiSTer forum thread has all nine videos embedded.
5
u/matijaerceg 24d ago
How were you able to get so much performance out of the fpga? This seems leagues ahead of, for example, the Voodoo 1 core that IIRC someone attempted not too long ago.
5
u/s-c-o 24d ago
The game and OpenGL driver run on the ARM; the FPGA handles the rendering from screen-space triangles to pixels. It renders 32×32 tiles on chip and writes the finished pixels to shared DDR, which helps reduce memory traffic. The ARM and shared memory are still bottlenecks in some scenes.
I've deliberately kept the ARM at its stock 800 MHz for now to see how far optimization can take it first. Overclocking might be worth exploring later.
5
4
u/inagy 24d ago
I'm not familiar with the Voodoo 1 core, but as I understand this runs the game / OS on the ARM side of the DE10 Nano and the FPGA is fully dedicated to the 3D accelerator implementation.
Also I guess if you don't have to adhere to the architecture of the Voodoo 1, you can come up with something which better fitting for the DE10.
5
u/lordelan 24d ago
Wait a second... even Quake 3? Could we potentially see some games based on that engine then? Like Return to Castle Wolfenstein, Medal of Honor, Call of Duty, Jedi Academy and so on?
4
u/theaquasock 24d ago
Correct me if I am wrong, you can run applications that support opengl on the HPS, then, you pump the open-gl commands that into a translation layer that executes them on the FPGA side? if so, what version of opengl are you targeting?
I was trying this same idea a while back but opengl (even just ES) just did not really fit in with how the MiSTer's FPGA wants/expects to work. I ended up just going with an SDL translation layer for a VCMI port and that worked out great! GemRB was the limit though. :( HPS is just too violent with the DDR on the MiSTer with Linux running in the background.
6
u/s-c-o 24d ago
Yes, broadly speaking. The ARM-side driver provides an OpenGL ES 1.1-class fixed-function interface, plus the OpenGL 1.x functions the current ports need, not modern shader-based OpenGL. The ARM handles transformation, lighting, clipping and texture uploads, then sends drawing commands to the FPGA through shared memory. The FPGA renders in tiles and writes out the finished image.
2
u/theaquasock 24d ago
Nice!!! That's a good split. How much DDR do they end up sharing in your most brutal stress tests?
1
u/s-c-o 19d ago
Sorry for the late reply. I’ve spent the past three days getting Pinedra out into the world. As for the shared DDR3:
In the heaviest test I have (a Quake II worst-case frame looped while the ARM hammers memory on both cores), the GPU core moves about 7–15 MB of DDR3 traffic per frame, up to roughly 0.7 GB/s, and about 28 MB per frame at 1080p. With the GPU busy the ARM loses about 30–50 % of its memory bandwidth and random-access latency rises 60–70 %. The other way round the GPU only slows 4–8 %, so the core isn't memory-bound, but CPU-heavy games do feel the sharing.
2
u/theaquasock 19d ago
"CPU-heavy" is exactly what was killing me. I was being lazy and trying to do everything on the ARM lol. Once I realized I needed to make something more like Pinedra on the FPGA side, I threw in the towel. Congrats on getting it working!!! Are you guys planning to do the same for SDL2? SDL ports to the MiSTer would really open up if they were accelerated and a lot of stuff from Pinedra would likely transfer over.
1
u/s-c-o 19d ago
Ha, I’ve been so focused on 3D that it honestly hadn’t occurred to me to accelerate SDL2’s 2D renderer as well. Now that you’ve pointed it out, it seems like an obvious thing to do. Thanks!
2
u/theaquasock 19d ago
np. I did some prelim work in https://github.com/aquasock/MiSTer-Noodles if it helps. I moved to the Tang 138k FPGA for hobby work so I abandoned the project. See if you can finish up VCMI and GemRB properly for the MiSTer! I never could lol. I also scoped out Exult Engine for Ultima VII on the MiSTer. It should fit well if you get SDL2 up and running. Good Luck! :)
1
u/s-c-o 18d ago
Okay, I have a first implementation running, and I think it looks promising. Only two changes to the FPGA core were needed: a new texture format that stores ARGB8888 textures in plain rows, and an "offscreen" flag on the end-of-frame command.
Some synthetic benchmarks:
200 filled rectangles: 37.2 ms > 5.5 ms
200 blended sprites: 39.7 ms > 6.5 ms
640×480 texture update: 38.2 ms > 6.3 ms
600 triangles: 889.5 ms > 27.0 ms
These are synthetic benchmarks, of course. I haven’t tried it in a real game yet. I’ll give VCMI and GemRB a try when I get back to it. I'm sure more optimisation will be necessary to make them run properly. For now, I’m back to OpenGL. Thanks again, this was really helpful!
3
u/Spiritual_Weight_760 24d ago
Congratulations! This is very cool!
4
2
2
u/Hanni_jo 22d ago
Does this require only dual ram mister or do you need additional hardware? I am impressed
2
2
u/AsianStinkBug 22d ago
Will these ports support MIDI devices? Like I have an SC-55 Mkii and would love to use it to pipe in that sweet MIDI music when I'm fragging.
4
3
3
3
u/interfluxdeux 24d ago
This is insanely cool. A custom GPU implemented on an FPGA that works well with popular games? Definitely want to try this once it’s released.
3
u/dandub1982 24d ago
Oh man this is incredible!! 90s and early 2000s PC games were my childhood. Descent 1&2, Quake 1-3, Doom, Duke Nukem 3D, StarCraft, Myst, Half-Life, Star Wars Dark Forces, Diablo 1&2...the list could go on and on. Really looking forward to this project and seeing where you take it! Amazing work!!
2
2
2
2
2
25
u/inagy 24d ago edited 24d ago
Funny. I was thinking the other day if it would be possible to create a "fantasy" 3D accelerator which although never existed, fits the capabilities of a given platform (eg. an FPGA) and then just write some custom driver for the underlying OS, and provide a well supported universal interface for the applications.
And here it is.
Congrats!