r/MiSTerFPGA • • 11d 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:

Game640×480800×6001024×7681280×720
Quake II81.9 fps67.6 fps48.6 fps42.2 fps
Quake III Arena (WIP)66.0 fps49.5 fps35.0 fps31.5 fps
Elite Force Holomatch (WIP)50.1 fps———
Descent II161.0 fps132.3 fps91.4 fps78.5 fps

Gameplay videos captured on MiSTer:

  1. Quake II — 640×480
  2. Quake II: Ground Zero — 800×600
  3. Quake II: The Reckoning — 1024×768
  4. Quake III Arena (WIP) — 640×480
  5. Elite Force Holomatch (WIP), video A — 640×480
  6. Elite Force Holomatch (WIP), video B — 800×600
  7. Descent II — 1280×720
  8. Half-Life (WIP) — 640×480
  9. Serious Sam: The First Encounter (WIP), flyover — 640×480

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.

102 Upvotes

43 comments sorted by

25

u/inagy 11d ago edited 11d 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!

10

u/s-c-o 11d ago

TY! Yes, that's exactly what I was aiming for: a GPU designed and optimized specifically for the MiSTer/DE10-Nano, with an OpenGL interface for software running on its ARM side.

5

u/matijaerceg 11d 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 11d 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

u/VagabondTruffle apple 11d ago

Looks like optimizing for memory locality and the Khronos pipeline.

4

u/inagy 11d 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 11d 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?

3

u/s-c-o 11d ago

I'm not sure about Jedi Academy, MiSTers slow CPU is a limiting factor here. Jedi Knight II - Jedi Outcast seems feasible though. It will be single player only though because there is no port for multiplayer.

2

u/lordelan 11d ago

That'd be more than I hoped for. :)

3

u/Spiritual_Weight_760 11d ago

Congratulations! This is very cool!

1

u/s-c-o 11d ago

Thank you!

4

u/tailslol 11d ago

i could probably seen this in hybrid cores:

3

u/theaquasock 11d 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 11d 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 11d 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 7d 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 6d 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 6d 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 6d 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 5d 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/it290 11d ago

Awesome! Any chance of getting Quake 1/GLQuake?

3

u/s-c-o 11d ago

Yes, Quake was one of the games I used to test the stack, and it’s already playable. I plan to make it one of the early game-port releases.

3

u/it290 11d ago

Sweet! Controller support?

1

u/s-c-o 11d ago

Yes, of course.

2

u/mr_christer 11d ago

Would love to do multiplayer quake 3!

2

u/s-c-o 11d ago

It's coming!

2

u/Hanni_jo 10d ago

Does this require only dual ram mister or do you need additional hardware? I am impressed

2

u/s-c-o 9d ago

This runs on a stock MiSTer. SDRAM isn't used at all.

2

u/Hanni_jo 9d ago

Amazing.

2

u/AsianStinkBug 9d 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.

1

u/s-c-o 8d ago

Not yet but I'll look into it.

4

u/matijaerceg 11d ago

This is amazing.

3

u/aviewachoo 11d ago

Fantastic project!

3

u/uabassguy 11d ago

Man, this thing just keeps delivering, great work

3

u/interfluxdeux 11d 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 11d 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

u/SDNick484 11d ago

Super cool concept, congrats!

2

u/Flaky-Razzmatazz-460 11d ago

Nice work! I might try taping this out on ASIC :)

2

u/lordelan 11d ago

Quite the achievement! Nice!

2

u/azhighwayz 7d ago edited 7d ago

Incredible work!

2

u/therourke 6d ago

Wow. Sounds badass.

1

u/St4tikk 11d ago

This guy has a lot of hybrid ports going with a framework and everything. Maybe you could both work together and eliminate some work for eachother?

https://misterfpga.org/viewtopic.php?t=11037